This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

GNU ld: moving executable to RAM

Hi.

I'm compiling for a ADuC7026 with 8K of internal RAM (62K of FLASH). These chips are unable to run at full speed out of FLASH (due to access timing issues) and I need to execute some instructions faster, which can be done by executing from the internal RAM. So I need to move some executable stuff from FLASH to RAM when required (at start up similar to the .data section).

What I have done is subdivide the internal RAM into two regions in the MEMORY section of the linker script (it makes no difference if I do this or not). I have created a SECTION in the script to accomodate the RAM based executable. The VMA of the SECTION is in one of the RAM regions, but an LMA in between the RODATA (constants) and the DATA (initialised data) SECTIONS. {I have also added assignments in the linker script and modified the startup file so that there is [or would be] a transfer of the executable from its LMA to its VMA}

Everything seems to be fine except that the .hex file that is output does not include the exectuable portion that needs to be transfered to RAM. The .map file shows the space allocated for it in the output, and the .elf file has the executable in its correct location (in RAM), and the .data section is correctly placed. [ie there's a hole in the output file where the executable should be, but is not]

How do I convince ld (or possible objcopy) to keep the executable from the rogue SECTION in the correct place in the output?

0