Common Programming Issues

Linking Error

Error message:

relocation truncated to fit: R_RISCV_HI20 against `.LC0'

Solution:

set codemodel to medany.

-mcmodel=medany

https://forums.sifive.com/t/relocation-truncated-to-fit-r-riscv-hi20/2430/2

Stack and Heap Size Error

Error message:

relocation truncated to fit: R_RISCV_GPREL_I in .stack

Solution:

increase stack size or heap size defined in linker.

Error when using sprintf()

Error:

Program cannot run when using `sprintf()` with variables

Solutions:

Could due to the following reasons

  • program being too large with the additional libraries

  • instructions could be corrupted during SPI transmission

  • malloc() implementation issue

Size should be 2^2 for either, FESVR is not very thoroughly tested on 32 bit systems.

Last updated