How to assign constant variable to cal_rom region

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to assign constant variable to cal_rom region

843 次查看
tiganhee
Contributor I

Hello,

   My mcu type is MPC5642A, and below is memory layout from linkfile.

   I have a questions:

   How to assign constant variable to cal_rom region?

    thankyou very much!

pastedImage_6.png

pastedImage_5.png

0 项奖励
回复
1 回复

794 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

here is an example:


In linker file:

MEMORY
{
    …
    my_flash:  org = 0x003C0000,  len = 0x00040000
    …
}

SECTIONS
{
    …
    .__my_flash LOAD (0x003C0000): {} > my_flash
    …
}

In *.c file:

#pragma push
#pragma section const_type ".__my_flash" ".__my_flash "

uint32_t a;
uint32_t b;
uint32_t c[10];
……
#pragma pop

Notice that you can use const_type or sconst_type or all_types in “#pragma section”. Here is the description from CodeWarrior:

- code_type - executable object code
- data_type - non-constant data of a size greater than the size specified in the small data threshold option in the EPPC Target settings panel
- sdata_type - non-constant data of a size less than or equal to the size specified in the small data threshold option in the EPPC Target settings panel
- const_type - constant data of a size greater than the size specified in the small const data threshold option in the EPPC Target settings panel
- sconst_type - constant data of a size less than or equal to the size specified in the small const data threshold option in the EPPC Target settings panel
- all_types - all code and data

Regards,

Lukas

0 项奖励
回复