Actually, a blind workaround for the issue is simple:
if len(<binary>)%16 <= 8
then pad 8 bytes to the end of the binary
Full --debug printout is about 35Mb, if it is needed - just tell me the best way to share them (failed and successful ones)
$ sudo st-flash --debug --reset --freq=1000k --flash=0x200000 --serial 003000215553500920393256 write BG_BOOT_APP_combine.bin 0x8000000
st-flash 1.7.0-261-g1745bf5-dirty
2023-04-14T16:36:49 DEBUG common.c: *** looking up stlink version ***
2023-04-14T16:36:49 DEBUG common.c: st vid = 0x0483 (expect 0x0483)
2023-04-14T16:36:49 DEBUG common.c: stlink pid = 0x374f
2023-04-14T16:36:49 DEBUG common.c: stlink version = 0x3
2023-04-14T16:36:49 DEBUG common.c: jtag version = 0xc
2023-04-14T16:36:49 DEBUG common.c: swim version = 0x1
2023-04-14T16:36:49 DEBUG common.c: stlink current mode: mass
2023-04-14T16:36:49 DEBUG usb.c: JTAG/SWD freq set to 1000
2023-04-14T16:36:49 DEBUG common.c: stlink current mode: mass
2023-04-14T16:36:49 DEBUG common.c: *** stlink_enter_swd_mode ***
2023-04-14T16:36:49 DEBUG common.c: Loading device parameters....
2023-04-14T16:36:49 DEBUG common.c: *** stlink_core_id ***
2023-04-14T16:36:49 DEBUG common.c: core_id = 0x0be12477
2023-04-14T16:36:49 DEBUG read_write.c: *** stlink_read_debug32 0x410fd214 at 0xe000ed00
2023-04-14T16:36:49 DEBUG read_write.c: *** stlink_read_debug32 0x20016482 at 0xe0044000
2023-04-14T16:36:49 DEBUG chipid.c: detected chip_id parameters
2023-04-14T16:36:49 DEBUG chipid.c: # Device Type: STM32U5x5
2023-04-14T16:36:49 DEBUG chipid.c: # Reference Manual: RM0456
2023-04-14T16:36:49 DEBUG chipid.c: #
2023-04-14T16:36:49 DEBUG chipid.c: chip_id 0x482
2023-04-14T16:36:49 DEBUG chipid.c: flash_type 10
2023-04-14T16:36:49 DEBUG chipid.c: flash_size_reg 0xbfa07a0
2023-04-14T16:36:49 DEBUG chipid.c: flash_pagesize 0x2000
2023-04-14T16:36:49 DEBUG chipid.c: sram_size 0xc4800
2023-04-14T16:36:49 DEBUG chipid.c: bootrom_base 0xbf90000
2023-04-14T16:36:49 DEBUG chipid.c: bootrom_size 0x10000
2023-04-14T16:36:49 DEBUG chipid.c: option_base 0x0
2023-04-14T16:36:49 DEBUG chipid.c: option_size 0x0
2023-04-14T16:36:49 DEBUG chipid.c: flags 0
Binary to flash:
file BG_BOOT_APP_combine.bin md5 checksum: bead0c587f679d90a363624eb7f620, stlink checksum: 0x05554e18
2023-04-14T16:36:49 INFO common_flash.c: Attempting to write 744072 (0xb5a88) bytes to stm32 address: 134217728 (0x8000000)
This error message appears time to time, but seems is not important2023-04-14T16:36:49 DEBUG usb.c: READDEBUGREG error (0x18)
Last bytes of the binary are flashed, and seems confirmed as successful
2023-04-14T16:38:05 DEBUG read_write.c: *** stlink_write_debug32 0000000000 to 0x080b5a80
2023-04-14T16:38:05 DEBUG read_write.c: *** stlink_read_debug32 0x00020000 at 0x40022020
2023-04-14T16:38:05 DEBUG read_write.c: *** stlink_write_debug32 0x77777777 to 0x080b5a84
2023-04-14T16:38:05 DEBUG read_write.c: *** stlink_read_debug32 0x00020000 at 0x40022020
However during verification these last bytes are not found in the memory.
(This fact also checked and confirmed using official STM flasher)
(I have edited a little the code of debug printout, so do not be surprised)
2023-04-14T16:38:12 DEBUG read_write.c: *** stlink_read_mem32 ***
2023-04-14T16:38:12 DEBUG common.c: data_len = 648 0x288
a0 27 00 20 a8 27 00 20 a8 27 00 20 b0 27 00 20
b0 27 00 20 b8 27 00 20 b8 27 00 20 c0 27 00 20
c0 27 00 20 c8 27 00 20 c8 27 00 20 d0 27 00 20
d0 27 00 20 d8 27 00 20 d8 27 00 20 e0 27 00 20
e0 27 00 20 e8 27 00 20 e8 27 00 20 f0 27 00 20
f0 27 00 20 f8 27 00 20 f8 27 00 20 00 28 00 20
00 28 00 20 08 28 00 20 08 28 00 20 10 28 00 20
10 28 00 20 18 28 00 20 18 28 00 20 20 28 00 20
20 28 00 20 28 28 00 20 28 28 00 20 30 28 00 20
30 28 00 20 38 28 00 20 38 28 00 20 40 28 00 20
40 28 00 20 ff ff ff ff 00 00 02 00 27 2d 0b 08
27 2d 0b 08 88 e9 0a 20 00 00 00 00 01 00 00 00
00 00 00 00 4a 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 4a 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 ff 00 00 00 43 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 43 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 43 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 43 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 43 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 43 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 43 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 73 c3 08 08 d1 9c 08 08
00 00 00 00 8c 21 0b 08 4e f2 09 08 4c 03 09 08
4c 03 09 08 4c 03 09 08 4c 03 09 08 4c 03 09 08
4c 03 09 08 4c 03 09 08 4c 03 09 08 4c 03 09 08
ff ff ff ff ff ff ff ff ff ff ff ff ff ff 00 00
01 00 41 53 43 49 49 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 41 53 43 49 49 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ff ff ff ff ff ff ff ff
2023-04-14T16:38:12 ERROR common_flash.c: Verification of flash failed at offset: 743424 (0xb5800)
2023-04-14T16:38:12 ERROR common_flash.c: cmp_size: 648 (0x288) aligned_size 648 (0x288)
<the block printed until first difference>
a0 27 00 20 a8 27 00 20 a8 27 00 20 b0 27 00 20
b0 27 00 20 b8 27 00 20 b8 27 00 20 c0 27 00 20
c0 27 00 20 c8 27 00 20 c8 27 00 20 d0 27 00 20
d0 27 00 20 d8 27 00 20 d8 27 00 20 e0 27 00 20
e0 27 00 20 e8 27 00 20 e8 27 00 20 f0 27 00 20
f0 27 00 20 f8 27 00 20 f8 27 00 20 00 28 00 20
00 28 00 20 08 28 00 20 08 28 00 20 10 28 00 20
10 28 00 20 18 28 00 20 18 28 00 20 20 28 00 20
20 28 00 20 28 28 00 20 28 28 00 20 30 28 00 20
30 28 00 20 38 28 00 20 38 28 00 20 40 28 00 20
40 28 00 20 ff ff ff ff 00 00 02 00 27 2d 0b 08
27 2d 0b 08 88 e9 0a 20 00 00 00 00 01 00 00 00
00 00 00 00 4a 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 4a 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 ff 00 00 00 43 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 43 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 43 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 43 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 43 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 43 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 43 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 73 c3 08 08 d1 9c 08 08
00 00 00 00 8c 21 0b 08 4e f2 09 08 4c 03 09 08
4c 03 09 08 4c 03 09 08 4c 03 09 08 4c 03 09 08
4c 03 09 08 4c 03 09 08 4c 03 09 08 4c 03 09 08
ff ff ff ff ff ff ff ff ff ff ff ff ff ff 00 00
01 00 41 53 43 49 49 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 41 53 43 49 49 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
diff at 0x280: read: ff expected: 00
You can see, that last 8 bytes are 8FF instead of 400 and 4*77
FF - these were written during erase step and were not replaced during binary flash.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4