Other Parts Discussed in Thread: CONTROLSUITE, C2000WARE
Tool/software: TI C/C++ Compiler
Dear all,
I have a couple of questions regarding the linker file design, I will clearly emphasize the questions. Please find attached a minimum working example for the target device (blinky LED for LAUNCHXL-F28379D), but I would say this questions applies to C2000 series microcontrollers in general. You do not have to modify the project, it is ready for build and debug.
1. Save program to Flash, and run it from Flash
I have this case working with the help of example projects found in controlSUITE for the considered device. However, I also have a problem here. If you open the linker file in the project, you will see a macro flag "OLD_BOOT". If you define this flag, the linker will use the working variant to run the program from Flash, as follows:
- Save the program in FLASHE sector.
- Run the program from FLASHE sector, unless function is defined with "ramfunc" attribute.
- In case there are functions that need to be run from RAM, place them in RAMGS0_5 sector.
- The "codestart" section points to first word in FLASHA sector.
In this example I do not like the fact that I'm using FLASHA sector for the "codestart" section, since the entire program is saved in FLASHE sector. So I tried to define the "codestart" section to also reside in the FLASHE sector. You can simulate this case by removing the "OLD_BOOT" macro in the linker file. It does not work! When I build and debug the program, it works on the LaunchPad in the debug mode, but as soon as I reset the device, the program stops working, i.e. it does not boot. I assume that the program counter ends up somewhere in weed. I am not sure why is that. Q1 Does the program always go to 0x080000 (FLASHA) after reset to see where to jump next? If not, Q2 How can I fix the linker file to have the "codestart" section also in FLASHE sector?
2. Save program to Flash, and partially run from RAM
In this case I use the linker file with "OLD_BOOT" macro defined, i.e., the "codestart" section resides in FLASHA sector.
I defined the doBlink() function with "ramfunc" attribute, and I also have defined CPU1, _FLASH, and _LAUNCHXL_F28379D macro flags in "Build - C2000 Compiler - Predefined Symbols" project properties. These flags will instruct the built-in InitSysCtrl() function to copy functions from Flash to RAM.
3. Save program to Flash, and run it from RAM
In this case I use the linker file with "OLD_BOOT" macro defined, i.e., the "codestart" section resides in FLASHA sector.
The former case defined only one function to be run from RAM. However, you can set "ramfunc" attribute globally to all functions in "Build - C2000 Compiler - Advanced Options- Runtime Model Options" by setting the "Run functions from RAM. (--ramfunc)" to "on". In this case the main() function should be placed to RAM as well. However, this program does not even work in the debug mode, i.e., program counter ends up in weed as soon as I boot the device. Q3 How can I fix the linker file to support thix case?
Conclusion
There are three questions, I read a lot of documents and old threads trying to fix the issue, but without any luck. I appreciate if someone can provide support.
Thank you!
Marko.