Hello, i want to save some variables directly to a known RAM section.
So to test that i have opened hello_world example project for MPC5746C, but it doesn't work:
This is the detail of what i added to hello_world example project:
in the main file:
#define _TEST_ __attribute__ ((section (".testsection")))
uint8_t test1 _TEST_ = 1;
uint8_t test2 _TEST_ = 2;
uint8_t test3 _TEST_ = 3;
int main(void)
{
.......
}
In the linker file:
1. if i add this after the definition of .rodata section like this :
.testsection: ALIGN(0x10)
{
KEEP(*(.testsection))
. = ALIGN(0x10);
} > m_data AT> m_text
the variable test1, test2, and test3 will go to the address 0x40000000 (i can see it in the map file) but when i debug and i browse that address i will find 00000000 instead of 01020300.
2. if i add this between the definition of .sdata and .data like this :
__TEST_ROM = __DATA_END;
.testsection : AT (__TEST_ROM)
{
. = ALIGN(0x10);
__TEST_RAM = .;
__test_start__ = .;
KEEP(*(.testsection))
__test_end__ = .;
} > m_data
__TEST_END = __TEST_ROM + (__test_end__ - __test_start__);
I will get this error :
section .sdata LMA [01003337,01003337] overlaps section .caldata LMA [01003334,01003342]
Thank you in advance,
Looking forward for your response