How to assign constant variable to cal_rom region

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to assign constant variable to cal_rom region

835件の閲覧回数
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 返信

786件の閲覧回数
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 件の賞賛
返信