Skip to main content
Associate
September 26, 2024
Solved

Creating non-eraseble Flash Memory Space

  • September 26, 2024
  • 3 replies
  • 1031 views

Hello, i am using STM32H723 Microcontroller. I need to create a region in the memory(preferably whole sector 7) that is not erasable during debugging process. To do this i made the following changes in the linker script:

MEMORY
{
 ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K
 DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
 FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 896K
 USER_DAT (r) : ORIGIN = 0x080E0000, LENGTH = 128K
 RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 320K
 RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 32K
 RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 16K
}

SECTIONS
{
untouched areas
.
.
 .user_data(NOLOAD) :
 {
 . = ALIGN(4);
 KEEP(*(.user_data))
 } > USER_DAT

And i am trying to write to this memory space with HAL_FLASH Functions. But when i debug, my datas are erased. How can i do this?

This topic has been closed for replies.

3 replies

mƎALLEm
ST Technical Moderator
September 26, 2024

Hello,

I think you can keep that region (User_DAT) undeclared in the linker.

USER_DAT (r) : ORIGIN = 0x080E0000, LENGTH = 128K

 

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
mazotcu16Author
Associate
September 26, 2024

Hello, Thank you for your answer.
I tried it and it is erased again.

Andrew Neil
Andrew NeilBest answer
Super User
September 26, 2024
A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.