Skip to main content
Associate III
June 30, 2026
Question

--incremental uses a 32-bit additive byte-sum, not a CRC — sum-preserving content changes are silently skipped

  • June 30, 2026
  • 1 reply
  • 37 views

--incremental uses a 32-bit additive byte-sum, not a CRC — sum-preserving content changes are silently skipped

Product: STM32CubeProgrammer 2.22.0 (Linux x86-64) Interface: SWD / STLINK-V3 Target: STM32F427 (DEV_ID 0x419)

Description

The --incremental download mode decides whether to skip a flash sector by comparing a 32-bit additive byte-sum of the sector's current chip content against the same sum of the new image.

The on-target .stldr CheckSum export (@ 0x200001e9, verified in two loader binaries) uses additive accumulation.

Because addition is commutative and linear, any two images whose bytes differ only in ways that cancel (adjacent-byte swap, +1/−1 pair, any permutation within a sector) produce identical sums. Those sectors are silently skipped — old bytes remain on chip and the tool reports success.

Reproduction

Test images A and B (64 KB, four 16 KB sectors) are constructed so that:

  • Sector 1: bytes at offsets 0x4100/0x4101 are 0x11,0x22 in A and 0x22,0x11 in B — an adjacent swap. Additive sum of the full 16 KB sector is identical in both.
  • Sector 2: byte at offset 0x8100 is 0x00 in A and 0xFF in B — single-byte flip. Sum differs; this is the control.

Steps:

  1. Write image A to the device using st-flash (open-source, independent of ST software).
  2. Run STM32_Programmer_CLI -c port=SWD sn=<SN> freq=8000 mode=UR -d B.bin 0x08000000 incremental
  3. Read back with st-flash.

Result: sector 1 reads back as A (swap silently dropped); sector 2 reads back as B (control correctly written). CubeProgrammer reported success throughout.

Control: repeat with the same B without incremental — sector 1 is written correctly. The skip is incremental-mode-specific.

All setup and read-back uses st-flash, not CubeProgrammer, so the result is not self-certified by the tool under test.

Also noted during day to day programming. In all of the other options CRC-32 is used. 

 

 

1 reply

ST Employee
July 3, 2026

Hello ​@codebuk ,
Thank you for your detailed report and reproduction steps.
I was able to consistently reproduce this behavior with the same setup/pattern. However, this is a highly specific scenario and extremely unlikely to happen in most cases.
Incremental programming is intended as an optimization to reduce programming time by avoiding sectors that appear unchanged. With that being said, I understand the concern regarding the silent failure mode in this particular case.

I will raise this with our development team, and I’ll let you know if there is any update on this matter. (Internal ticket number: CDM0064068)

PS: Ticket ID: CDM0064068 is an internal tracking number and is not accessible or usable by customers.

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.