cancel
Showing results for 
Search instead for 
Did you mean: 

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

Vmere.1
Senior

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

1 ACCEPTED SOLUTION

Accepted Solutions
JMala.3
Associate III

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?

View solution in original post

4 REPLIES 4
JMala.3
Associate III

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
Senior

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?

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.

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