This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F280025C: Problem with copying program from flash and execute in the ram

Part Number: TMS320F280025C

Hi

I am having a problem copying parts from the flash to the ram. i looked on several guides that you have:

*TI Linker Command File Primer - TI Linker Command File Primer

* Running an Application from Internal Flash Memory on the TMS320F28xxx DSP.

*TMS320F28002x Flash API

*Copying Compiler Sections From Flash to RAM on the TMS320F28xxx DSCs

unfortunately, i am still having trouble. every time i try one of the methods of copying, my program stuck before main or somewhere in illegal operation trap. 

scenario 1:

Fullscreen
1
2
3
4
5
6
7
8
example1
{
file1.obj
file2.obj
} > FLASH_BANK0_SEC2
myfunc1 : LOAD = FLASH_BANK0_SEC2, RUN = RAMLS4
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

this isn't working. i use the #pragma CODE_SECTION to run my functions and i can see they have been copied but the program getting stuck too. by the way my program is written in cpp.

scenario 2:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
example2
{
file1.obj
file2.obj
} LOAD = FLASH_BANK0_SEC2
RUN = RAMLS4,
LOAD_START(MyfuncsLoadStart),
LOAD_SIZE(MyfuncsLoadSize),
LOAD_END(MyfuncsLoadEnd),
RUN_START(MyfuncsRunStart),
RUN_SIZE(MyfuncsRunSize),
RUN_END(MyfuncsRunEnd),
ALIGN(8)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

this option isn't working. the program get stuck. 

another question about this scenario: when using the symbols inside the LOAD_START, LOAD_SIZE and etc. i need to declare them inside my code?

you have an example with .TI.ramfunc :

Fullscreen
1
2
3
4
5
6
7
8
9
.TI.ramfunc : LOAD = FLASH_BANK0_SEC1
RUN = RAMLS4,
LOAD_START(RamfuncsLoadStart),
LOAD_SIZE(RamfuncsLoadSize),
LOAD_END(RamfuncsLoadEnd),
RUN_START(RamfuncsRunStart),
RUN_SIZE(RamfuncsRunSize),
RUN_END(RamfuncsRunEnd),
ALIGN(8)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

the symbols  RamfuncLoadStart, RamfuncsLoadSize and etc. they are declared inside the code.

when i try to use them again for my sections, i will get a warning "absolute symbol redefined".

i guess i don't understand the proper use for them.

another few points:

* the file "f28002x_codestartbranch.asm" is added to my project.

* when my program is running from ram it works. see example linker file below:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
codestart : > BEGIN, ALIGN(8)
.text : > RAMLS5 | RAMLS6 | RAMLS7, ALIGN(8)
.cinit : > RAMLS4, ALIGN(8)
.switch : > RAMLS4, ALIGN(8)
.reset : > RESET, TYPE = DSECT /* not used, */
.stack : > RAMM1
.init_array : > RAMLS4, ALIGN(8)
.bss : > RAMLS4
.bss:output : > RAMLS4
.bss:cio : > RAMGS0
.const : > RAMLS4, ALIGN(8)
.data : > RAMLS4
.sysmem : > RAMLS4
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

* when my program is running from flash it works. see example linker file below:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
codestart : > BEGIN, ALIGN(8)
.text : >> FLASH_BANK0_SEC2 | FLASH_BANK0_SEC3 | FLASH_BANK0_SEC4, ALIGN(8)
.cinit : > FLASH_BANK0_SEC1, ALIGN(8)
.switch : > FLASH_BANK0_SEC1, ALIGN(8)
.reset : > RESET, TYPE = DSECT /* not used, */
.stack : > RAMM1
.init_array : > FLASH_BANK0_SEC1, ALIGN(8)
.bss : > RAMLS4
.bss:output : > RAMLS4
.bss:cio : > RAMGS0
.const : > FLASH_BANK0_SEC1, ALIGN(8)
.data : > RAMLS4
.sysmem : > RAMLS4
//.TI.ramfunc : > RAMGS0
ramgs0 : > RAMGS0
/* Allocate IQ math areas: */
IQmath : > RAMLS4
IQmathTables : > RAMLS4
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Thanks

Yoav