stm32duino/Arduino_Tools

[STM32CubeProg.sh] mass erase bug

olikraus opened this issue · 1 comments

Followup for stm32duino/Arduino_Core_STM32#1637

Problem:
Some devices (at least the STM32G031J6) require a full mass erase for proper uploads.
However the mass erase is not executed due to a problem in STM32CubeProg.sh

Fix:
The mass erase is already foreseen here:

${STM32CP_CLI} -c port=${PORT} ${MODE} ${ERASE:+"-e all"} -q -d "${FILEPATH}" ${ADDRESS} "${OPTS}"

However, the sh syntax is not correct. In order to apply "-e all" in case of an empty "ERASE" variable, the "-" sign must be used:

${STM32CP_CLI} -c port=${PORT} ${MODE} ${ERASE:-"-e all"} -q -d "${FILEPATH}" ${ADDRESS} "${OPTS}"

Already answer in stm32duino/Arduino_Core_STM32#1637

@olikraus please avoid to open several issues while we investigate the first one.