LPC55S16 Issue Using Custom Flash Section For Data

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

LPC55S16 Issue Using Custom Flash Section For Data

206 次查看
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.

标签 (1)
标记 (1)
0 项奖励
3 回复数

183 次查看
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 项奖励

50 次查看
jmorel
Contributor II

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.

0 项奖励

40 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @jmorel 

Any where? We can not  place the data into memory that code used. 

I suggest you check the size of your image, then reserve the data after image.

 

BR

Alice

0 项奖励