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.
Tool/software: Code Composer Studio
Hello, I'm running into an issue where my global and static variables are not initializing to the correct values when it 's debuging,but when it's offline running there is no problem.
For example, if I declare a variable at the top of main .c like :
Uint16 test1 = 3;
Uint32 main(void)
{
……
while(test1 == 3)
{
LED_RED_BLINK;
delay();
}
……
}
when I'm debuging it test1 is not 3,so it's not in the while(test1 == 3){ },but when I'm offline running it will in the while(test1 == 3){ } which I can judge it through LED blink.
The project is transplant form the Example_f2803x_flash_kernel.It used to run in RAM,I change it to FLASH,I think there is something with configuration.Because it does no
occur in other project.
It is hard to pinpoint what may be happening with the information provided. You mention that the issue does not occur with other projects. Have you compared the project settings from the working projects to the non-working one? Converting a program that runs from RAM to one that runs from Flash requires some specific changes.You could also compare your project and settings with the flash example in C2000Ware or controlsuite.
Debugging with 'Memory Browser' I find that, the global variables 'test1' is right in FLASH but not in RAM.
Normally,the program is written in FLASH, and the global variables are automatically copied to RAM when powered up.I don't
know how it accomplish but I think there are something wrong in this step.
Thanks and regards,
Jiang
Jiang,
Yes, copying a code or data section from Flash to RAM at runtime requires some additional set up in the code. As suggested earlier, please have a look at the Flash example included in C2000Ware or ControlSuite. Pay close attention to the memcpy line in the main source file Example_2803xFlash.c, for example, and the linker command file in the project to get an understanding of how sections are copied from Flash to RAM.
The two app notes below are also a great reference and provide detailed instructions on how to achieve what you are looking for.