MPC5606B  Configure global variable in flash address which i want to be

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

MPC5606B  Configure global variable in flash address which i want to be

825 Views
明伟张
Contributor III

i want to configure some global variables in the flash specified address;

please supply sample code for me;

 

thanks!

Labels (1)
0 Kudos
4 Replies

561 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

is this the same question like in

MPC5606B Configure variable in RAM to run

?

If you want to place just a constant to specific flash segment then use:

Linker file:

MEMORY

{

...

my_flash:    org = 0x003FF000,   len = 0x00001000

...

}

SECTIONS

{

...

.__my_flash LOAD (0x003FF000): {} > my_flash

...

}

In *.c file:

#pragma push

//#pragma section sconst_type ".__my_flash" ".__my_flash "

//or

#pragma section all_types ".__my_flash" ".__my_flash "

const uint32_t test = 0x1234;

#pragma pop

Regards,

Lukas

0 Kudos

561 Views
michaelchien
Contributor II

Hello Lukas

    I'm trying to have a constant variables in the specified flash address 0x1000000;

    I follow your suggestion, but I get a syntax error with .__my_flash LOAD (0x1000000): {} > my_flash.

    do you have any idea about this?

   My microcontroller is MPC5746C with S32 Design Studio for Power Architecture v1.2 complier.

0 Kudos

561 Views
明伟张
Contributor III

thanks! "const" can be delete or not? the variable"test" value can be modified in flash??

thanks for your answer!!

0 Kudos

561 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

yes, there must be "const". If you want to have variable in RAM, you have to follow this:

Re: MPC5606B Configure variable in RAM to run

You can modify the flash in both cases.

Regards,

Lukas

0 Kudos