You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running the CMD_CLEAR_FLASH command from the host I2C bridge protocol
(used by both steamicc/arduino-steami-lib and steamicc/micropython-steami-lib via their respective daplink_flash
drivers) puts the STeaMi's on-board STM32F103 into DAPLink maintenance
mode. After the command lands, the board no longer enumerates as a
normal CMSIS-DAP + mass-storage device — the interface firmware has
to be re-flashed by drag-dropping the firmware binary onto the
maintenance mass-storage volume.
Reproduction
From a clean Arduino sketch on a STeaMi with DaplinkBridge + DaplinkFlash from steamicc/arduino-steami-lib:
DaplinkBridge bridge(internalI2C);
DaplinkFlash flash(bridge);
flash.begin();
flash.clearFlash(); // ← chip reboots into maintenance mode here
Equivalent reproduction from the integration suite in steamicc/arduino-steami-lib PR ARMmbed#167 (since reverted exactly because
of this bug):
make test-integration # against integration/test_daplink_flash
Expected behaviour
CMD_CLEAR_FLASH should clear only the user-data partition (where
filenames and file content live), and leave the interface firmware
sectors and the bootloader untouched. The driver advertises this as a
user-data wipe — the contract should hold.
Observed behaviour
The whole F103 internal flash (or at least the interface-firmware
section) is erased. On the next reset / reboot the STM32 falls back
to its hardware DFU bootloader and re-enumerates as maintenance.
Suggested fix
Audit the sector-erase loop that backs CMD_CLEAR_FLASH: cap the
erase range to the user-data partition only. Anything covering the
interface firmware, bootloader, or maintenance metadata should be
protected.
Summary
Running the
CMD_CLEAR_FLASHcommand from the host I2C bridge protocol(used by both
steamicc/arduino-steami-libandsteamicc/micropython-steami-libvia their respectivedaplink_flashdrivers) puts the STeaMi's on-board STM32F103 into DAPLink maintenance
mode. After the command lands, the board no longer enumerates as a
normal CMSIS-DAP + mass-storage device — the interface firmware has
to be re-flashed by drag-dropping the firmware binary onto the
maintenance mass-storage volume.
Reproduction
From a clean Arduino sketch on a STeaMi with
DaplinkBridge+DaplinkFlashfromsteamicc/arduino-steami-lib:Equivalent reproduction from the integration suite in
steamicc/arduino-steami-libPR ARMmbed#167 (since reverted exactly becauseof this bug):
Expected behaviour
CMD_CLEAR_FLASHshould clear only the user-data partition (wherefilenames and file content live), and leave the interface firmware
sectors and the bootloader untouched. The driver advertises this as a
user-data wipe — the contract should hold.
Observed behaviour
The whole F103 internal flash (or at least the interface-firmware
section) is erased. On the next reset / reboot the STM32 falls back
to its hardware DFU bootloader and re-enumerates as maintenance.
Suggested fix
Audit the sector-erase loop that backs
CMD_CLEAR_FLASH: cap theerase range to the user-data partition only. Anything covering the
interface firmware, bootloader, or maintenance metadata should be
protected.
Cross-references
7108328on branch
feat/daplink-flash-driver(will land in PR Update board_id for FRDM-KW24 ARMmbed/DAPLink#167).WSEN_HIDS-stylecross-impl confirmation issue can be filed there once this is
understood.