Skip to main content
KnarfB
Super User
February 16, 2020
Solved

[BUG] STM32CubeProgrammer "Error: Download verification failed" only for some specific file size.

  • February 16, 2020
  • 3 replies
  • 2719 views

Tools used:

STM32CubeProgrammer 2.3.0.

STM32CubeIDE 1.2.1 for code generation

(gnu-arm-embedded.7-2018-q2-update.win32_1.0.0.201904081647)

I generate some simple STM32CubeIDE C project with default settings.

Build completes, but debugging throws an error during the program+verification phase with "Error: Data mismatch found at address 0x08003001 (byte = 0x18 instead of 0x00)".

Log file attached.

Same when running STM32CubeProgrammer stand-alone.

The two screen shots show the difference between .elf and flash mem at 0x08003000:

0690X00000DBQg7QAH.png

0690X00000DBQg2QAH.png

The device was completely erased beforehand.

A generated .bin file also shows 00 00 00 00 00 00 00 00 at offset 0x3000.

When I add some dummy code, the file size increases and verification passes and debugging runs without errors as expected.

This topic has been closed for replies.
Best answer by berendi

I've had the same problem, worked around it by changing ALIGN(4) to ALIGN(16) at a few places in the linker script.

https://community.st.com/s/question/0D50X0000BcRdMKSQ0/flashing-stm32f0-fails-in-cubeide-when-the-firmware-has-a-certain-length-0x1c04-or-0x1c08-bytes

3 replies

berendi
berendiBest answer
Principal
February 17, 2020

I've had the same problem, worked around it by changing ALIGN(4) to ALIGN(16) at a few places in the linker script.

https://community.st.com/s/question/0D50X0000BcRdMKSQ0/flashing-stm32f0-fails-in-cubeide-when-the-firmware-has-a-certain-length-0x1c04-or-0x1c08-bytes

KnarfB
KnarfBAuthor
Super User
February 17, 2020

Thanks, berendi.

waclawek.jan
Super User
February 17, 2020

It's good to have a workaround, thanks, berendi.

But it's still a bug, or not?

JW

berendi
Principal
February 18, 2020

Of course it's still a bug in STM32CubeProgrammer. ST-Link Utility can write a .hex file having the same length and contents without problems.

Apparently STM32CubeProgrammer fails on the STM32F0 series when it tries to write 4 or 8 bytes into a flash page.