Skip to main content
PKola.1
Associate II
January 17, 2024
Solved

STM32CubeProgrammer failed to download .hex after update to new version

  • January 17, 2024
  • 5 replies
  • 5281 views

Hello, 

i use STM32CubeProgrammer for flashing devices with .hex files, but after the update from version v2.11.0 to latest v2.15.0 the downloading doesn't work (it also doesn't work with 2.14.0). The .bin download works fine in both versions.  

The MCU that I use is STM32G483.

The message from log is:

12:02:17:022 : erasing sector 0027 @: 0x0800d800 done
12:02:17:022 : sending a page erase request @: 0x0800e000
12:02:17:039 : erasing sector 0028 @: 0x0800e000 done
12:02:17:039 : erase: 0675ms
12:02:17:039 : Erasing Segment <1> Address <0x0801DFE0> Size <2>Bytes
12:02:17:039 : Erasing memory corresponding to segment 1:
12:02:17:039 : Error: Sector size: 0x00000002 Bytes is out of range
12:02:17:070 : Error: failed to erase memory


The problem is with two last bytes in the hex file (these bytes store the firmware version). If they are at the end of the memory (and a different flash sector than previous bytes) the downloading fails in new version of Programmer. 

bad hex.PNG

If the bytes are immediately after flash region (and in the same flash sector) it works in new version of Programmer. 

hex ok.PNG


My question is if this is a problem with new version of CubeProgrammer or if there is mistake in my code and old CubeProgrammer ignore it.

There is also my memory definition from linker script for .hex that doesn't work with new programmer:

MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 128K - 8K - 16
VERSION (r) : ORIGIN = 0x0801dfe0, LENGTH = 16 /* Reserved section for firmware version */
ROM (rwx) : ORIGIN = 0x0801e000, LENGTH = 8K /* Reserved for eeprom emulation */
}

Thanks

This topic has been closed for replies.
Best answer by PKola.1

The issue has been resolved in Cube Programmer version 2.16.0. The download works correctly now.

Petr

5 replies

heveskar
Senior
January 22, 2024

@KDJEM.1 @Semer CHERNI or some other ST employee, can you please look into that? We think this might be a bug in the programmer, as in the older version loading worked correctly, whereas now it does not.

To reiterate, the problem is that when there are non-zero bytes at the end of the binary, and those are the only bytes in the last sector, programmer does not write the binary correctly.

Aziz BRIGUI
Technical Moderator
January 26, 2024

Hello PKola.1,

 

Could you please share the hex file you're testing as well as a verbosity 3 log file in the failing case.

 

Thanks in advance,

Aziz

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
PKola.1
PKola.1Author
Associate II
January 26, 2024

Hello, 

here it is hex https://pastebin.com/7PaxMaZT 

Thanks, 

Petr

PS must send the hex through pastebin because: 

  • The attachment's bad hex.hex content type (application/octet-stream) does not match its file extension and has been removed.


Aziz BRIGUI
Technical Moderator
January 26, 2024

Hello @PKola.1

 

For some reason I'm not able to open the link you sent, could you try zipping the file and attaching it ?

Or just change the extension to ".txt".

 

Thanks,

Aziz

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Tesla DeLorean
Guru
January 26, 2024

Need to write more than 2-bytes, depending on the ST model multiples 4 or 8-bytes need to be written at similarly aligned addresses.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
heveskar
Senior
January 26, 2024

Writing 4 or 8 bytes did not help. And shouldn't the programmer handle this correctly?

PKola.1
PKola.1Author
Associate II
March 18, 2024

Hello, @Aziz BRIGUI

do you have any updates on this?

Thanks, 

Petr
 

PKola.1
PKola.1AuthorBest answer
Associate II
March 28, 2024

The issue has been resolved in Cube Programmer version 2.16.0. The download works correctly now.

Petr