Hello,
I am using a TMS570LS20216 with code composer studio 5.1
I have two questions:
-First, does code run faster in RAM than in FLASH?
-Second, I want to run some time critical functions from RAM and I am having problems.
My code is in C++, compiled in thumb2 mode and my command file looks like this:
MEMORY
{
VECTORS (X) : origin=0x00000000 length=0x00000040
FLASH (RX) : origin=0x00000040 length=0x001FFFC0
STACKS (RW) : origin=0x08000000 length=0x00001500
RAM (RWX) : origin=0x08001500 length=0x00026000
}
SECTIONS
{
.intvecs : {} > VECTORS
.text : {} > FLASH
.const : {} > FLASH
.cinit : {} > FLASH
.pinit : {} > FLASH
.bss : {} > RAM
.data : {} > RAM
ramfuncs : LOAD = FLASH,
RUN = RAM,
LOAD_START(__RamfuncsLoadStart),
LOAD_END(__RamfuncsLoadEnd),
RUN_START(__RamfuncsRunStart)
}
For the functions that I want to run in RAM, I use a pragma directive like this:
#pragma CODE_SECTION( "ramfuncs" );
void MyClass::MyFunction( void )
{
// Code
}
At the beginning of my main function I added a routine that copies the ramfuncs section from FLASH to RAM:
char *src = (char *)&__RamfuncsLoadStart;
char *end = (char *)&__RamfuncsLoadEnd;
char*dest = (char *)&__RamfuncsRunStart;
while ( src < end )
{
*dest++ = *src++;
}
When I compile, I don't get any error and the map file looks good, I get something like this so my ramfuncs section loads from FLASH and runs in RAM and the size looks good.
SEGMENT ALLOCATION MAP
run origin load origin length init length attrs members
---------- ----------- ---------- ----------- ----- -------
08006b5c 000017e2 0000001e 0000001e r-x ramfuncs
My first problem is that when I try to load the resulting .out file to the developpement board with the XDS100V2 emulator (Everything works ok if I don't try to put functions in RAM) I get the error "File: C:/myfil.out: a data verification error occured, file load failed."
My second and most important problem is that we made a program that repackages the .out file (ELF format) to be loaded via CAN by a custom debugging application and in the .out file I only have the RUN address for section ramfuncs (I can't find the LOAD address) so my program doesn't know where to put this section in flash. On previous projects with a F28335 and CCS3 we did a similar scheme and it worked fine.
Is it possible to du what I want?
Can somebody help me, how do I get the LOAD address in the .out file?