LPC55S16 Issue Using Custom Flash Section For Data

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC55S16 Issue Using Custom Flash Section For Data

138 Views
jmorel
Contributor II

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.

Labels (1)
Tags (1)
0 Kudos
1 Reply

115 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

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". 

Alice_Yang_1-1717059254884.png

 

BR

Alice

 

0 Kudos