Tool/software: TI C/C++ Compiler
I am trying to use the GROUP directive for the TI linker to specify an order of sections within a memory region. One of the sections in the group will be .TI.ramfunc, the generated output section for functions that have the __attribute__((ramfunc)) applied. This section needs to be loaded at one address in flash, and run from a different address in RAM. I used the guide here to instruct the linker to do this copy for me. http://processors.wiki.ti.com/index.php/Placing_functions_in_RAM
The syntax I am using looks like this:
SECTIONS
{
GROUP
{
.cinit
.binit
.pinit
.text
.econst
.switch
.args
.TI.ramfunc RUN = GS_RAM, TABLE(BINIT)
} > FLASH
/* other sections here */
}
The linker accepts this syntax and generates a binary, but it emits the following warning:
"link.cmd", line 27: warning: placement ignored for ".TI.ramfunc": object is
placed as part of "GROUP_1"
When I look at the .map file for the generated binary I see the following entry for the BINIT table:
LINKER GENERATED COPY TABLES
binit @ 00080020 records: 1, size/record: 8, table size: 10
.TI.ramfunc: copy 4 bytes from load addr=00080110 at page=0 to run addr=00080110 at page=0
This indicates that the warning was accurate; it ignored the RUN placement and just used the LOAD placement of "FLASH" for the group as the RUN placement for .TI.ramfunc as well, but still generated an entry in the copy table to copy this section to itself (which will fail, because it's in flash). The RUN address should be around 0xC000, the start of GS_RAM.
The command I'm using to build a minimal example with this is:
cl2000 main.c -z link.cmd -Iti-cgt-c2000_18.1.3.LTS/lib -m main.map -o main.out
I've attached a zip of main.c, link.cmd, and the output main.map.
Two questions:
(1) Is this a bug in the linker? Should I be allowed to specify different RUN placements for different members of a group? (It seems like this should be possible, and the fact that it did generate a copy table entry for only this section suggests this should be allowed.)
(2) Given the current behavior of the linker, bug or otherwise, is there a different way to achieve my goal, specifically to order .TI.ramfunc within a group of other sections, while still letting the linker emit a correct copy table entry for it.