I'm trying to reserve a section of memory for a struct in my code but the second it tries to edit the stored value it hard faults. is their a specific flag that needs to be set to allow the code in execution to edit a reserved section of flash?
this is what i have set in my .Id file
m_Diagnotics (RX) : ORIGIN = 0x00000800, LENGTH = 0x00000200
.Diagnotics :
{
KEEP(*(.Diagnotics)) /* keep my variable even if not referenced */
. = ALIGN(4);
__Diagnotics_start__ = .;
*(.Diagnotics)
*(.Diagnotics*)
. = ALIGN(4);
__Diagnotics_end__ = .;
} > m_Diagnotics
ASSERT( LENGTH(m_Diagnotics) >= (__Diagnotics_end__ - __Diagnotics_start__), "m_Diagnotics overflowed !")
in the code:
Diagnostic_Data_t stDiagnostics_Flash __attribute__((section(".Diagnotics")));
and the second it tries to write to the struct it hard faults.
Hello @jmorel
Recommend refer to " 20.13.1 Placing code and data into different memory regions " of <MCUXpresso IDE User guide>. This method does not require any change to the source code.
If you want to change code by hand like your sharing, please uncheck “Manager linker script".
BR
Alice