Altera_Forum
Honored Contributor
19 years agoRedBoot ROM-startup linker script broken?
I've got the "ROMRAM" startup version of RedBoot running fine when loaded into RAM using gdb/JTAG. However, the "ROM" startup version doesn't work at all when programmed into flash (no diagnostic output, no network activity).
Other stand-alone programs work fine when programmed into flash, so I know the hardware works fine. Looking at the section headers for redboot.elf reveals what appears to be a serious problem. Flash is at address 0x00000000, RAM is at address 0x08000000:redboot.elf: file format elf32-littlenios2
Sections:
Idx Name Size VMA LMA File off Algn
0 .entry 00000020 08000000 08000000 00025380 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .text 0001f174 00000000 00000000 000000f4 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .rodata 00005164 0001f174 0001f174 0001f268 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
3 .exceptions 0000002c 08000020 000242d8 000243cc 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
4 .rom_monitor_rwdata 00000108 0800004c 00024308 000243f8 2**0
ALLOC
5 .rwdata 00000f88 08000154 00024410 000243f8 2**2
CONTENTS, ALLOC, LOAD, CODE
6 .bss 0002014c 080010e0 080010e0 000253a0 2**4
ALLOC The problem is that the .entry section has an LMA in _RAM_ but it has its CONTENTS and LOAD attributes set. That indicates that the program expects that sections to be initialized, in RAM, _before_execution_starts_. Since that section is in RAM, that's clearly not going to happen: only sections with an LMA in flash ROM will contain initialized values when program execution starts. How can the ROM startup version of RedBoot expect a section in _RAM_ to be initialized? Only sections located in flash should have their LOAD attribute set. The ROM startup linker script seems to be just plain broken: it is placing code in RAM. I haven't touched the linker script, so I presume other people have run into similar problems? Has anybody got fixed versions of the RedBoot ROM-startup linker scripts?