cancel
Showing results for 
Search instead for 
Did you mean: 

Can the Secure flash area of stm32h523cct6 be extended to the Non-secure flash area for code burning?

XiaoenLee
Associate III

   Although I have expanded an external flash storage for pictures and fonts.Due to the fact that touchgfx generates a large amount of code, the stm32h523cct6 flash is insufficient.

   So can I use the address for 0xc000000 flash and address for 0x8000000 flash?I attempted to burn the program separately into these two flash areas. The burning was successful, but the program was not running normally. Do I need to modify or add other configurations? Or is this operation of mine illegal?

13 REPLIES 13
GaetanGodart
ST Employee

Hello @XiaoenLee ,

 

The secure and non-secure flash are basically the same. If you don't care about attacks / competitors stealing your code, then you can safely use the non-secure flash.
To do so, you will have to modify the linker script.

For instance, this could be the old linker script :

MEMORY
{
  FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K
  RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
}

SECTIONS
{
  .text : { *(.text) } > FLASH
  .data : { *(.data) } > RAM
  .bss : { *(.bss) } > RAM
}

 And you can change it into this :

MEMORY
{
  SECURE_FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K
  NON_SECURE_FLASH (rx) : ORIGIN = 0x0C000000, LENGTH = 512K
  RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
}

SECTIONS
{
  .secure_text : { *(.secure_text) } > SECURE_FLASH
  .non_secure_text : { *(.non_secure_text) } > NON_SECURE_FLASH
  .data : { *(.data) } > RAM
  .bss : { *(.bss) } > RAM
}

 

The sections are a bit more complex but you get the idea.

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

Is there a solution for MDK?

 

Hello @GaetanGodart  ,

 

Did you see the message I sent yesterday?Can the MDK version of the solution be provided?

MDK would need you to modify the Scatter File to describe the different memory sections / load regions.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Hollo,@Tesla DeLorean ,

 

I know this, but exactly how should it be operated?

the following code is my current the Scatter File.

LR_IROM1 0x08000000 0x00040000  {    ; load region size_region
  ER_IROM1 0x08000000 0x00040000  {  ; load address = execution address
   *.o (RESET, +First)
   *(InRoot$$Sections)
   .ANY (+RO)
   .ANY (+XO)
  }
  RW_IRAM1 0x20000000 0x00044000  {  ; RW data
   .ANY (+RW +ZI)
  }
}

LR_EROM1 0x70000000 0x00400000  {    ; load region size_region
    ER_EROM1 0x70000000 0x00400000  {  ; load address = execution address
		*.o (ExtFlashSection)
		*.o (FontFlashSection)
	}
}

 

Hello @XiaoenLee ,

 

Could you try something like that

LR_IROM1 0x08000000 0x00040000  {    ; Load region for non-secure flash (0x0800 0000 to 0x0808 0000)
  ER_IROM1 0x08000000 0x00040000  {  ; Execution region for non-secure flash
    *.o (RESET, +First)
    *(InRoot$$Sections)
    .ANY (+RO)
    .ANY (+XO)
  }
}

LR_IROM2 0x0C000000 0x00040000  {    ; Load region for secure flash (0x0C00 0000 to 0x0C08 0000)
  ER_IROM2 0x0C000000 0x00040000  {  ; Execution region for secure flash
    *.o (SecureFlashSection)  ; 
  }
}

RW_IRAM1 0x20000000 0x00044000  {  ; RW data
  .ANY (+RW +ZI)
}

LR_EROM1 0x70000000 0x00400000  {    ; External Flash region
    ER_EROM1 0x70000000 0x00400000  {  ; Execution address for external flash
        *.o (ExtFlashSection)
        *.o (FontFlashSection)
    }
}

In LR_IROM2, you will have to add the sections you want to put in.

 

Regards,

Hollo,@GGODA.

 

 It didn't work.I want to run the program in the secure flash area so that both of these flash areas can run the program. This operation alone can only store some image libraries and font libraries.


I want to run the program in the secure flash area

Then just mention the start address of the secure flash and it would be fine?

 

so that both of these flash areas can run the program

Do you want to have the same code in both the flashes and to be able to start your program with the non secure flash and then switch to the secure flash at runtime?

 

Regards,

For example, I want to place the touchgfx_core_wchar16.lib generated by touchgfx in the "The address for 0xc000000 flash", and other programs in the "the address for 0x8000000 flash" execution.