From 5a499c9c27c77d0d1b631c359a7ca54f14be40b6 Mon Sep 17 00:00:00 2001 From: 12345qiupeng Date: Wed, 10 May 2023 17:23:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20pyocd=E8=B0=83=E8=AF=95=E6=88=90?= =?UTF-8?q?=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- .vscode/.cortex-debug.registers.state.json | 1 + .vscode/c_cpp_properties.json | 41 ++++++++++ .vscode/launch.json | 89 +++++++++++++++++++++ .vscode/settings.json | 6 ++ .vscode/tasks.json | 92 ++++++++++++++++++++++ README.md | 14 ++-- 7 files changed, 237 insertions(+), 8 deletions(-) create mode 100644 .vscode/.cortex-debug.registers.state.json create mode 100644 .vscode/c_cpp_properties.json create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100644 .vscode/tasks.json diff --git a/.gitignore b/.gitignore index 7221bde..01d724b 100644 --- a/.gitignore +++ b/.gitignore @@ -32,7 +32,7 @@ Midea-X1 GPATH GRTAGS GTAGS -.vscode +#.vscode JLinkLog.txt JLinkSettings.ini DebugConfig/ diff --git a/.vscode/.cortex-debug.registers.state.json b/.vscode/.cortex-debug.registers.state.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/.vscode/.cortex-debug.registers.state.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..4ac513c --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,41 @@ +{ + "configurations": [ + { + "name": "Win32", + "defines": [ + "RT_USING_LIBC", + "RT_USING_NEWLIBC", + "STM32F107xC", + "USE_HAL_DRIVER", + "_POSIX_C_SOURCE=1", + "__RTTHREAD__" + ], + "intelliSenseMode": "clang-x64", + "compilerPath": "/Users/qp/Applications/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-gcc", + "cStandard": "c99", + "cppStandard": "c++11", + "includePath": [ + "applications", + "rt-thread/components/libc/compilers/newlib", + "rt-thread/components/libc/compilers/common/include", + "rt-thread/libcpu/arm/common", + "rt-thread/libcpu/arm/cortex-m3", + "rt-thread/components/drivers/include", + "board", + "board/CubeMX_Config/Core/Inc", + "libraries/HAL_Drivers", + "libraries/HAL_Drivers/config", + "libraries/HAL_Drivers/CMSIS/Include", + "rt-thread/components/finsh", + ".", + "rt-thread/include", + "libraries/STM32F1xx_HAL/CMSIS/Device/ST/STM32F1xx/Include", + "libraries/STM32F1xx_HAL/STM32F1xx_HAL_Driver/Inc", + "rt-thread/components/libc/posix/io/stdio", + "rt-thread/components/libc/posix/io/poll", + "rt-thread/components/libc/posix/ipc" + ] + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..8bd77a8 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,89 @@ +{ + // 使用 IntelliSense 了解相关属性。 + // 悬停以查看现有属性的描述。 + // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + + { + "name": "openOCD-Debug", + "cwd": "${workspaceRoot}", + "executable": "rt-thread.elf", + "request": "launch", + "type": "cortex-debug", + "servertype": "openocd", + "preLaunchTask": "Build", + "linux": { + "armToolchainPath": "/usr/bin/", + "configFiles": [ + "/usr/share/openocd/scripts/interface/stlink.cfg", + "/usr/share/openocd/scripts/target/stm32f1x.cfg", + ], + }, + "windows": { + "armToolchainPath": "C://Program Files//", + "configFiles": [ + "C://Program Files//openocd//scripts//interface//stlink.cfg", + "C://Program Files//openocd//scripts//target//stm32f1x.cfg", + ], + }, + "osx": { + "armToolchainPath": "/Users/qp/Applications/gcc-arm-none-eabi-10.3-2021.10/bin/", + "configFiles":[ + "/opt/homebrew/Cellar/open-ocd/0.12.0/share/openocd/scripts/interface/stlink.cfg", + "/opt/homebrew/Cellar/open-ocd/0.12.0/share/openocd/scripts/target/stm32f1x.cfg" + ] + }, + "openOCDLaunchCommands": [ + "reset_config none" // SWD可能未连接RST线, 使用软件复位 + + ], + // "runToMain": false, + // "svdFile": "libraries/STM32F1xx_HAL/CMSIS/Device/ST/STM32F0xx/STM32F072x.svd", // SVD文件描述寄存器,用于调试时查看CPU及外设寄存器 + "runToEntryPoint": "rtthread_startup", + "rtos": "auto", + // "breakAfterReset":true, + // "postStartSessionCommands":[] + }, + { + "name": "pyOCD-Debug", + "cwd": "${workspaceRoot}", + "executable": "rt-thread.elf", + "request": "launch", + "type": "cortex-debug", + "servertype": "pyocd", + "showDevDebugOutput": "both", + "targetId":"stm32f107vc", + "interface": "swd", + // "cmsisPack": "libraries/STM32F1xx_HAL/CMSIS/", + + "preLaunchTask": "Build", + "linux": { + "name": "Launch", + "type": "cortex-debug", + "request": "launch", + "executable": "", + "armToolchainPath": "/usr/bin/", + }, + "windows": { + "name": "Launch", + "type": "cortex-debug", + "request": "launch", + "executable": "", + "armToolchainPath": "C://Program Files//", + }, + "osx": { + "name": "Launch", + "type": "cortex-debug", + "request": "launch", + "executable": "rt-thread.elf", + "armToolchainPath": "/Users/qp/Applications/gcc-arm-none-eabi-10.3-2021.10/bin/" + }, + // "runToMain": false, + // "svdFile": "libraries/STM32F0xx_HAL/CMSIS/Device/ST/STM32F0xx/STM32F072x.svd", // SVD文件描述寄存器,用于调试时查看CPU及外设寄存器 + "runToEntryPoint": "rtthread_startup", + // "breakAfterReset":true, + // "postStartSessionCommands":[] + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..8636e23 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "files.associations": { + "*.txt": "cmake", + "drv_usart.h": "c" + } +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..d3d42d3 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,92 @@ +{ + // 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": "scons -j8", + "detail":"scons -j8", + "group": "build", + }, + { + "label": "Rebuild", + "type": "shell", + "command": "scons -c && scons -j8", + "detail":"scons -c && scons -j8", + "group": "build" + }, + { + "label": "Clean", + "type": "shell", + "command": "scons -c", + "detail":"scons -c", + "group": "build" + }, + { + "label": "Download",//通过openocd下载 + "type": "shell", + "detail":"openocd", + "group": "build", + "command": "openocd", + "args": [ + //"-d", //输出openocd的运行日志 + "-f", + "interface/stlink.cfg", //默认目录: /usr/share/openocd/scripts/ + "-f", + "target/stm32f1x.cfg", //默认目录: /usr/share/openocd/scripts/ + "-c", + "reset_config none", + "-c", + "init", + "-c", + "reset init", + "-c", + "halt", + "-c", + "sleep 10", + "-c", + "flash write_image erase rt-thread.elf", // 下载固件 + "-c", + "sleep 10", + "-c", + "shutdown", + "-c", + "exit" + ] + }, + { + "label": "Menuconfig",//配置rtthread + "type": "shell", + "command": "scons --menuconfig", + "detail":"scons --menuconfig", + "group": "build" + }, + { + "label": "Update",//更新 package(rtthread) + "type": "shell", + "command": "pkgs --update", + "detail":"pkgs --update", + "group": "build" + }, + { + "label": "Package",//打包vscode + "type": "shell", + "command": "scons --target=vsc -s", + "detail":"scons --target=vsc -s", + "group": "build" + }, + { + "label": "tty", //串口终端 + "type": "shell", + "command": "picocom -b 115200 /dev/ttyUSB0", + "detail":"picocom -b 115200 /dev/ttyUSB0", + "group": "build", + "runOptions": { + "instanceLimit": 1 + } + + } + ] +} \ No newline at end of file diff --git a/README.md b/README.md index a803a8c..3e3a972 100644 --- a/README.md +++ b/README.md @@ -22,14 +22,14 @@ 该开发板常用 **板载资源** 如下: -- MCU:STM32xxx,主频 xxxMHz,xxxKB FLASH ,xxxKB RAM -- 外部 RAM:型号,xMB -- 外部 FLASH:型号,xMB +- MCU:STM32F107VC,主频 72MHz,256KB FLASH ,64KB RAM +- 无外部 RAM:型号,xMB +- 无外部 FLASH:型号,xMB - 常用外设 - - LED:x个,DS0(红色,PB1),DS1(绿色,PB0) - - 按键:x个,K0(兼具唤醒功能,PA0),K1(PC13) -- 常用接口:USB 转串口、SD 卡接口、以太网接口、LCD 接口等 -- 调试接口,标准 JTAG/SWD + - LED:1个,POW(绿色,PC5),RUN(绿色,PE2) + - 按键:0个,K0(兼具唤醒功能,PA0),K1(PC13) +- 常用接口:CAN、USB 转串口、SD 卡接口、以太网接口、LCD 接口等 +- 调试接口,标准 SWD 开发板更多详细信息请参考【厂商名】 [xxx开发板介绍](https://xxx)。