Hi Alice,
I've written my linker file as follows:
MEMORY
{
m_interrupts (RX) : ORIGIN = 0x0000A000, LENGTH = 0x00000400
m_text (RX) : ORIGIN = 0x0000A400, LENGTH = 0x000FFBF0 - 0xA400 - 0x100
appFlag (RX) : ORIGIN = 0xFFAF0, LENGTH = 0x100
m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000
m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00030000
}
/* Define output sections */
SECTIONS
{
/* placing appFlag section at given address: */
.my_section :
{
. = ALIGN(4);
KEEP(*(.MyappFlag)) /* keep my variable even if not referenced */
. = ALIGN(4);
} > appFlag
In such way the appFlag is in the last 256 bytes of flash.
nevertheless, no matter what I do, after the appFlag is written in the application, the SW goes to hard fault.
Only when writing the appFlag to m_data_2, as follows, can I read/write the appFlag section.
MEMORY
{
m_interrupts (RX) : ORIGIN = 0x0000A000, LENGTH = 0x00000400
m_text (RX) : ORIGIN = 0x0000A400, LENGTH = 0x00075C00
m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000
m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00030000
}
/* placing appFlag section at given address:*/
.my_section 0x20020000 :
{
. = ALIGN(4);
KEEP(*(.MyappFlag)) /* keep my variable even if not referenced */
. = ALIGN(4);
} > m_data_2
What am I missing here? I understand here I'm writing to RAM, and before to ROM, right?
But why writing to ROM brings me to hard fault and RAM does not?