Hi, I have the following problem: I have written a program that needs some functions to be in RAM for self-flashing the controller. It was working without any problems until I decided to put this functions, together with some others, in a library, lets call it os.lib, and link it to an application project. Now I have the problem that some of the library are still linked to the "ramfuncs" section, but others are not. A little example:
The files first.c and second.c are part of the "os.lib" now, in the working version they were compiled together with the application part of the project.
first.c
#pragma CODE_SECTION(firstFunction,".ramfuncs");
void firstFunction(void)
{
// some code
}
second.c
#pragma CODE_SECTION(secondFunction,".ramfuncs");
void secondFunction(void)
{
// some code
}
Linker command file of the application project where the library is linked to:
MEMORY
{
...
FLASHLOAD (RX) : origin = 0x00201200, length = 0x3600 /* For storing code in Flash to copy to RAM at runtime */
...
}
/* Section allocation in memory */
SECTIONS
{
.intvecs: > INTVECS
.resetisr: > RESETISR
.text : > FLASH
.const : > FLASH
.cinit : > FLASH
.pinit : > FLASH
.vtable : > C0 | C1 | C2 | C3
.data : > C2 | C3
.bss : > C2 | C3
.sysmem : > C0 | C1 | C2 | C3
.stack : > C0 | C1 | C2 | C3
.dmactrltab : > C2 | C3
.heapram : > SH
GROUP
{
.ramfuncs
{ -l F021_API_CortexM3_LE.lib}
} LOAD = FLASHLOAD,
RUN = C0,
LOAD_START(ramfuncsLoadStart),
LOAD_SIZE(ramfuncsLoadSize),
RUN_START(ramfuncsRunStart),
PAGE = 0
}
Important detail: I don't want to put the whole "os.lib" into the RAM (like I do with the F021_API.lib), I only want to put some special functions into RAM.
Linker map file from the pplication project:
.ramfuncs
* 0 00201200 000020fc RUN ADDR = 20000000
...
00202fd4 00000084 : first.obj (.ramfuncs:firstFunction)
00203058 0000000a : second.obj (.tramp.secondFunction.1)
.text 0 00204800 0000727e
0020b458 0000002e os.lib : second.obj (.text:secondFunction)
...
0020ba74 0000000a : first.obj (.tramp.firstFunction.1)
As you can see, the first function is fully put into the .ramfuncs section and 10 bytes of .tramp (whatever this is) is in flash memory, while the second function is NOT put into the .ramfuncs section but in the text section, while in the RAM only is the .tramp part of it. Additionally, I have to say that there are some more functions in first.c, they are also put to the .ramfuncs section, while other functions in second.c are also in the text function, altought they have a similar PRAGMA directive as firstFunction and secondFunction. Using the linker command file to put the whole first.obj and second.obj (or even the whole os.lib) to the .ramfuncs section would be the last option, because this would need way too much RAM.
Do you have any idea what could cause this problem?