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.
