Other Parts Discussed in Thread: C2000WARE
i'm using flash, where do i have to copy this function to which file?
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.
i'm using flash, where do i have to copy this function to which file?
Manoj,
The #pragma you see at the end of your snippet is one of the required steps to get this into RAM. The other 2 are:
1)Inside the .cmd file you should see .TI.ramfunc placed as a load/run section; loading to flash and then running from RAM
Below is example from our generic_flash_lnk.cmd file located here: C:\ti\c2000\C2000Ware_5_00_00_00\device_support\f280013x\common\cmd
#if defined(__TI_EABI__)
.TI.ramfunc : LOAD = FLASH_BANK0_SEC_0_7,
RUN = RAMLS0,
LOAD_START(RamfuncsLoadStart),
LOAD_SIZE(RamfuncsLoadSize),
LOAD_END(RamfuncsLoadEnd),
RUN_START(RamfuncsRunStart),
RUN_SIZE(RamfuncsRunSize),
RUN_END(RamfuncsRunEnd),
ALIGN(8)
#else
.TI.ramfunc : LOAD = FLASH_BANK0_SEC_0_7,
RUN = RAMLS0,
LOAD_START(_RamfuncsLoadStart),
LOAD_SIZE(_RamfuncsLoadSize),
LOAD_END(_RamfuncsLoadEnd),
RUN_START(_RamfuncsRunStart),
RUN_SIZE(_RamfuncsRunSize),
RUN_END(_RamfuncsRunEnd),
ALIGN(8)
#endif
2)You need to call the memcopy function before initSysctrl() is called in program. Below is from our sysctrl.c file; you see the compile time #if for a pre-defined "FLASH" used to place this depending on if the compile is for a flash build or not. If you always plan to build for flash, you can remove the #if that wraps around this code.
oid InitSysCtrl(void)
{
//
// Disable the watchdog
//
DisableDog();
#ifdef _FLASH
//
// Copy time critical code and Flash setup code to RAM. This includes the
// following functions: InitFlash()
//
// The RamfuncsLoadStart, RamfuncsLoadSize, and RamfuncsRunStart
// symbols are created by the linker. Refer to the device .cmd file.
//
memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
//
// Call Flash Initialization to setup flash waitstates. This function must
// reside in RAM.
//
InitFlash();
#endif
Best,
Matthew
#ifdef _FLASH
memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
#endif
Added this function before InitSysCtrl() function. programmed the controller, after power off and Power ON controller is not comming back to running state.
Did you make the change to your .cmd file as well?
You can debug a boot to flash with CCS/JTAG attached; after connecting Reset the device(Run->Reset), then from Scripts select emulation boot, boot to flash. This will mimic a flash boot, and you can see where the code is getting hung up.
Best,
Matthew
Manoj,
Take a look at this post https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/618792/tms320f28027-how-does-emulation-boot-mode-is-configured , the implementation on the F280013x may be slightly different, but the concept is the same. There should be a one click way to set this under Scripts in the main toolbar of CCS.
The device TRM also discusses EMUBOOT flow https://www.ti.com/lit/pdf/spruix1
Best,
Matthew