cancel
Showing results for 
Search instead for 
Did you mean: 

Creating non-eraseble Flash Memory Space

mazotcu16
Associate II

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?

1 ACCEPTED SOLUTION
3 REPLIES 3
SofLit
ST Employee

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 on "Accept as Solution" on the reply which solved your issue or answered your question.
mazotcu16
Associate II

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