How to assign constant variable to cal_rom region

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

How to assign constant variable to cal_rom region

603 Views
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 Kudos
Reply
1 Reply

554 Views
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 Kudos
Reply