It looks like commit 5cb2a94b simplified / removed support for erasing bank 2 on these specific parts.
I have noticed this by getting the error Error writing data to flash for firmwares that cross the 0x08040000
bank boundary. Images that fit entirely within bank 1 (< 256 KiB) flash fine.
Reproduction
- Target: STM32G0B1RET6 (Cortex-M0+, 512 KiB Flash, dual bank).
- Build any image whose
.text/.rodata extends past 0x08040000.
$ arm-none-eabi-gdb -nx --batch \
-ex 'target extended-remote /dev/ttyBmpGdb' \
-ex 'monitor swdp_scan' -ex 'attach 1' -ex 'load' firmware.elf
...
1 STM32G0B/C M0+
Loading section .vector_table, size 0xbc lma 0x8000000
Loading section .metadata, size 0x10 lma 0x8000200
Loading section .text, size 0x42eac lma 0x8000210
Error writing data to flash
The same ELF flashes successfully with old 1.7 firmware, and with the latest 2.3 hardware running 2.0.0 firmware if the chip is mass-erased first (monitor erase_mass).
Workaround
Explicitly erase the device via 'monitor erase_mass' before loading
Affected devices
I've noticed this on the STM32G0B1RET6 (Cortex-M0+, 512 KiB Flash), there may be other device families/variants with the same issue
It looks like commit 5cb2a94b simplified / removed support for erasing bank 2 on these specific parts.
I have noticed this by getting the error _Error writing data to flash_ for firmwares that cross the `0x08040000`
bank boundary. Images that fit entirely within bank 1 (< 256 KiB) flash fine.
## Reproduction
- Target: STM32G0B1RET6 (Cortex-M0+, 512 KiB Flash, dual bank).
- Build any image whose `.text`/`.rodata` extends past `0x08040000`.
```
$ arm-none-eabi-gdb -nx --batch \
-ex 'target extended-remote /dev/ttyBmpGdb' \
-ex 'monitor swdp_scan' -ex 'attach 1' -ex 'load' firmware.elf
...
1 STM32G0B/C M0+
Loading section .vector_table, size 0xbc lma 0x8000000
Loading section .metadata, size 0x10 lma 0x8000200
Loading section .text, size 0x42eac lma 0x8000210
Error writing data to flash
```
The same ELF flashes successfully with old 1.7 firmware, and with the latest 2.3 hardware running 2.0.0 firmware if the chip is mass-erased first (`monitor erase_mass`).
## Workaround
Explicitly erase the device via 'monitor erase_mass' before loading
## Affected devices
I've noticed this on the STM32G0B1RET6 (Cortex-M0+, 512 KiB Flash), there may be other device families/variants with the same issue