Why data can not be alloced in specified flash area? - MC9S12XEQ512

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

Why data can not be alloced in specified flash area? - MC9S12XEQ512

Jump to solution
2,885 Views
MicroTang
Contributor III
Hi All,
 
The MCU is MC9S12XEQ512.
 
In PRM file,  a flash area CONFIG_AREA defined and user segment USER_CONFIG_SECTION is placed into the segment.
 
SEGMENTS
...
CONFIG_AREA = READ_ONLY   0xFE8000 TO 0xFE83FF;  /* Configuration Area: 1024 bytes*/
...
END
 
PLACEMENT
...
USER_CONFIG_SECTION INTO CONFIG_AREA;
...
END
 
 
 
Added p/n to subject.
In source code
 
#pragma CONST_SEG __GPAGE_SEG USER_CONFIG_SECTION
 
const T_uConfigHeader CFG_Header = {
    (T_u16)0x00u,      
    (T_u16)123u,  
    (T_u32)0x01020304u, 
    (T_u16)0x00u
};

const FileID_STRUCT CFG_BeginFileID = {
    (T_u8) BNG_FILEID_BYTE0_VALID, 
    (T_u8) BNG_FILEID_BYTE1_VALID, 
    (T_u8) BNG_FILEID_BYTE2_VALID, 
    (T_u8) BNG_FILEID_BYTE3_VALID, 
    (T_u8) BNG_FILEID_BYTE4_VALID, 
}; 

const T_uCFGRecord CFG_Records[CFM_GCC_MAXNOOFRECORDS] = {
    {
        (T_u8)0x11u, (T_u8)0x00u, (T_u16)0x0014u,(T_u8)0x00u, (T_u8)0x10u, (T_u8)0x00u, (T_u8)0x03u, (T_u8)0x00u, (T_u8)0x00u
    },
    {
        (T_u8)0x20u, (T_u8)0x00u, (T_u16)0xC000u,(T_u8)0x10u, (T_u8)0x1Fu, (T_u8)0x11u, (T_u8)0x12u, (T_u8)0x13u, (T_u8)0x14u
    },   
    {
        (T_u8)0x20u, (T_u8)0x00u, (T_u16)0xC001u,(T_u8)0x12u, (T_u8)0x2Fu, (T_u8)0x21u, (T_u8)0x22u, (T_u8)0x23u, (T_u8)0x24u
    }
}
...
 
But when I complied the code and checked map file, only CFG_Header and CFG_Records put in USER_CONFIG_SECTION, and CFG_BeginFileID is lost! 
 
SECTION: "USER_CONFIG_SECTION"
  CFG_Header CFG_Records
 
usr_cfg.obj:
  CFG_BeginFileID
 
 
Could you please tell me why CFG_BeginFileID can not alloced in USER_CONFIG_SECTION?
 
Thanks!


Message Edited by NLFSJ on 2008-12-16 09:49 PM
Labels (1)
0 Kudos
1 Solution
958 Views
MicroTang
Contributor III
Hi All,
 
The problem has been resolved.
 
Add
 
ENTRIES
usr_cfg.obj: CFG_BeginFileID
END
 
into prm file. The CFG_BeginFileID is alloced in USER_CONFIG_SECTION.
 
Thank you very much!
 
 
 
 

View solution in original post

0 Kudos
5 Replies
958 Views
Steve
NXP Employee
NXP Employee
Do you refer to CFG_BeginFileID anywhere in the code? It sounds like CodeWarrior is optimising out the array because it is not used.
0 Kudos
958 Views
MicroTang
Contributor III
Hi Steve,
 
Thanks for your information.
 
Yes, CFG_BeginFileID has not been referred. There is a function in other module read it's value by 'external'. Are there any #pragma options or complier options can keep CFG_BeginFileID in USER_CONFIG_SECTION?
0 Kudos
958 Views
CrasyCat
Specialist III
Hello
 
Can you please check the .map file generated by the linker.
Is the table CFG_BeginFileID allocated in another section or is it enumerated in the
UNUSED-OBJECTS SECTION?
 
When you declared the table CFG_BeginFileID  as external did you specify it is located in section USER_CONFIG_SECTION?
 
You need to specify the pragma CONST_SEG in the variable declaration as well.
 
CrasyCat
0 Kudos
959 Views
MicroTang
Contributor III
Hi All,
 
The problem has been resolved.
 
Add
 
ENTRIES
usr_cfg.obj: CFG_BeginFileID
END
 
into prm file. The CFG_BeginFileID is alloced in USER_CONFIG_SECTION.
 
Thank you very much!
 
 
 
 
0 Kudos
958 Views
CompilerGuru
NXP Employee
NXP Employee
Why do you want to link CFG_BeginFileID even if it is not referenced?


0 Kudos