Stm32f4discovery - OpenOCD - telnet boot program


I have a problem loading a demo program on a new stm32f4discovery panel, here is what I am doing:

  • Connect the board to the computer.
  • openocd -f board / stm32f4discovery.cfg
  • telnet localhost 4444

    Open On-Chip Debugger > reset init target state: halted target halted due to debug-request, current mode: Thread xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc > flash write_image demo.hex device id = 0x10016413 flash size = 8192kbytes flash write algorithm aborted by target error executing stm32x flash write algorithm flash memory write protected flash write failed = 00000010 error writing to flash at address 0x08000000 at offset 0x00000000 in procedure 'flash' 

    What am I doing wrong? I tried flash protection, stm32f2x unlock, but the answer is the same: "Flash protection is protected", did I miss something? I am using a precompiled demo program from st.com from the package "STM32F4-Discovery_FW_V1.1.0" from "Project / Demonstration / Binary".

+4
source share
1 answer

Flash memory must be deleted before overwriting it.

 monitor flash protect 0 0 11 off monitor flash erase_address 0x08000000 0x40000 monitor flash write_image erase *"/path/to/hex/file.hex"* 0 ihex 

Or, instead of telnet and hex files, use arm-none-eabi-gdb and ELF with the following commands:

 arm-none-eabi-gdb target remote localhost:3333 monitor reset halt file */path/to/elf/file.elf* load monitor reset continue 

Please note that when using ELF files, you do not need to specify the address where it will be (usually 0x08000000 or 0x08008000 with bootloaders).

Also consider using a loader such as OpenBLT , this will help you master principles such as VTOR, offsets, stack addresses, etc.

+3
source

Source: https://habr.com/ru/post/1485220/


All Articles