基于 vscode 搭建开发环境
- 1. 准备
- 2. 安装
- 2.1. 安装瑞萨软件包
- 2.2. 安装编译器
- 2.3. 安装 cmake
- 2.4. 安装 openocd
- 2.5. 安装 ninja
- 2.6. 安装 make
- 3. 生成初始代码
- 4. 修改 cmake 脚本
- 5. 调试准备
- 6. 仿真
1. 准备
需要瑞萨仓库中的两个软件:
- MDK_Device_Packs.zip
- setup_fsp_rasc.exe(RA Smart Configurator)
交叉编译工具链:
- gcc
- cmake
2. 安装
2.1. 安装瑞萨软件包
MDK_Device_Packs_v5.2.0.zip
setup_fsp_v5_2_0_rasc_v2024-01.1.exe
安装 setup_fsp_rasc.exe(RA Smart Configurator)
2.2. 安装编译器
Arm GNU Toolchain Downloads – Arm Developer
下载最新版本:arm-gnu-toolchain-13.2.rel1-mingw-w64-i686-arm-none-eabi.zip
下载后解压,把解压路径添加到环境变量。
在终端中执行指令,查看 gcc 的版本信息:
$ arm-none-eabi-gcc -v
Using built-in specs.
COLLECT_GCC=D:\Applications\Toolchain\arm-gnu-toolchain-13.2.Rel1-mingw-w64-i686-arm-none-eabi\bin\arm-none-eabi-gcc.exe
COLLECT_LTO_WRAPPER=D:/Applications/Toolchain/arm-gnu-toolchain-13.2.Rel1-mingw-w64-i686-arm-none-eabi/bin/../libexec/gcc/arm-none-eabi/13.2.1/lto-wrapper.exe
Target: arm-none-eabi
Configured with: /data/jenkins/workspace/GNU-toolchain/arm-13/src/gcc/configure --target=arm-none-eabi --prefix=/data/jenkins/workspace/GNU-toolchain/arm-13/build-mingw-arm-none-eabi/install --with-gmp=/data/jenkins/workspace/GNU-toolchain/arm-13/build-mingw-arm-none-eabi/host-tools --with-mpfr=/data/jenkins/workspace/GNU-toolchain/arm-13/build-mingw-arm-none-eabi/host-tools --with-mpc=/data/jenkins/workspace/GNU-toolchain/arm-13/build-mingw-arm-none-eabi/host-tools --with-isl=/data/jenkins/workspace/GNU-toolchain/arm-13/build-mingw-arm-none-eabi/host-tools --disable-shared --disable-nls --disable-threads --disable-tls --enable-checking=release --enable-languages=c,c++,fortran --with-newlib --with-gnu-as --with-headers=yes --with-gnu-ld --with-native-system-header-dir=/include --with-sysroot=/data/jenkins/workspace/GNU-toolchain/arm-13/build-mingw-arm-none-eabi/install/arm-none-eabi --with-multilib-list=aprofile,rmprofile --with-libiconv-prefix=/data/jenkins/workspace/GNU-toolchain/arm-13/build-mingw-arm-none-eabi/host-tools --host=i686-w64-mingw32 --with-pkgversion='Arm GNU Toolchain 13.2.rel1 (Build arm-13.7)' --with-bugurl=https://bugs.linaro.org/
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 13.2.1 20231009 (Arm GNU Toolchain 13.2.rel1 (Build arm-13.7))
2.3. 安装 cmake
https://cmake.org/download/
下载后解压,把解压路径添加到环境变量。
在终端中执行指令,查看 cmake 的版本信息:
$ cmake --version
cmake version 3.28.4
CMake suite maintained and supported by Kitware (kitware.com/cmake).
2.4. 安装 openocd
https://github.com/openocd-org/openocd/releases
下载解压后,将解压路径添加到环境变量中。
在终端中执行指令,查看 openocd 的版本信息:
$ openocd --version
Open On-Chip Debugger 0.12.0 (2023-01-14-23:37)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
2.5. 安装 ninja
ninja 和 make 都是构建系统工具,它们通常作为后端,被 cmake 生成和使用,相比之下 ninja 具有更好的性能和更专注于构建速度。
https://github.com/ninja-build/ninja/releases
下载解压后,将解压路径添加到环境变量。
在终端中执行命令,查看 ninja 版本信息:
$ ninja --version
1.11.1
2.6. 安装 make
https://gnuwin32.sourceforge.net/packages/make.htm
下载安装后,需要将安装路径添加到环境变量中。
在终端中执行命令,查看 make 版本信息:
$ make --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i386-pc-mingw32
3. 生成初始代码
打开 rasc(RA Smart Configurator)
RAFA6M3A H 3 C FB
- H:2MB
- FB:144引脚
4. 修改 cmake 脚本
修改顶层 CMakeLists.txt
5. 调试准备
玩转 pyocd - 哈拎 - 博客园 (cnblogs.com)
$ pyocd list -t
Name Vendor Part Number Families Source
------------------------------------------------------------------------------------------------------
air001 AirM2M Air001 builtin
air32f103xb AirM2M Air32F103xB builtin
air32f103xc AirM2M Air32F103xC builtin
air32f103xe AirM2M Air32F103xE builtin
air32f103xg AirM2M
$ pyocd pack -s
Vendor Pack Version
---------------------------
$ pyocd pack find R7FA6M3AH
0000684 I No pack index present, downloading now... [pack_cmd]
Part Vendor Pack Version Installed
--------------------------------------------------------------
R7FA6M3AH Renesas Renesas.RA_DFP 5.2.0 False
$ pyocd pack -i R7FA6M3AH
Downloading packs (press Control-C to cancel):
Renesas.RA_DFP.5.2.0
Downloading descriptors (001/001)
$ pyocd pack -s
Vendor Pack Version
------------------------------
Renesas RA_DFP 5.2.0
$ pyocd list -p
# Probe/Board Unique ID Target
----------------------------------------------------------
0 XIVN1987 XV-Link CMSIS-DAP 5F95D4D86436 n/a
$ pyocd flash --target=R7FA6M3AH --erase=auto --frequency=1000000 ./build/FSP_Project.elf
0001841 I Loading D:\Workspace\other\ra\proj01\build\FSP_Project.elf [load_cmd]
[==================================================] 100%
0009190 I Erased chip, programmed 4992 bytes (39 pages), skipped 912 bytes (8 pages) at 0.79 kB/s [loader]
没尝试过:RT-Thread-使用标准PyOCD烧录RA6M3 HMI-BoardRT-Thread问答社区 - RT-Thread
6. 仿真
F5