Skip to main content
Associate III
Nov 17, 2026 11:28 AM UTC
Question

STM32U575 SectorErase /MassErase don't work with CLI External Loader

Hello, I am using a custom STM32CubeProgrammer external loader for an AT25SF641B 8 MB SPI NOR Flash connected to an STM32U575.

  • Start address: 0x00000000
  • Total size: 0x00800000
  • Page size: 0x100
  • Sector size: 0x1000
  • Number of sectors: 0x800, or 2048 sectors

Read and write operations work correctly from the STM32CubeProgrammer CLI using the .stldr file.

However, this external flash sector erase command does not work:

STM32_Programmer_CLI.exe -c port=SWD mode=UR reset=HWrst -el AT25SF641B_STM32U575.stldr -e [704 735] -vb 3

The result is:

Erase sector(s) …

Error: sector 704 does not exist

Error: Sector erase operation failed at least for one of the existing specified sectors

Sector 704 is valid according to the external loader geometry:

0x002C0000 / 0x1000 = 704

If I use:

-e 4

the command succeeds, but it erases sector 4 of the STM32U575 internal flash. The external loader SectorErase() function is not called.

Similarly:

-e all

targets the internal MCU flash instead of calling the external loader MassErase() function.

The relevant StorageInfo entry is:

{

    { 0x00000800, 0x00001000 },

    { 0x00000000, 0x00000000 }

}

The target is an STM32U575, Device ID 0x482, Revision U, connected using an ST-LINK V2 with firmware V2J48S7.

Is there a CLI option to explicitly apply -e to the memory declared by the external loader?

How can I invoke the external loader SectorErase() and MassErase() functions from STM32CubeProgrammer CLI without erasing the STM32U575 internal flash?

Thank you.

4 replies

Shirley.Ye
ST Employee
Nov 17, 2026 11:44 AM UTC

In your case, the external flash starts at 0x00000000, which overlaps the STM32U575 internal flash address range, so it can erase internal flash

pa0grgAuthor
Associate III
Nov 17, 2026 1:42 PM UTC

How can I solve that?

mƎALLEm
ST Technical Moderator
Nov 17, 2026 1:56 PM UTC

Hello ​@pa0grg ,

Your question was not posted in the correct forum board: STM32 MCU products. I moved it to STM32CubeProgrammer  forum board.

Good luck.

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
pa0grgAuthor
Associate III
Nov 18, 2026 11:51 AM UTC

Ok, thanks. If anyone has any Idea, please let me know. Would be so useful to use CLI.