James Lee

Locating variables at fixed addresses (MPC55xx)

Discussion created by James Lee Employee on Jun 14, 2007
Latest reply on Jun 14, 2007 by James Lee
Hello,
 
I have few concerns with CodeWarrior MPC55xx build toolsBuild environment: CW for MPC55xx v2.0.
I want to place the variables a, b, and c in the segment ".APPL_16BIT_RAM" and defined the variables as follow.
 
#pragma push
#pragma section data_type ".APPL_16BIT_RAM" ".APPL_16BIT_RAM"
    unsigned short a;
    unsigned short b;
    unsigned short c;
#pragma pop
 
But the memory segment ".APPL_16BIT_RAM" was empty in the ".map" file which is generated from the source code. By default, the variables 'a', 'b' and 'c' are placed in ".sbss".
 
Of course, I know __declspec(section), but the usage of that for each variable makes the cocde compiler dependent and the memory mapping requirements of AUTOSAR cannot be met with this approach. According to AUTOSAR memory mapping requirements, with the use of single "memmap.h" (which contains #pragma statements), it should be able to place all the CODE and DATA into the required segments. For different compilers, to place the CODE and DATA into required segments, it is enough only to change the "memmap.h" file (no change required in the other source and header files).
 
In the earlier version of CodeWarrior (CodeWarrior Studio V4.5 for MC9S12X), I have developed the code in the following way.
 
#pragma DATA_SEG RAM_8BIT
    unsigned short a;
    unsigned short b;
    unsigned short c;
#pragma DATA_SEG DEFAULT
 
I am expecting something similar to this mechanism.
 
Best regards,
James
 

Outcomes