Hi CrasyCat,
As indicated in my initial post, I found the document and also looked at the section you are mentioning. The "Predefined sections" are doesn't give the whole picture. Once I dug through it and put the puzzle together it made more sense, since I could fill in the blanks then. I went through the exercise to build a test software set and played around with pragma section statements to find our what C variable definitions ends up where.
Here are my findings (which I did for MPC5554 compiler version 2.1) in the form of a truth table: Metroworks Codewarrior Compiler Version 2.x definition for memory mapping in C-Source code: =====================================================================
#pragma section <type> "initialized_Object_Name" "uninitialized_Object_Name"
possible options for <type>:
====================
code_type — executable object code
data_type — non-constant data of a size greater than the size specified in the
small data threshold setting in the CodeWarrior IDE’s PowerPC EABI Project
panel
sdata_type — non-constant data of a size less than or equal to the size
specified in the small data threshold setting in the CodeWarrior IDE’s
PowerPC EABI Project panel
const_type — constant data of a size greater than the size specified in the
small const data threshold setting in the CodeWarrior IDE’s PowerPC EABI
Project panel
sconst_type — constant data of a size less than or equal to the size specified
in the small const data threshold setting in the CodeWarrior IDE’s PowerPC
EABI Project panel
all_types — all data Default sections and default access:
==========================
code_type ".text" data_mode=far_abs code_mode=pc_rel
data_type ".data” data_mode=far_abs code_mode=pc_rel
const_type ".rodata” data_mode=far_abs code_mode=pc_rel
sdata_type ".sdata” data_mode=sda_rel code_mode=pc_rel
sconst_type ".sdata2” ".sbss2" data_mode=sda_rel code_mode=pc_rel
all_types
Here are some examples (truth table format):
================================
// *1 *2 *3 *4 *5const char t1[5] = {1,2,3,4,5}; // sdata2 sconst_type const, initialized, small
const char t2[9] = {1,2,3,4,5,7,8,9}; // rodata const_type const, initialized, not small
const char t3; // sbss2 sconst_type const, not initialized, small
const char t4[9]; // rodata const_type const, not initialized, not small
char t5[5] = {1,2,3,4,5}; // sdata sdata_type not const, initialized, small
char t6[9] = {1,2,3,4,5,7,8,9}; // data data_type not const, initialized, not small
char t7; // sbss sdata_type not const, not initialized, small
char t8[9]; // bss data_type not const, not initialized, not small
Notes: *1 default name of region used by the compiler
*2 <type> to use in #pragma statement (see above)
*3 Truth table entry 1 (const / not const)
*4 Truth table entry 2 (initialized / not initialized)
*5 Truth table entry 3 (small / not small)
NOTE: "small" is determined by Codewarrior "EPPC Target panel" settings "Small Data" and
"Small Data2" and has a value of 8 bytes by default.
Now, if I want to place a variable in a section that I like to define, you can do that like this:
#pragma section sdata_type "dum_sec" "unini_Vars_less_9_Bytes"
uint8_t my_8_Bit_Variable;
uint32_t my_32_Bit_Variable;
#pragma section sdata_type // set back to default section names...
Hope this helps some folks out there....
Alwin