From 9d1917a8e655c45e9072e43a2e400eda51fee08c Mon Sep 17 00:00:00 2001 From: "rick.chan" Date: Fri, 15 Mar 2024 16:04:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=E5=B8=B8=E8=A7=81?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E8=A7=A3=E5=86=B3.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: rick.chan --- .../VSCode/VSCode_ARM_CortexM_开发.md | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/Software/Applications/VSCode/VSCode_ARM_CortexM_开发.md b/Software/Applications/VSCode/VSCode_ARM_CortexM_开发.md index aff6c08..f33f575 100644 --- a/Software/Applications/VSCode/VSCode_ARM_CortexM_开发.md +++ b/Software/Applications/VSCode/VSCode_ARM_CortexM_开发.md @@ -1,10 +1,10 @@ --- layout: post title: "VSCode ARM CortexM 开发" -subtitle: "" +subtitle: "VSCode EIDE 插件的配置和使用" description: "讲述如何使用 VSCode 进行 MCU 系统开发。" excerpt: "VSCode 及 Embedded IDE、Cortex-Debug 扩展介绍。" -date: 2023-11-13 19:11:00 +date: 2024-03-15 15:58:00 author: "Rick Chan" tags: ["Applications", "VSCode"] categories: ["Software"] @@ -20,6 +20,8 @@ published: true - [3.1. PyOCD 的安装](#31-pyocd-的安装) - [3.2. 关于 PyOCD 的扩展说明](#32-关于-pyocd-的扩展说明) - [3.3 PyOCD 常用命令](#33-pyocd-常用命令) +- [4. 常见问题解决](#4-常见问题解决) + - [4.1. GCC 链接错误 引用未定义函数 \_read \_write \_sbrk](#41-gcc-链接错误-引用未定义函数-_read-_write-_sbrk) VSCode 的嵌入式开发插件具备了相当多的功能,这里主要使用 Embedded IDE,这是一个支持 MCU 开发的工具,但不具备调试功能,为了调试 ARM Cortex-M MCUs,可以配合安装 Cortex-Debug 插件。这两个插件直接在扩展商店进行搜索安装即可,下面主要介绍使用方法。 @@ -191,3 +193,28 @@ C:\Users\\AppData\Local\cmsis-pack-manager\cmsis-pack-manager pyocd pack find pyocd pack install ``` + +## 4. 常见问题解决 + +### 4.1. GCC 链接错误 引用未定义函数 _read _write _sbrk + +```bash +d:/gcc-arm-none-eabi-4_9/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7-m\libc_nano.a(lib_a-sbrkr.o): In function `_sbrk_r': +sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk' +d:/gcc-arm-none-eabi-4_9/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7-m\libc_nano.a(lib_a-writer.o): In function `_write_r': +writer.c:(.text._write_r+0x10): undefined reference to `_write' +d:/gcc-arm-none-eabi-4_9/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7-m\libc_nano.a(lib_a-closer.o): In function `_close_r': +closer.c:(.text._close_r+0xc): undefined reference to `_close' +d:/gcc-arm-none-eabi-4_9/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7-m\libc_nano.a(lib_a-fstatr.o): In function `_fstat_r': +fstatr.c:(.text._fstat_r+0xe): undefined reference to `_fstat' +d:/gcc-arm-none-eabi-4_9/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7-m\libc_nano.a(lib_a-isattyr.o): In function `_isatty_r': +isattyr.c:(.text._isatty_r+0xc): undefined reference to `_isatty' +d:/gcc-arm-none-eabi-4_9/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7-m\libc_nano.a(lib_a-lseekr.o): In function `_lseek_r': +lseekr.c:(.text._lseek_r+0x10): undefined reference to `_lseek' +d:/gcc-arm-none-eabi-4_9/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7-m\libc_nano.a(lib_a-readr.o): In function `_read_r': +readr.c:(.text._read_r+0x10): undefined reference to `_read' +``` + +在 Builder Configurations -> Builder Options 中进行修改。 + +选择 Global Options 或 Linker,添加或删除 “--specs=nosys.spece”(文章:[ARM GCC 链接错误 引用未定义函数 _read _write _sbrk 解决和重定向](https://blog.csdn.net/daxiebao/article/details/52653657) 中说要添加该参数,但我实际项目中已经添加了该参数仍然报出了这个警告,删除后警告消失)。