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
thanks for the help in the end i had to reserve the location in the data field of the flash memory. if i try and reserve it any where else it hard faults when i try to write to it, must be a protection flag that is set. we atleast got a working solution but if you know what might be the setting required would be helpful. im also not using mcuxpresso we long moved away from it due to crash related issue this is why im using the .id file, this is all in vscode.