Tool/software: TI C/C++ Compiler
First of all, I will tell you about the environment here
Code Composer Studio Version: 6.1.0.00104
Compiler Version: TI v6.2.8 (and v6.4.8)
Test Target: F2837x controlCARD R1.3
I did some experiments with Debug Build Configuration(not Release).
I attached a set of base project files.
[Experiment 1] Simple main.c
Comment out SET_DATA_SECTION below from base project.
===
//#pragma SET_DATA_SECTION("MY_SECTION")
const int some_const = 10;
//#pragma SET_DATA_SECTION()
===
After build, I checked map file.
"some_const" symbol mapped in ROM.
===
0 000901c0 _some_const
===
If run via CCS Debug, LED works properly.
If boot standalone, LED works properly.
[Experiment 2] Use DATA_SECTION
Use the base project as it is.
After build, I checked map file.
"some_const" symbol mapped in RAM.
===
1 0000b800 _some_const
===
If run via CCS Debug, LED works properly.
If boot standalone, LED don't works because maybe some_const is 0.
[Experiment 3] Use DATA_SECTION (arrange)
Add new variable definition from base project.
===
#pragma SET_DATA_SECTION("MY_SECTION")
int some_variable;
const int some_const = 10;
#pragma SET_DATA_SECTION()
===
After build, I checked map file.
"some_const" symbol mapped in ROM.
===
0 000901c0 _some_const
1 0000b800 _some_variable
==
If run via CCS Debug, LED works properly.
If boot standalone, LED works properly.
[Question 1]
There is the a following sentence in spru514p 6.12.2.
"You can use the DATA_SECTION pragma to put the variable in a section other than .econst."
So, [Experiment 2] seems to be the correct.
In order to use standalone in this map, ROM data with an initial value needs to be created and loaded at startup.
How should I do?
[Question 2]
I expect [Experiment 2] and [Experiment 3] is same.
Why not?