HI Guys,
I already do what I need on ColdfireV2 with Codewarrior10.2 with some linker / pragma's in CW for Coldfire, just wondering how I do this in KDS for my KL27.
I have a C file with a bunch of RAM defined how I want, it needs to be sequential as it will be mirrored in EEPROM externally i.e. I have a basically a C file something like this for cold fire. The file will grow with remote updates so we can easily detect and see what the size is etc and intialise the EEPROM.
#pragma explicit_zero_data on
#pragma force_active on
volatile uint_32 EEPROM_TABLE_SIZE = 0;
volatile uint_32 EEPROM_INIT_VALUE = NVM_FIRST_BOOT_VALUE;
volatile uchar VD_CompileDate[18] = __DATE__; //Compile Date
volatile uchar VD_CompileTime[14] = __TIME__; //Compile Time
//pages of EEPROM varibles used for programming updating and defaulting the EEPROM on first boot go here
volatile uchar LAST_ADDRESS_MARKER = 0; //36215048 THIS IS TO BE LEFT AT THE END SO YOU CAN WORK OUT WHAT VALUE TO PUT IN Protect_Memory_From_RSU
#pragma explicit_zero_data off
#pragma force_active off
This worst great in CW10.7 on my MCF52259. In the linker I do some things to put it at a specific address, but I dont really need that, I just need all this data in sequence for my KL27.
Does anyone know how to make it put all my variables to be initialised (even zero) and keep all those even if not used?
Happy to hear of different / easier ways to do this. I was thinking of making a big struct maybe, not sure yet.
Hello Carl,
I think Relocate DATA to RAM is the good choice, as you said , you can define a struct, then define a variable
, refer to the below DOC relocate it to special RAM :
Relocating Code and Data Using the KDS GCC Linker File for Kinetis
Because if we use the __attribute__ with section, the variable is treated like an initialized variable.
GNU Linker, can you NOT Initialize my Variable? | MCU on Eclipse
Refer to this thread i also test on KDS,
In the RAM address 0x20000000 , there are the initialize datas 0 , for i relocate the TestData to 0x20000000
in linker file .
Hope it helps
Have a great day,
Alice Yang
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------