Skip to main content
Graduate
September 26, 2024
Solved

Creating non-eraseble Flash Memory Space

  • September 26, 2024
  • 3 replies
  • 991 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

    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

     

    mazotcu16Author
    Graduate
    September 26, 2024

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

    Super User
    September 26, 2024