I'm trying to add a section that will include calibration data stored in data flash and loaded in RAM at startup.
The firmware can modify these data in RAM and erase/program the data flash block with updated values.
So I created these sections in the .lcf file:
GROUP : |
{
.calibration_dataflash : {}
. = ALIGN (0x4000); |
.fee1_dataflash : {}
. = ALIGN (0x4000); |
.fee2_dataflash2 : {}
. = ALIGN (0x4000); |
.history_dataflash : {}
} > internal_dataflash
__CALIB_ROM_START = ADDR(.calibration_dataflash);
GROUP :
{
.calibration LOAD(__CALIB_ROM_START):
{
. = ALIGN (0x4); | |
*(.calibration_data) | |
. = ALIGN (0x4); | |
*(.calibration_crc) | |
. = ALIGN (0x8); |
}
} > calibration_ram
__CALIB_RAM_START = ADDR(.calibration);
__CALIB_RAM_END = ADDR(.calibration) + SIZEOF(.calibration);
In my header file I defined:
#pragma section ".calibration"
#define __CALIBRATION __declspec(section ".calibration")
But at compilation I have the following error:
>Linker command file output section '.calibration' has a type or input which
>is incompatible with
>section '.calibration' in file
I searched in many files and discussions but I haven't found the solution. Any idea ?
Environment: CW 10.5 for MPC5604B
Bonjour Christophe,
I don't have lot of expertise with MPC5604B processor but I've tried to reproduce the problem on my side.
I've just created a project with the wizard and added your lcf and source modification in MPC5604B_RAM.lcf and main.c file.
Attached you will find the project added.
Keep in mind I don't try to create a "running code".
Regards
Pascal
Bonjour Pascal,
Thanks for your answer.
Restarting with your example I finally managed to place my variables a the right address. At least when I check .map file for RAM placement and .mot file for ROM placement.
But I still have a warning at compilation:
=__CALIBRATION uint16_t test1 = 0x2222;
>'RW' object 'test1' is being put into section '.calibration_data' with access
>permission 'R';
>section's access permission will be changed to 'RW'
If I add (RW) information on calibration_ram line in memory section:
calibration_ram (RW): | org = 0x40005000, len = 0x00001000 /* 4K */ |
I got an error:
>':' expected in command file at line '42'.
Does the linker file syntax changed in eclipse ?
And adding the DATA filter type at .calibration line:
.calibration (DATA) LOAD(__CALIB_ROM_START):
doesn't change anything.
If I ignore the warning and launch a debug session, I got a Codewarrior alert:
Memory area from address 0x00080000 with size c is restricted for write in the memory configuration file.
What do I have to change in lcf file to solve this problem ?
Christophe
Hi Christophe,
Can you please provide me your application ?
For details you can refer to the \CW MCU v10.5\MCU\Help\PDF\MCU_Power-Architecture_Compiler.pdf
Pascal
Hi Pascal,
I solved the warning problem by inserting a RW filter in the pragma line:
#pragma section RW ".calibration_data"
The codewarrior alert in debug session was due to an invalid address for internal_dataflash in the memory section of .lcf file.
Thanks for your help.
Christophe