More-helpful linker errors
tomhampshire opened this issue · 2 comments
tomhampshire commented
Having just debugged an issue, it is clear that it would have helped me if the following asserts gave some clear information as to why/how "The .text section must be placed inside the FLASH memory.". For example, add to this: "It is likely that this is failing because you are using more FLASH than you actually have"
cortex-m/cortex-m-rt/link.x.in
Lines 255 to 262 in 6b3a5b7
jamesmunns commented
Errors as it looks today:
= note: rust-lld: error:
ERROR(cortex-m-rt): The .text section must be placed inside the FLASH memory.
Set _stext to an address smaller than 'ORIGIN(FLASH) + LENGTH(FLASH)'
rust-lld: error:
ERROR(cortex-m-rt): The .text section must be placed inside the FLASH memory.
Set _stext to an address smaller than 'ORIGIN(FLASH) + LENGTH(FLASH)'
rust-lld: error:
ERROR(cortex-m-rt): The .text section must be placed inside the FLASH memory.
Set _stext to an address smaller than 'ORIGIN(FLASH) + LENGTH(FLASH)'
adamgreig commented
Thanks for reporting this.
I think we should change this assert to just check that _stext is inside FLASH without checking the whole of .text fits, and leave that check to the linker instead (which will give a better error message).
Something like:
ASSERT(_stext > ORIGIN(FLASH) && _stext < ORIGIN(FLASH) + LENGTH(FLASH), "
ERROR(cortex-m-rt): The .text section must be placed inside the FLASH memory.
Set _stext to an address inside the FLASH region.'");