Hello Mehdi:
I have some comments:
1- Your m_text and m_factory_params segments are overlapping, and they need to be separated. It is common to place configuration parameters at flash start or end.
2- You declare the array inside of a function. It is not necessary. Just declare the array alone.
3- In CPU processor expert build options, use "R" instead of "RX". The same for the section declaration.
4- As your array is in flash (read-only) use const instead of static.
5- In the main you put ".para_config". According to your lcf, this should be ".paraconfig".
5- You are declaring the array, but as it is not referenced from your code yet, the linker is being "smart" and ignoring that section. Use KEEP_SECTION to force the linker to place that section.
6- :smileyalert: Once you modify the linker file, you need to disable linker file generation from CPU processor expert component. It is in the "Build options" tab.
With all that being said, here is how I would achieve your need:
- In the LCF file:
KEEP_SECTION { .vectortable }
KEEP_SECTION { .cfmconfig }
KEEP_SECTION { .paraconfig }
MEMORY {
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x000001E0
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x0007F7F0
m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000
m_data_20000000 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00010000
m_factory_param (R) : ORIGIN = 0x0007FC00, LENGTH = 0x00000400
m_cfmprotrom (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
}
SECTIONS {
## Heap and Stack sizes definition
__heap_size = 0x0400;
___stack_size = 0x0400;
.para_config :
{
__PARACFG = .; # start address of the new parameter configuration sector.
. = ALIGN(0x4);
* (.paraconfig) # actual data matching pragma directives
. = ALIGN(0x4);
} > m_factory_param
- In your code:
#pragma define_section para ".paraconfig" abs32 R
__declspec(para)
const uint8_t se_mee[0x10] =
{
0x01U, 0x02U, 0x03U, 0x04U, 0x05U, 0x06U, 0x07U, 0x08U,
0x09U, 0x0Au, 0x0BU, 0x0CU, 0x0DU, 0x0Eu, 0x0FU, 0x00U
};
/*lint -save -e970 Disable MISRA rule (6.3) checking. */
int main(void)
/*lint -restore Enable MISRA rule (6.3) checking. */
{
Hope this helps you.
Regards!
Jorge Gonzalez