andy25
Occasional Contributor
2 years agoNios V, Max10, C++: region `reset' overflowed by 4 bytes
Everything was working fine, compiles ok, runs ok, then I added more code and suddenly: [ 98%] Linking CXX executable app_free.elf
/quartus/V23.1-STD/riscfree/toolchain/riscv32-unknown-elf/bin/../...
- 2 years ago
I think I found an answer. My Nios Reset was pointing to on-chip memory, with base 0xc000000.
.text was in external ddr3 at base 0x0, and __start was at 0x804.
Generating the linker map I see:
.entry 0x000000000c000000 0x24 *(.entry) .entry 0x000000000c000000 0x24 freertos_bsp/libfreertos_bsp.a(crt0.S.obj) 0x000000000c000000 __resetWhich tells me the only thing in the .entry section is __reset, and this is __reset in crt0.S:
.section .entry, "xa" .align 5 .globl __reset .type __reset, @function __reset: /* * Jump to the _start entry point in the .text section if reset code * is allowed or if optimizing for RTL simulation. */ /* Jump to the _start entry point in the .text section. */ tail _start .size __reset, . - __resetI'm wondering if the "tail _start" instruction had to be encoded with extra bits because I'm jumping from 0xc000000 to 0x804?
When I switched my Nios reset to also point to external ddr3, then my C++ compiled ok.
Now my .entry is at 0x0, and _start is still 0x804.
Does that seem like a reasonable explanation?