增加 常见问题解决.

Signed-off-by: rick.chan <cy@sina.com>
This commit is contained in:
rick.chan 2024-03-15 16:04:54 +08:00
parent 0564e423e1
commit 9d1917a8e6
1 changed files with 29 additions and 2 deletions

View File

@ -1,10 +1,10 @@
--- ---
layout: post layout: post
title: "VSCode ARM CortexM 开发" title: "VSCode ARM CortexM 开发"
subtitle: "" subtitle: "VSCode EIDE 插件的配置和使用"
description: "讲述如何使用 VSCode 进行 MCU 系统开发。" description: "讲述如何使用 VSCode 进行 MCU 系统开发。"
excerpt: "VSCode 及 Embedded IDE、Cortex-Debug 扩展介绍。" excerpt: "VSCode 及 Embedded IDE、Cortex-Debug 扩展介绍。"
date: 2023-11-13 19:11:00 date: 2024-03-15 15:58:00
author: "Rick Chan" author: "Rick Chan"
tags: ["Applications", "VSCode"] tags: ["Applications", "VSCode"]
categories: ["Software"] categories: ["Software"]
@ -20,6 +20,8 @@ published: true
- [3.1. PyOCD 的安装](#31-pyocd-的安装) - [3.1. PyOCD 的安装](#31-pyocd-的安装)
- [3.2. 关于 PyOCD 的扩展说明](#32-关于-pyocd-的扩展说明) - [3.2. 关于 PyOCD 的扩展说明](#32-关于-pyocd-的扩展说明)
- [3.3 PyOCD 常用命令](#33-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 插件。这两个插件直接在扩展商店进行搜索安装即可,下面主要介绍使用方法。 VSCode 的嵌入式开发插件具备了相当多的功能,这里主要使用 Embedded IDE这是一个支持 MCU 开发的工具,但不具备调试功能,为了调试 ARM Cortex-M MCUs可以配合安装 Cortex-Debug 插件。这两个插件直接在扩展商店进行搜索安装即可,下面主要介绍使用方法。
@ -191,3 +193,28 @@ C:\Users\<User Name>\AppData\Local\cmsis-pack-manager\cmsis-pack-manager
pyocd pack find <part keyword> pyocd pack find <part keyword>
pyocd pack install <part number> pyocd pack install <part number>
``` ```
## 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) 中说要添加该参数,但我实际项目中已经添加了该参数仍然报出了这个警告,删除后警告消失)。