Data is not put in expected section when optimization level is O3 with global optimization

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Data is not put in expected section when optimization level is O3 with global optimization

1,438 Views
michael_liu
NXP Employee
NXP Employee
I'm using CW3.0 Beta, and found that when optimization level is O3 with global optimization the data is not put in expected section or unexpected data is put in the section. I'm using such directive as .rename "*starcore_main.eln",".data",".cc_m3_data" in the lcf file.  I found in the .map file that the file name in which the data is declared is not correct.  For example, an array is declared in file1.c with int a[100], and is declared in file2.c as 'extern int a[]', in lcf file there is .rename "*file1.eln",".data",".cc_m3_data" ,  and finally in the .map file it showed array a is not from file1.c but file2.c, and some unexpected data is put in .cc_m3_data also.  Has anyone experienced this issue and can give some explanation?
Labels (1)
Tags (1)
0 Kudos
2 Replies

286 Views
CrasyCat
Specialist III
Hello
 
I assume you are using CodeWarrior for StarCore. Am I right?
When you are activating global optimization, the compiler internally merges the whole application in one single file. So file file1.eln does not exist any more.
 
If you wish to allocate an object in a specific section, you have to use the place command in an application configuration file.
 
I hope this helps.
 
CrasyCat
0 Kudos

286 Views
michael_liu
NXP Employee
NXP Employee
Yes, you are right.  Thank you
0 Kudos