I will preface this by saying that I am not the initial author of this design. It was originally implemented by Eugene Kagan, which some of
you may remember. I am the one that must modify it. I appologize for the length in advance.
The basic premise is that I need two sections of ROM (APP and APP_2). There are many source files in several directories whose output
will go into APP. There is only one directory, with a couple of files, whose output will go into APP_2. I build these into a "group_2.out".
My linker.cmd looks like:
MEMORY
{
.
.
APP_2 (R) : origin=0x00100000 length=0x00000FFF
APP (R) : origin=0x00101000 length=0x000FF000
}
SECTIONS
{
.
.
.app_2:
{
Build\group_2.out(.text). = align(4);
Build\group_2.out(.const). = align(4);
/* .cinit section must load with rest of app */
} > APP_2
.app:
{
*(.text). = align(4);
*(.const). = align(4);
} > APP
.cinit:
{
*(.cinit). = align(4);
} > APP
}
This works perfectly. I can verify from the map file that each section is loaded correctly and the code works as expected.
This is where the ball gets dropped. I have another application for this code that requires the need to have different load and run addresses.
Both sections (APP and APP_2) need to have a load address that is 0x1000000 offset from the run address.
I start by linking with the above linker.cmd file except I specify the "-r" to make it relocatable.
I run some post build steps that modify the OUT file with checksum values etc.
Then I link all modules again using another linker command file that has this
configuration (no "-r"):
MEMORY
{
.
.
APP_2_RUN (R) : origin=0x00100000 length=0x00000FFF
APP_RUN (R) : origin=0x00101000 length=0x000FF000
APP_2_LOAD (R) : origin=0x01100000 length=0x00000FFF
APP_LOAD (R) : origin=0x01101000 length=0x000FF000
}
SECTIONS
{
.
.
GROUP
{
.app_2:{}
._app001: {} /* fill for that section */
} load > APP_2_LOAD run > APP_2_RUN
GROUP
{
.app:{}
._app000: {} /* fill for that section */
} load > APP_LOAD run > APP_RUN
}
I have applications that implement this 0x1000000 load address and they work perfectly. But they only
have one APP segment (only APP segment, not APP and APP_2).
When I add this second segment "APP_2", the first link works as expected. But I get an error
when doing this second linking that indicates that all of the symbols that are present in the
APP_2 segment are multiply defined in that "group_2.out" and the final OUT file that is to combine the
two segments.
It is like the second "GROUP"ing is including ".app_2" as well as ".app". In your TI documentation
(spru513d.pdf) I saw an "except" command, but I couldn't find any detail.
Please help.