VsCode+OpenOCD 开发stm32系列
通常会用MDK调试stm32等arm cotex平台,但KEIL MDK很多商业公司是不能直接使用的,需要购买授权!VScode
搭配gcc-arm-none-eabi编译工具链和openocd(Open On-Chip Debugger)实现编译、下载、调试!
所需资源
- VScode
https://code.visualstudio.com/ - MinGW64
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe/download - gcc-arm-none-eabi
https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads
https://launchpad.net/gcc-arm-embedded/+download - OpenOCD-20211118-0.11.0
https://gnutoolchains.com/arm-eabi/openocd/
(最新的openocd 0.11.3可能只支持 cmsis-dapv2,v1版本好像不支持了
https://github.com/xpack-dev-tools/openocd-xpack/releases)
环境搭建
1、mingw-w64安装(mingw-w64-install.exe)
并添加环境变量:C:\Program Files\mingw-w64\i686-8.1.0-release-posix-dwarf-rt_v6-rev0\mingw32\bin
同时将 C:\Program Files\mingw-w64\i686-8.1.0-release-posix-dwarf-rt_v6-rev0\mingw32\bin\mingw32-make.exe 备份并命名为make.exe
2、arm-gcc安装(gcc-arm-none-eabi-10.3-2021.10-win32.exe)
同时添加环境变量:C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2021.10\bin
3、openocd-20211118.7z解压到指定位置
并添加环境变量:D:\work\tool\OpenOCD-20211118-0.11.0\bin
4、VScode安装,并安装插件 C/C++,Cortex-Debug
工程搭建(以stm32h7为例)
1、STM32CubeMX 生成Makefile 工程
2、VScode 打开生成的工程,shift+ctrl+p,进入c/c++配置UI,设置如下配置
3、复制openOCD配置文件到工程目录(和makefile同一路径)
以CMSIS-DAP 为例,如果用ST-link或者Jlink、ulink等,需要复制对应的cfg文件
D:\work\tool\OpenOCD-20211118-0.11.0\share\openocd\scripts\interface\cmsis-dap.cfg
D:\work\tool\OpenOCD-20211118-0.11.0\share\openocd\scripts\target\stm32h7x.cfg
4、VScode配置编译和下载任务(终端->运行任务->添加配置任务)
tasks.json
{// See https://go.microsoft.com/fwlink/?LinkId=733558// for the documentation about the tasks.json format"version": "2.0.0","tasks": [{"label": "build","type": "shell","command": "make","args": [],"group": "build"},{"label": "download","type": "shell","command": "openocd","args": ["-f","cmsis-dap.cfg","-f","stm32h7x.cfg","-c","program build/stm32h7_demo.elf verify reset exit"],"group": "build"}]
}
5、运行"build"任务
> Executing task: make <mkdir build
arm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32H743xx -ICore/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32H7xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/main.d" -Wa,-a,-ad,-alms=build/main.lst Core/Src/main.c -o build/main.o
arm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32H743xx -ICore/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32H7xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/gpio.d" -Wa,-a,-ad,-alms=build/gpio.lst Core/Src/gpio.c -o build/gpio.o
arm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32H743xx -ICore/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32H7xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/usart.d" -Wa,-a,-ad,-alms=build/usart.lst Core/Src/usart.c -o build/usart.o
arm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32H743xx -ICore/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32H7xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32h7xx_hal_rcc.d" -Wa,-a,-ad,-alms=build/stm32h7xx_hal_rcc.lst Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc.c -o build/stm32h7xx_hal_rcc.oarm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32H743xx -ICore/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32H7xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32h7xx_hal_rcc_ex.d" -Wa,-a,-ad,-alms=build/stm32h7xx_hal_rcc_ex.lst Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc_ex.c -o build/stm32h7xx_hal_rcc_ex.oarm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32H743xx -ICore/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32H7xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32h7xx_hal_flash.d" -Wa,-a,-ad,-alms=build/stm32h7xx_hal_flash.lst Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_flash.c -o build/stm32h7xx_hal_flash.oarm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32H743xx -ICore/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32H7xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32h7xx_hal_flash_ex.d" -Wa,-a,-ad,-alms=build/stm32h7xx_hal_flash_ex.lst Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_flash_ex.c -o build/stm32h7xx_hal_flash_ex.oarm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32H743xx -ICore/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32H7xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32h7xx_hal_gpio.d" -Wa,-a,-ad,-alms=build/stm32h7xx_hal_gpio.lst Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_gpio.c -o build/stm32h7xx_hal_gpio.oarm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32H743xx -ICore/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32H7xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32h7xx_hal_hsem.d" -Wa,-a,-ad,-alms=build/stm32h7xx_hal_hsem.lst Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_hsem.c -o build/stm32h7xx_hal_hsem.o
arm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32H743xx -ICore/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32H7xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32h7xx_hal_dma.d" -Wa,-a,-ad,-alms=build/stm32h7xx_hal_dma.lst Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_dma.c -o build/stm32h7xx_hal_dma.o
arm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32H743xx -ICore/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32H7xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32h7xx_hal_dma_ex.d" -Wa,-a,-ad,-alms=build/stm32h7xx_hal_dma_ex.lst Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_dma_ex.c -o build/stm32h7xx_hal_dma_ex.o
arm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32H743xx -ICore/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32H7xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32h7xx_hal_mdma.d" -Wa,-a,-ad,-alms=build/stm32h7xx_hal_mdma.lst Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_mdma.c -o build/stm32h7xx_hal_mdma.o
arm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32H743xx -ICore/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32H7xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32h7xx_hal_pwr.d" -Wa,-a,-ad,-alms=build/stm32h7xx_hal_pwr.lst Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pwr.c -o build/stm32h7xx_hal_pwr.o
arm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32H743xx -ICore/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32H7xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32h7xx_hal_pwr_ex.d" -Wa,-a,-ad,-alms=build/stm32h7xx_hal_pwr_ex.lst Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pwr_ex.c -o build/stm32h7xx_hal_pwr_ex.o
arm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32H743xx -ICore/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32H7xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32h7xx_hal.d" -Wa,-a,-ad,-alms=build/stm32h7xx_hal.lst Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal.c -o build/stm32h7xx_hal.o
arm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32H743xx -ICore/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32H7xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32h7xx_hal_i2c.d" -Wa,-a,-ad,-alms=build/stm32h7xx_hal_i2c.lst Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_i2c.c -o build/stm32h7xx_hal_i2c.o
arm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32H743xx -ICore/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32H7xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32h7xx_hal_i2c_ex.d" -Wa,-a,-ad,-alms=build/stm32h7xx_hal_i2c_ex.lst Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_i2c_ex.c -o build/stm32h7xx_hal_i2c_ex.o
arm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32H743xx -ICore/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32H7xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32h7xx_hal_exti.d" -Wa,-a,-ad,-alms=build/stm32h7xx_hal_exti.lst Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_exti.c -o build/stm32h7xx_hal_exti.o
arm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32H743xx -ICore/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32H7xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32h7xx_hal_tim.d" -Wa,-a,-ad,-alms=build/stm32h7xx_hal_tim.lst Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_tim.c -o build/stm32h7xx_hal_tim.o
arm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32H743xx -ICore/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32H7xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32h7xx_hal_tim_ex.d" -Wa,-a,-ad,-alms=build/stm32h7xx_hal_tim_ex.lst Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_tim_ex.c -o build/stm32h7xx_hal_tim_ex.o
arm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32H743xx -ICore/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32H7xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32h7xx_hal_uart.d" -Wa,-a,-ad,-alms=build/stm32h7xx_hal_uart.lst Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_uart.c -o build/stm32h7xx_hal_uart.o
arm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32H743xx -ICore/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32H7xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32h7xx_hal_uart_ex.d" -Wa,-a,-ad,-alms=build/stm32h7xx_hal_uart_ex.lst Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_uart_ex.c -o build/stm32h7xx_hal_uart_ex.o
arm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32H743xx -ICore/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32H7xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/system_stm32h7xx.d" -Wa,-a,-ad,-alms=build/system_stm32h7xx.lst Core/Src/system_stm32h7xx.c -o build/system_stm32h7xx.o
arm-none-eabi-gcc -x assembler-with-cpp -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32H743xx -ICore/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc -IDrivers/STM32H7xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32H7xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/startup_stm32h743xx.d" startup_stm32h743xx.s -o build/startup_stm32h743xx.o
arm-none-eabi-gcc build/main.o build/gpio.o build/usart.o build/stm32h7xx_it.o build/stm32h7xx_hal_msp.o build/stm32h7xx_hal_cortex.o build/stm32h7xx_hal_rcc.o build/stm32h7xx_hal_rcc_ex.o build/stm32h7xx_hal_flash.o build/stm32h7xx_hal_flash_ex.o build/stm32h7xx_hal_gpio.o build/stm32h7xx_hal_hsem.o build/stm32h7xx_hal_dma.o build/stm32h7xx_hal_dma_ex.o build/stm32h7xx_hal_mdma.o build/stm32h7xx_hal_pwr.o build/stm32h7xx_hal_pwr_ex.o build/stm32h7xx_hal.o build/stm32h7xx_hal_i2c.o build/stm32h7xx_hal_i2c_ex.o build/stm32h7xx_hal_exti.o build/stm32h7xx_hal_tim.o build/stm32h7xx_hal_tim_ex.o build/stm32h7xx_hal_uart.o build/stm32h7xx_hal_uart_ex.o build/system_stm32h7xx.o build/startup_stm32h743xx.o -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -specs=nano.specs -TSTM32H743IITx_FLASH.ld -lc -lm -lnosys -Wl,-Map=build/stm32h7_demo.map,--cref -Wl,--gc-sections -o build/stm32h7_demo.elf
arm-none-eabi-size build/stm32h7_demo.elftext data bss dec hex filename13236 24 1712 14972 3a7c build/stm32h7_demo.elf
arm-none-eabi-objcopy -O ihex build/stm32h7_demo.elf build/stm32h7_demo.hex
arm-none-eabi-objcopy -O binary -S build/stm32h7_demo.elf build/stm32h7_demo.bin 终端将被任务重用,按任意键关闭。
显示编译成功
6、运行"download"任务
> Executing task: openocd -f cmsis-dap.cfg -f stm32h7x.cfg -c 'program build/stm32h7_demo.elf verify reset exit' <Open On-Chip Debugger 0.11.0 (2021-11-18) [https://github.com/sysprogs/openocd]
Licensed under GNU GPL v2
libusb1 09e75e98b4d9ea7909e8837b7a3f00dda4589dc3
For bug reports, readhttp://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: FW Version = 1.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 0
Info : CMSIS-DAP: Interface ready
Info : clock speed 1800 kHz
Info : SWD DPIDR 0x6ba02477
Info : stm32h7x.cpu0: Cortex-M7 r1p1 processor detected
Info : stm32h7x.cpu0: target has 8 breakpoints, 4 watchpoints
Info : gdb port disabled
Info : starting gdb server for stm32h7x.cpu0 on 3333
Info : Listening on port 3333 for gdb connections
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800328c msp: 0x20020000
** Programming Started **
Info : Device: STM32H74x/75x
Info : flash size probed value 2048k
Info : STM32H7 flash has dual banks
Info : Bank (0) size is 1024 kb, base address is 0x08000000
Info : Padding image section 1 at 0x080033cc with 20 bytes (bank write end alignment)
Warn : Adding extra erase range, 0x080033e0 .. 0x0801ffff
** Programming Finished **
** Verify Started **
** Verified OK **
** Resetting Target **
shutdown command invoked终端将被任务重用,按任意键关闭。
显示下载成功
7、配置单步调试功能
左侧debug标签中,新增配置文件,会自动生成launch.json,修改launch.json内容如下:
{// 使用 IntelliSense 了解相关属性。 // 悬停以查看现有属性的描述。// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387"version": "0.2.0","configurations": [{"cwd": "${workspaceRoot}","executable": "./build/stm32h7_demo.elf","name": "Debug Microcontroller","request": "launch","type": "cortex-debug","showDevDebugOutput": false,"servertype": "openocd","configFiles": ["cmsis-dap.cfg","stm32h7x.cfg"]}]
}
8、运行调试
VsCode+OpenOCD 开发stm32系列相关推荐
- 使用STM32标准库构建VSCode+gcc+openOCD开发STM32
目前为止,使用STM32的平台比较流行的是keil for Arm和IAR for ARM,这两个平台都比较类似,集成编辑.编译和调试环境,俗称IDE.用户只需简单的操作就能编译和调试STM32,非常 ...
- Windows环境下CubeMX+VScode+Gcc+OpenOCD开发STM32环境搭建
为啥要这么麻烦嘛,这个不解释,生命在于折腾,相信很多人都在折腾,也很多人去百度过,按百度的教程估计还是有很多人不会弄,所以写这篇教程为那些还没有折腾成功的砖工提供点线索. VScode现在真的很强大, ...
- STM32开发(一)虚拟机 + VScode + STM32Cube 开发STM32|CSDN创作打卡
文章目录 环境配置 安装编译器 安装make 配置软件 CubeMx生成Makefile 编译 下载代码,使用STLink 安装openocd 在工程下面建立配置文件config.cfg 运行下载 方 ...
- 使用STM32CubeMX和TrueSTUDIO开发STM32系列微控制器
文章目录 这种方式现在已经不推荐了 关于STM32CubeMX STM32CubeMX介绍 为什么使用STM32CubeMX 下载及安装 关于TrueSTUDIO TrueSTUDIO介绍 为什么使用 ...
- VSCODE+EIDE开发STM32
文章目录 前言 一.必要准备工作 二.安装EIDE 三.新建工程 四.配置工程编译参数和环境 五.编辑main文件 六.编译烧写 总结 前言 EIDE: 是一款适用于 8051/STM8/Cortex ...
- VSCODE修改文字编码格式为GB2312和TAB键为2个空格(MDK5和VSCODE联合开发STM32程序)
在MDK5中,代码.变量等的高亮显示或代码自动补全做的不是很好,经常会出现在A函数中有变量的高亮功能,在B函数中就没有了.特别是在RT-Thread创建的多个线程中,发现同一文件中的其它函数中的变量都 ...
- 使用vscode + gcc进行 STM32 单片机开发(三)DMA读写SD卡,移植FATFS文件系统
背景 在本系列的前两篇文章( 使用vscode + gcc进行 STM32 单片机开发(一)编译及调试 使用vscode + gcc进行 STM32 单片机开发(二)gcc环境 移植rtthread) ...
- 使用 rust 开发 stm32:前言
更多分享内容可访问我的个人博客 https://www.niuiic.top/ 本系列教程全部置于stm32专栏. 本文为使用 rust 开发 stm32 系列教程前言. Why Rust Rust ...
- 使用LL库开发STM32:概述与使用
文章目录 目的 LL库概述 文件说明 API 外设初始化 外设操作与查询 LL库使用 独立使用 与HAL库混合使用 例程参考 总结 目的 ST官方推出的用于开发STM32系列单片机的方式除了HAL库以 ...
最新文章
- noclobber:避免文件的重写
- 碰上摩尔纹怎么办?这5招帮你解决!
- 3D打印火箭发动机真被做出来了!首次地面全周期点火实测,发射报价不到猎鹰9的五分之一...
- halcon区域腐蚀膨胀算子_OpenCV 图像处理之膨胀与腐蚀
- C# 实现DB文件的导入导出功能
- 谈谈对搜索技术Elastic SearchLucene的理解
- 上不了网,我的解决过程
- 对java支持并发的理解_Java并发知识(1)
- NOI.AC#2144-子串【SAM,倍增】
- 【POJ - 2942】Knights of the Round Table(点双连通分量,二分图判断奇环奇圈)
- nginx ngx_core_module(main event)
- 6.Springcloud的Ribbon的负载均衡算法解析及配置方式
- AD 软件的学习--基本操作
- Android获取系统字体的大小,修改android系统字体大小
- 自媒体平台搜狗号登陆 搜狗挑战百度、头条有胜算吗?
- Alpha阶段敏捷冲刺②
- SM4加密算法原理以及C语言实现
- Python学习笔记:个税起征点上调至5000,算一算少交多少税?
- 浅析Margin和Padding属性
- Servlet3.0实现的简单mvc框架