i want to configure some global variables in the flash specified address;
please supply sample code for me;
thanks!
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
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.
thanks! "const" can be delete or not? the variable"test" value can be modified in flash??
thanks for your answer!!
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