litex-hub / wishbone-utils

Utilities for working with a Wishbone bus in an embedded device
Apache License 2.0
41 stars 12 forks source link

wishbone-tool: Support the lxterm serial load protocol #22

Open mithro opened 4 years ago

mithro commented 4 years ago

No idea what the protocol actually is however... I think it's the "OpenMoko Serial Flash Loader" (I think it was a predecessor to dfu-util actually?).

xobs commented 4 years ago

Seems like there's a lot in there, including a gdb server and xmodem transfer. Is the xmodem stuff ever actually used?

I think the meat of what you want is answer_magic(), which is used to upload a Linux kernel, initrd, and command line. Is that correct?

mithro commented 4 years ago

@xobs - Yes just the loading of stuff like kernel / initrd / etc.

The Python version might be a better starting point? https://github.com/enjoy-digital/litex/blob/5845df76cc61dc7563dc22bb7382e9696e830b6f/litex/tools/litex_term.py#L198-L231

xobs commented 4 years ago

The Python version seems to have a slightly different protocol. In particular, opcode 0x03 is SFL_CMD_CMDLINE in the C version, but sfl_cmd_load_no_crc in the Python version. Which is correct?

xobs commented 4 years ago

Actually, anything above 0x03 is also different.

mithro commented 4 years ago

I assume the one from https://github.com/enjoy-digital/litex/blob/master/litex/soc/software/bios/sfl.h ?

xobs commented 4 years ago

Yes, I'm comparing https://github.com/enjoy-digital/litex/blob/master/litex/soc/software/bios/sfl.h#L18-L24 and https://github.com/enjoy-digital/litex/blob/5845df76cc61dc7563dc22bb7382e9696e830b6f/litex/tools/litex_term.py#L57-L63

mithro commented 4 years ago

Looks like https://github.com/enjoy-digital/litex/commit/ffebd2076c6de67000fa90168a24e1bca6ba5ff8#diff-119cfa8e74253ebf2bef5e349863c3c8 was the commit which added 0x03 support to the bios + litex-term python version (ignoring the fact that 0x03 was already in usage).

mithro commented 4 years ago

I think we need to fix flterm at https://github.com/timvideos/flterm to match what litex_term and the current bios do.

mithro commented 4 years ago

Logged https://github.com/timvideos/flterm/issues/10