Skip to main content
Vmere.1
Associate III
May 21, 2022
Solved

How to erase specific sectors on STM32CUBE IDE? [ Solved ]

  • May 21, 2022
  • 2 replies
  • 3436 views

Problem:

I am trying to create a bootloader and a user application to do my Over the air project. So for custom bootloader I had selected sector 0 and sector 1 of flash memory. (Address starts at 0x08000000) and from sector 2 I want my user application. So I created both of them and when flashing bootloader I don't have any problem with cubeIDE. Now when I flash application on sector 2, the earlier bootloader section 0 is getting erased. How can I prevent from happening in cubeIDE. If I use cube programmer I have control over the options, but how can I do that with STM32 Cube Ide?

-------------------------------------------------------------------------------------------------------------------------------

Details:

I use STM32CubeIDE

Version: 1.6.0

Build: 9614_20210223_1703 (UTC)

Hardware: Nucleo-F411re

This topic has been closed for replies.
Best answer by JMala.3

By default, only used sectors are erased. Sounds like your application is still using sector 0, most likely the vector table is still located there. Did you edit the app linker script to specify the app flash range?

2 replies

JMala.3
JMala.3Answer
Associate III
May 21, 2022

By default, only used sectors are erased. Sounds like your application is still using sector 0, most likely the vector table is still located there. Did you edit the app linker script to specify the app flash range?

Vmere.1
Vmere.1Author
Associate III
May 22, 2022

My bootloader memory location:/* Memories definition */

MEMORY

{

 RAM  (xrw)  : ORIGIN = 0x20000000,  LENGTH = 128K

 FLASH  (rx)  : ORIGIN = 0x8000000,  LENGTH = 512K

}

And my application memory location

MEMORY

{

 RAM  (xrw)  : ORIGIN = 0x20000000,  LENGTH = 128K

 FLASH  (rx)  : ORIGIN = 0x08008000,  LENGTH = 512K

}

Should I change the length or something?

Piranha
Principal III
May 22, 2022

You should set the LENGTH to 32K and 512K-32K respectively, but that should not be the problem here.

Try updating CubeIDE to the newest version.

Vmere.1
Vmere.1Author
Associate III
May 22, 2022

True. It's not a problem, but I will change.​