Stm32f4discovery-OpenOCD-telnet上传演示程序

Stm32f4discovery-OpenOCD-telnet上传演示程序,stm32,openocd,stm32f4discovery,Stm32,Openocd,Stm32f4discovery,我在尝试将演示程序上传到fresh stm32f4discovery board时遇到问题,这就是我正在做的: 将电路板连接到计算机 openocd-f board/stm32f4discovery.cfg telnet本地主机4444 Open On-Chip Debugger > reset init target state: halted target halted due to debug-request, current mode: Thread xPSR: 0x010000


我在尝试将演示程序上传到fresh stm32f4discovery board时遇到问题,这就是我正在做的:

  • 将电路板连接到计算机
  • openocd-f board/stm32f4discovery.cfg
  • telnet本地主机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'
    
    我做错了什么?我尝试过闪存保护,stm32f2x解锁,但响应仍然是一样的:“闪存写保护”,我错过了什么?我使用的是来自st.com的预编译演示程序,来自“Project/display/Binary”中的“STM32F4-Discovery_FW_V1.1.0”包


  • 在重写闪存之前,必须将其删除

    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
    
    或者使用arm none eabi gdb和ELF,而不是telnet和hex文件,并使用以下命令:

    arm-none-eabi-gdb
    target remote localhost:3333
    monitor reset halt
    file */path/to/elf/file.elf*
    load
    monitor reset
    continue
    
    请注意,在使用ELF文件时,不需要指定其所在的地址(通常为0x08000000或0x0800800,使用引导加载程序)


    也可以考虑使用Bootloader,它将帮助您掌握VoTor、偏移量、堆栈地址等的原理,

    使用OpenOCD的哪种版本?您使用哪个JTAG接口,ST链路?