# VS Code Configuration
Example configurations for debugging programs in-editor with VS Code.
This directory contains configurations for two platforms:
- `LM3S6965EVB` on QEMU
- `STM32F303x` via OpenOCD
## Required Extensions
If you have the `code` command in your path, you can run the following commands to install the necessary extensions.
```sh
code --install-extension rust-lang.rust
code --install-extension marus25.cortex-debug
```
Otherwise, you can use the Extensions view to search for and install them, or go directly to their marketplace pages and click the "Install" button.
- [Rust Language Server (RLS)](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust)
- [Cortex-Debug](https://marketplace.visualstudio.com/items?itemName=marus25.cortex-debug)
## Use
The quickstart comes with two debug configurations.
Both are configured to build the project, using the default settings from `.cargo/config`, prior to starting a debug session.
1. QEMU: Starts a debug session using an emulation of the `LM3S6965EVB` mcu.
- This works on a fresh `cargo generate` without modification of any of the settings described above.
- Semihosting output will be written to the Output view `Adapter Output`.
- `ITM` logging does not work with QEMU emulation.
2. OpenOCD: Starts a debug session for a `STM32F3DISCOVERY` board (or any `STM32F303x` running at 8MHz).
- Follow the instructions above for configuring the build with `.cargo/config` and the `memory.x` linker script.
- `ITM` output will be written to the Output view `SWO: ITM [port: 0, type: console]` output.
### Git
Files in the `.vscode/` directory are `.gitignore`d by default because many files that may end up in the `.vscode/` directory should not be committed and shared.
If you would like to save this debug configuration to your repository and share it with your team, you'll need to explicitly `git add` the files to your repository.
```sh
git add -f .vscode/launch.json
git add -f .vscode/tasks.json
git add -f .vscode/*.svd
```
## Customizing for other targets
For full documentation, see the [Cortex-Debug][cortex-debug] repository.
### Device
Some configurations use this to automatically find the SVD file.
Replace this with the part number for your device.
```json
"device": "STM32F303VCT6",
```
### OpenOCD Config Files
The `configFiles` property specifies a list of files to pass to OpenOCD.
```json
"configFiles": [
"interface/stlink-v2-1.cfg",
"target/stm32f3x.cfg"
],
```
See the [OpenOCD config docs][openocd-config] for more information and the [OpenOCD repository for available configuration files][openocd-repo].
### SVD
The SVD file is a standard way of describing all registers and peripherals of an ARM Cortex-M mCU.
Cortex-Debug needs this file to display the current register values for the peripherals on the device.
You can probably find the SVD for your device on the vendor's website.
For example, the STM32F3DISCOVERY board uses an mcu from the `STM32F303x` line of processors.
All the SVD files for the STM32F3 series are available on [ST's Website][stm32f3].
Download the [stm32f3 SVD pack][stm32f3-svd], and copy the `STM32F303.svd` file into `.vscode/`.
This line of the config tells the Cortex-Debug plug in where to find the file.
```json
"svdFile": "${workspaceRoot}/.vscode/STM32F303.svd",
```
For other processors, simply copy the correct `*.svd` file into the project and update the config accordingly.
### CPU Frequency
If your device is running at a frequency other than 8MHz, you'll need to modify this line of `launch.json` for the `ITM` output to work correctly.
```json
"cpuFrequency": 8000000,
```
### Other GDB Servers
For information on setting up GDB servers other than OpenOCD, see the [Cortex-Debug repository][cortex-debug].
[cortex-debug]: https://github.com/Marus/cortex-debug
[stm32f3]: https://www.st.com/content/st_com/en/products/microcontrollers-microprocessors/stm32-32-bit-arm-cortex-mcus/stm32-mainstream-mcus/stm32f3-series.html#resource
[stm32f3-svd]: https://www.st.com/resource/en/svd/stm32f3_svd.zip
[openocd-config]: http://openocd.org/doc/html/Config-File-Guidelines.html
[openocd-repo]: https://sourceforge.net/p/openocd/code/ci/master/tree/tcl/
没有合适的资源?快使用搜索试试~ 我知道了~
为 Cortex-M微控制器 开发裸机应用程序的模板_rust_代码_相关文件_下载
共21个文件
rs:10个
json:3个
md:2个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 22 浏览量
2022-07-06
16:39:09
上传
评论
收藏 18KB ZIP 举报
温馨提示
为 ARM Cortex-M 微控制器构建应用程序的模板 :这是一个非常简短的版本,仅涵盖构建程序。对于长版本,它还包括闪烁、运行和调试程序 在我们开始之前,您需要确定目标设备的一些特征,因为这些特征将用于配置项目: ARM 内核。例如 Cortex-M3。 ARM 内核是否包含 FPU?Cortex-M4 F和 Cortex-M7 F内核可以。 目标设备有多少闪存和 RAM?例如 256 KiB 的闪存和 32 KiB 的 RAM。 闪存和 RAM 在地址空间中映射到哪里?例如,RAM 通常位于 address 0x2000_0000。 您可以在设备的数据表或参考手册中找到此信息。 在本例中,我们将使用 STM32F3DISCOVERY。该板包含一个 STM32F303VCT6 微控制器。该微控制器具有: 包含单精度 FPU 的 Cortex-M4F 内核 256 KiB 的闪存位于地址 0x0800_0000。 40 KiB 的 RAM 位于地址 0x2000_0000。(还有另一个 RAM 区域,但为简单起见,我们将忽略它)。 更多详情、使用方法,请下载后阅
资源推荐
资源详情
资源评论
收起资源包目录
cortex-m-quickstart-master.zip (21个子文件)
cortex-m-quickstart-master
build.rs 1KB
openocd.cfg 145B
openocd.gdb 1KB
src
main.rs 563B
Cargo.toml 870B
memory.x 1KB
examples
allocator.rs 1KB
exception.rs 849B
test_on_host.rs 2KB
itm.rs 812B
crash.rs 3KB
device.rs 1KB
hello.rs 390B
panic.rs 771B
.gitignore 167B
.cargo
config.toml 2KB
README.md 4KB
.vscode
launch.json 2KB
tasks.json 2KB
extensions.json 473B
README.md 4KB
共 21 条
- 1
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9149
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功