sifive/freedom-e-sdk

Errors in linker scripts?

HAKarlsson opened this issue · 2 comments

I believe I found errors in the linker scripts for HiFive Unleashed, HiFive1, and HiFive1 rev B, more specifically, the length of the flash memory is wrong.

  • HiFive Unleashed has 32 MiB of flash, but according to the .lds file it is 256 MiB of flash.
  • HiFive1 has 16 MiB of flash, but according to the .lds file it is 508 MiB of flash.
  • HiFive1 rev B has 4 MiB of flash, but according to the .lds file it is ~0.4MiB of flash.

I am new to low-level programming so I have no idea if this is intentional or not.

Hi @HAKarlsson,

Thanks, you're definitely right, our Devicetrees definitely misrepresent the size of the SPI flash on those boards. Root cause on the Unleashed and HiFive1 is that we don't yet do the Right Thing and require SPI flash nodes as children of SPI nodes, so the amount you see is the maximum amount of address space that the SPI peripheral can memory-map. The Rev B is just a mistake :)

These inaccuracies should get fixed pretty soon, I have a task on my todo list right now to improve that part of the project.

Thanks again,
Nate

I'll add on to this thread with an error that I believe is related to the issues with the flash sizes for the HiFive1 RevB - when compiling Dhrystone using make PROGRAM=dhrystone, TARGET=sifive-hifive1-revb LINK_TARGET=ramrodata software, the following error occurs:

/opt/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14/bin/../lib/gcc/riscv64-unknown-elf/8.3.0/../../../../riscv64-unknown-elf/bin/ld: dhrystone section `.bss' will not fit in region `ram' /opt/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14/bin/../lib/gcc/riscv64-unknown-elf/8.3.0/../../../../riscv64-unknown-elf/bin/ld: region `ram' overflowed by 7600 bytes.

If this error is not related, I'll relocate it.

Thank you!
~Lyell