Hi,
Can someone please tell me how to specify the flash location of a const variable for a Kinetis MCU using CW 10.2? I wan't to load a specific 32-bit value at a specific flash location.
Thanks,
-Mike
Mike, how is it going?
Were your doubts clarified?
Regards! :smileyhappy:
a very similar example like the one Luis provided can be found on this post:
Linking an array to a fixed address
The "@" method is not supported on the ARM compiler on CW.
Hello,
Declare your variable in the source code:
#pragma define_section constdata ".constdata" R
#pragma section constdata begin
int My_variable = 0x55AA;
#pragma section constdata begin
Then you have to edit your linker file, something like:
.constdata :
{
*(.constdata)
.= ALIGN(0x4) ;
} > my_data
And define my_data section on memory, it depends on the device and memory location you want:
MEMORY {
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x000001E0
my_data (RX) : ORIGIN = 0x00000800, LENGTH = 0x00000100
m_text (RX) : ORIGIN = 0x00000900, LENGTH = 0x00040000-0x00000800
m_data (RW) : ORIGIN = 0x1FFF8000, LENGTH = 0x00010000
m_cfmprotrom (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
}
I hope this helps.
Luis
So nothing as simple as:
volatile uint32 my_const @0x4A0 = 0x00C00FAB;
that I used with a ColdFire?