sifive / freedom-u540-c000-bootloader

Freedom U540-C000 Bootloader Code
Other
85 stars 39 forks source link

Build board setup binary to init hw from OpenOCD. #22

Closed timsifive closed 4 years ago

timsifive commented 4 years ago

I'm still not 100% convinced I got this right, because I don't see the ebreak show up where I expect to in the disassembly (according to objdump -D). But empirically it works. I don't know how to test the boot loaders themselves.

timsifive commented 4 years ago

Can somebody look at this? I hate to have a binary blob in riscv-tests without a good way for others to build it.

timsifive commented 4 years ago

I'd love a review here.

jim-wilson commented 4 years ago

I don't know how to test the boot loaders either offhand. However, if you write the patch so that the boot loader binaries don't change, then we don't have to test them. The current form of the patch moves fsbl/main.o to a different place in the link order, which results in different binaries. There are a few ways to fix this. You can have LIB_FS1_O and LIB_FS2_O and put fsbl/main.o in the middle which gives the same result. Or since there is only one file before fsbl/main.o, fsbl/start.o, you could pull that out and list it explicitly in the fsbl.elf rule before fsbl/main.o. Then beware that the Makefile uses git commands to create lib/version.c, so you have to copy the original version of that file from the unpatched tree into the patched tree to verify. I tried the first option and was able to get identical binaries.

Otherwise this looks OK to me. I'm willing to approve and commit if the fsbl binaries don't change.

Issue #9 has some info on how to use the fsbl.bin file. Presumably if you can boot linux after writing the fsbl.bin to flash it is OK.

timsifive commented 4 years ago

@jim-wilson, I've modified the Makefile as you suggested. The board setup still works. Thanks for the suggestion.