Closed theNth closed 5 years ago
The corresponding pull request may be found here: https://github.com/gnu-mcu-eclipse/openocd/pull/43
Thank you for your elaborate bug report and fix, but please address them upstream, this project only repacks the original sources, without adding functional changes.
Description
OpenOCD successfully flashes STM32H743xx rev Y silicon, but fails to flash STM32H743xx rev V silicon. From the command line, running:
./src/openocd -s ./tcl -f ./tcl/board/st_nucleo_h743zi.cfg -c "program /path/to/file.elf verify reset exit"
produces the following output when trying to program an STM32H743VIT6-V on a custom PCBA:Trying to flash an STM32H743ZIT6U-V on a NUCLEO-H743ZI2 dev board produces similar results. However, flashing an STM32H743ZIT6-Y on a NUCLEO-H743ZI succeeds.
Steps to Reproduce
Expected behaviour: The binary should be successfully flashed onto the H7 with the following output:
Actual behaviour: Flashing fails with the following output:
Versions
Fix
The problem appears to be a consequence of the
stm32x_write
function insrc/flash/nor/stm32h7x.c
not setting the PGx bit in the bank x flash control register prior to callingstm32x_write_block
. Inserting a call totarget_write_u32
anywhere beforetarget_run_flash_async_algorithm
to set PGx appears to fix the problem. Based of the existing code structure, this call should be made immediately prior to callingstm32x_write_block
. See https://github.com/theNth/openocd/commit/972e7cd8c81fe501e3642bae8f0811ddb34d0686 for a proposed patch.