Ignoring unsupported commands
Open source flash program for STM32 using the ST serial bootloader
Brought to you by:
tormod
Trying to program GD32E230 MCU.
stm32flash fails with error: "Got NACK from device on command 0x01".
stm32loader detects and programs successfully.
Looking at the list of available commands, 01 command not supported:
"0x0, 0x2, 0x11, 0x21, 0x31, 0x43, 0x63, 0x73, 0x82, 0x92, 0x6"
Is it possible to ignore unsupported commands and proceed further ?
Anonymous
Do you have a reference to documentation on this bootloader? Is this via UART or I2C?
stm32flash has always read the version and read protection status (STM32_CMD_GVR = 0x01) before getting the list of supported commands (STM32_CMD_GET), but it could be possible for instance to let it continue if the first command fails and the second command confirms that the first is not supported. But then someone must submit a patch or provide more information and testing on this device.
This is UART, can't find any info in datasheet/user manual/appnotes, seems like there's no official open documentation for protocol.
Tried to skip STM32_CMD_GVR check in stm32.c, lines 433-434, but it fails further with messages: "Failed to read ACK byte", "GET returns unknown commands (0x 6)", "Error: bootloader did not returned correct information from GET command"
Maybe its better to query first for available commands, and skip those not supported ?
Last edit: uzver123 2023-04-09
If you want to try skipping the STM32_CMD_GVR check you will need to skip the lines down to 457 (before the "get the bootloader information" comment) because those lines deal with the answer to that request.
Yes, it sounds more logical to first query for available commands, but the existing order came about because of issues reading the available commands (see commit a0cf1bad).
works after commenting lines 432-455 and 528