Open cobratbq opened 4 months ago
I marked this as a potential bug a while ago. It's not serious and doesn't affect much, possibly just wasting a few bytes of RAM.
We have different behaviour in firmware's crt0 and tkey-libs, at least.
This needs some investigation. Maybe it's just a misreading of the RISC-V spec of stack alignment, or maybe it's something else, like I replied in e-mail earlier.
Since we plan on using tkey-libs in firmware, too, this needs to be looked at before that. See https://github.com/tillitis/tillitis-key1/issues/129
I noticed that the stack-pointer is initialized to just below the end of the stack. Is there a specific reason for this? My understanding is that the stack-pointer is decremented upon each use of the stack, so setting it to
TK1_RAM_BASE+TK1_RAM_SIZE
(orORIGIN(RAM) + LENGTH(RAM)
in terms of the linker-script), should be optimal.libcrt0/crt0.S
:Am I missing something?