Hi,
I have a C2000 project working with ability to erase and write memory using Fapi provided by TI. For the purpose of downloading a binary .out of this project using a USB project, the command linker file was edited. The aim was to separate different sections (.cinit, .pinit, .text, ramfuncs, .econst, .switch) into separate flash memory sections. However, execution of Fapi_setActiveFlashBank() crashes if the location of Fapi_setActiveFlashBank() in flash memory is in different section from ramfuncs.
given the Flash sectors:
FLASHA : origin = 0x080002, length = 0x001FFE /* on-chip Flash */
FLASHB : origin = 0x082000, length = 0x002000 /* on-chip Flash */
FLASHC : origin = 0x084000, length = 0x002000 /* on-chip Flash */
FLASHD : origin = 0x086000, length = 0x002000 /* on-chip Flash */
FLASHE : origin = 0x088000, length = 0x008000 /* on-chip Flash */
FLASHF : origin = 0x090000, length = 0x008000 /* on-chip Flash */
FLASHG : origin = 0x098000, length = 0x008000 /* on-chip Flash */
FLASHH : origin = 0x0A0000, length = 0x008000 /* on-chip Flash */
FLASHI : origin = 0x0A8000, length = 0x008000 /* on-chip Flash */
FLASHJ : origin = 0x0B0000, length = 0x008000 /* on-chip Flash */
FLASHK : origin = 0x0B8002, length = 0x001FFE /* on-chip Flash */
FLASHL : origin = 0x0BA000, length = 0x002000 /* on-chip Flash */
FLASHM : origin = 0x0BC000, length = 0x002000 /* on-chip Flash */
FLASHN : origin = 0x0BE000, length = 0x002000 /* on-chip Flash */
This works fine:
.cinit : > FLASHA PAGE = 0
.pinit : > FLASHA, PAGE = 0
.text : >> FLASHA | FLASHB | FLASHC | FLASHD PAGE = 0
codestart : > BEGIN PAGE = 0
ramfuncs : LOAD = FLASHA,
RUN = RAMLS0 | RAMLS1 | RAMLS2 |RAMLS3,
LOAD_START(_RamfuncsLoadStart),
LOAD_SIZE(_RamfuncsLoadSize),
LOAD_END(_RamfuncsLoadEnd),
RUN_START(_RamfuncsRunStart),
RUN_SIZE(_RamfuncsRunSize),
RUN_END(_RamfuncsRunEnd),
PAGE = 0
.econst : > FLASHA PAGE = 0
.switch : > FLASHA PAGE = 0
However, if a flash memory sector B is used for ramfuncs:
ramfuncs : LOAD = FLASHB
the execution of Fapi_setActiveFlashBank() crashes. After a more thorough investigation it crashes if : Fapi_setActiveFlashBank() is in different Flash section than ramfuncs.
if I take FlashB and split it in two:
FLASHB1 : origin = 0x082000, length = 0x001000 /* on-chip Flash */
FLASHB2 : origin = 0x083000, length = 0x001000 /* on-chip Flash */
and try this:
.text : >> FLASHB2 | FLASHC | FLASHD PAGE = 0
codestart : > BEGIN PAGE = 0
ramfuncs : LOAD = FLASHB1,
it fails as Fapi_setActiveFlashBank() is in FLASHB2 and ramfuncs is in FLASHB1.
This however works:
.text : >> FLASHB2 | FLASHC | FLASHD PAGE = 0
codestart : > BEGIN PAGE = 0
ramfuncs : LOAD = FLASHB2,
If I check the ramfuncs section it has three funtions.
ramfuncs 0 00080a37 0000002D RUN ADDR = 00008000
00080a37 00000025 F2837xD_SysCtrl.obj (ramfuncs:_InitFlash)
00080a67 00000004 F2837xD_usDelay.obj (ramfuncs)
00080a6b 00000004 sysctl.obj (ramfuncs)
Any Ideas of why does one of these have to be in same memory section as Fapi_setActiveFlashBank() ?