diff --git a/bsp/ra6m4-cpk/README.md b/bsp/ra6m4-cpk/README.md new file mode 100644 index 0000000000000000000000000000000000000000..8d1efb31d585f4da72fe89b54b7baca534a3f225 --- /dev/null +++ b/bsp/ra6m4-cpk/README.md @@ -0,0 +1,173 @@ +# 瑞萨 CPK-RA6M4 开发板 BSP 说明 + +## 简介 + +本文档为瑞萨 CPK-RA6M4 开发板提供的 BSP (板级支持包) 说明。通过阅读快速上手章节开发者可以快速地上手该 BSP,将 RT-Thread 运行在开发板上。 + +主要内容如下: + +- 开发板介绍 +- BSP 快速上手指南 + +## 开发板介绍 + +基于瑞萨 RA6M4 MCU 开发的 CPK-RA6M4 MCU 评估板,通过灵活配置软件包和 IDE,可帮助用户对 RA6M4 MCU 群组的特性轻松进行评估,并对嵌入系统应用程序进行开发。 + +开发板正面外观如下图: + +![image-20211011174017429](docs/picture/cpk-ra6m4.png) + +该开发板常用 **板载资源** 如下: + +- MCU:R7FA6M4AF3CFB,200MHz,Arm Cortex®-M33 内核,1MB 代码闪存, 256kB SRAM +- 调试接口:板载 J-Link 接口 +- 扩展接口:两个 PMOD 连接器 + +**更多详细资料及工具** + + +## 外设支持 + +本 BSP 目前对外设的支持情况如下: + +| **片上外设** | **支持情况** | **备注** | +| :----------- | :---------- | :------------------------ | +| UART | 支持 | UART7 | +| 持续更新中... | | | + + +## 使用说明 + +使用说明分为如下两个章节: + +- 快速上手 + + 本章节是为刚接触 RT-Thread 的新手准备的使用说明,遵循简单的步骤即可将 RT-Thread 操作系统运行在该开发板上,看到实验效果 。 + +- 进阶使用 + + 本章节是为需要在 RT-Thread 操作系统上使用更多开发板资源的开发者准备的。通过使用 ENV 工具对 BSP 进行配置,可以开启更多板载资源,实现更多高级功能。 + + +### 快速上手 + +本 BSP 为目前仅为开发者提供 MDK5 工程。下面以 MDK5 开发环境为例,介绍如何将系统运行起来。 + +**硬件连接** + +使用 USB 数据线连接开发板到 PC。使用 USB 转串口工具连接 P613(TXD)、P614(RXD)。 + +**编译下载** + +- 编译:双击 project.uvprojx 文件,打开 MDK5 工程,编译程序。 + +> 注意:此工程需要使用 J-Flash Lite 工具烧录程序。建议使用 V7.50 及以上版本烧录工程。[J-Link 下载链接](https://www.segger.com/downloads/jlink/) + +- 下载:打开 J-Flash lite 工具,选择芯片型号 R7FA6M4AF,点击 OK 进入工具。选择 BSP 目录下 MDK 编译出的 /object/ra6m4.hex 文件,点击 Program Device 按钮开始烧录。具体操作过程可参考下图步骤: + +![image-20211011181555421](docs/picture/jflash1.png) + +![image-20211011182047981](docs/picture/jflash2.png) + +![image-20211011182434519](docs/picture/jflash.png) + +![image-20211011182949604](docs/picture/jflash3.png) + +**查看运行结果** + +下载程序成功之后,系统会自动运行并打印系统信息。 + +连接开发板对应串口到 PC , 在终端工具里打开相应的串口(115200-8-1-N),复位设备后,可以看到 RT-Thread 的输出信息。输入 help 命令可查看系统中支持的命令。 + +```bash + \ | / +- RT - Thread Operating System + / | \ 4.0.4 build Oct 11 2021 + 2006 - 2021 Copyright by rt-thread team + +Hello RT-Thread! +msh > +msh >help +RT-Thread shell commands: +reboot - Reboot System +help - RT - Thread shell help. +ps - List threads in the system. +free - Show the memory usage in the system. +hello - say hello world +clear - clear the terminal screen +version - show RT - Thread version information +list_thread - list thread +list_sem - list semaphore in system +list_event - list event in system +list_mutex - list mutex in system +list_mailbox - list mail box in system +list_msgqueue - list message queue in system +list_timer - list timer in system +list_device - list device in system +list - list all commands in system + +msh > +``` + +**应用入口函数** + +应用层的入口函数在 **bsp\ra6m4-cpk\src\hal_emtry.c** 中 的 `void hal_entry(void)` 。用户编写的 .c 文件和直接放在 src 目录下 + +```c +void hal_entry(void) +{ + rt_kprintf("\nHello RT-Thread!\n"); + + while (1) + { + rt_thread_mdelay(1000); + } +} +``` + +### 进阶使用 + +**ENV 配置** + +- 如何使用 ENV 工具:[RT-Thread env 工具用户手册](https://www.rt-thread.org/document/site/#/development-tools/env/env) + +此 BSP 默认只开启了 串口7 的功能,如果需使用更多高级功能例如组件、软件包等,需要利用 ENV 工具进行配置。步骤如下: + +1. 在 bsp 下打开 env 工具。 + +2. 输入`menuconfig`命令配置工程,配置好之后保存退出。 + +3. 输入`pkgs --update`命令更新软件包。 + +4. 输入`scons --target=mdk5` 命令重新生成工程。 + +**FSP 配置** + +如果需要修改瑞萨的 BSP 外设配置或者需要添加新的外设端口,需要用到瑞萨的 FSP 配置工具。 + +1. [下载灵活配置软件包 (FSP) | Renesas](https://www.renesas.com/cn/zh/software-tool/flexible-software-package-fsp) +2. 下载安装完成后,需要添加这款开发板的官方[CPK-RA6M4板级支持包](https://www2.renesas.cn/document/sws/1527176?language=zh&r=1527191) +3. 如何将BSP配置包添加到 FSP 中,请参考文档[如何导入板级支持包](https://www2.renesas.cn/document/ppt/1527171?language=zh&r=1527191) +4. 在 MDK 中添加自定义命名来打开当前工程的配置详细步骤,请查看文档: [使用瑞萨 FSP 配置工具](./docs/使用瑞萨FSP配置工具.md) + +## 更多资料及文档 + +- [开发板官网主页](https://www2.renesas.cn/cn/zh/products/microcontrollers-microprocessors/ra-cortex-m-mcus/cpk-ra6m4-evaluation-board) + +- [开发板用户手册](https://www2.renesas.cn/cn/zh/document/mah/1527156?language=zh&r=1527191) + +- [瑞萨RA MCU 基础知识](https://www2.renesas.cn/cn/zh/document/gde/1520091) + +- [RA6 MCU 快速设计指南](https://www2.renesas.cn/cn/zh/document/apn/ra6-quick-design-guide) + +- [RA6M4_datasheet](https://www2.renesas.cn/cn/zh/document/dst/ra6m4-group-datasheet) + +- [RA6M4 Group User’s Manual: Hardware](https://www2.renesas.cn/cn/zh/document/man/ra6m4-group-user-s-manual-hardware) + +## 联系人信息 + +在使用过程中若您有任何的想法和建议,建议您通过以下方式来联系到我们 [RT-Thread 社区论坛](https://club.rt-thread.org/) + +## 贡献代码 + +如果您对 CPK-RA6M4 感兴趣,并且有一些好玩的项目愿意与大家分享的话欢迎给我们贡献代码,您可以参考 [向 RT-Thread 代码贡献](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/development-guide/github/github) 。 \ No newline at end of file diff --git a/bsp/ra6m4-cpk/docs/picture/cpk-ra6m4.png b/bsp/ra6m4-cpk/docs/picture/cpk-ra6m4.png new file mode 100644 index 0000000000000000000000000000000000000000..e33531140f00159fd10417f37725b0e75b0fdaba Binary files /dev/null and b/bsp/ra6m4-cpk/docs/picture/cpk-ra6m4.png differ diff --git a/bsp/ra6m4-cpk/docs/picture/customize.png b/bsp/ra6m4-cpk/docs/picture/customize.png new file mode 100644 index 0000000000000000000000000000000000000000..b3eda618453ff8d1a3c545e93bffc193ba31c682 Binary files /dev/null and b/bsp/ra6m4-cpk/docs/picture/customize.png differ diff --git a/bsp/ra6m4-cpk/docs/picture/jflash.png b/bsp/ra6m4-cpk/docs/picture/jflash.png new file mode 100644 index 0000000000000000000000000000000000000000..22675c36672a3b46a84e585ae92f838cac32a3fc Binary files /dev/null and b/bsp/ra6m4-cpk/docs/picture/jflash.png differ diff --git a/bsp/ra6m4-cpk/docs/picture/jflash1.png b/bsp/ra6m4-cpk/docs/picture/jflash1.png new file mode 100644 index 0000000000000000000000000000000000000000..49e33a16f5d708cb68b4803e20993ad342902a79 Binary files /dev/null and b/bsp/ra6m4-cpk/docs/picture/jflash1.png differ diff --git a/bsp/ra6m4-cpk/docs/picture/jflash2.png b/bsp/ra6m4-cpk/docs/picture/jflash2.png new file mode 100644 index 0000000000000000000000000000000000000000..a2d0aab4e01ad0743985feab51a4ad67162a4cfd Binary files /dev/null and b/bsp/ra6m4-cpk/docs/picture/jflash2.png differ diff --git a/bsp/ra6m4-cpk/docs/picture/jflash3.png b/bsp/ra6m4-cpk/docs/picture/jflash3.png new file mode 100644 index 0000000000000000000000000000000000000000..09f4f59758d1ae7a8d5f0d521e66c92e7b62e4ce Binary files /dev/null and b/bsp/ra6m4-cpk/docs/picture/jflash3.png differ diff --git a/bsp/ra6m4-cpk/docs/picture/openrasc.png b/bsp/ra6m4-cpk/docs/picture/openrasc.png new file mode 100644 index 0000000000000000000000000000000000000000..a3a9639db4cbef9930c8cbcf9e4eea673b5a2b44 Binary files /dev/null and b/bsp/ra6m4-cpk/docs/picture/openrasc.png differ diff --git a/bsp/ra6m4-cpk/docs/picture/rascuart.png b/bsp/ra6m4-cpk/docs/picture/rascuart.png new file mode 100644 index 0000000000000000000000000000000000000000..41dbf93f00b92b9a19f3981622281e7d96e4b2ce Binary files /dev/null and b/bsp/ra6m4-cpk/docs/picture/rascuart.png differ diff --git a/bsp/ra6m4-cpk/docs/picture/rascuart1.png b/bsp/ra6m4-cpk/docs/picture/rascuart1.png new file mode 100644 index 0000000000000000000000000000000000000000..4a8246a87e90d9e348e601829de41a35bc3ab002 Binary files /dev/null and b/bsp/ra6m4-cpk/docs/picture/rascuart1.png differ diff --git "a/bsp/ra6m4-cpk/docs/\344\275\277\347\224\250\347\221\236\350\220\250FSP\351\205\215\347\275\256\345\267\245\345\205\267.md" "b/bsp/ra6m4-cpk/docs/\344\275\277\347\224\250\347\221\236\350\220\250FSP\351\205\215\347\275\256\345\267\245\345\205\267.md" new file mode 100644 index 0000000000000000000000000000000000000000..1518ce58097f6874ef91745afc24cb8123ba6dab --- /dev/null +++ "b/bsp/ra6m4-cpk/docs/\344\275\277\347\224\250\347\221\236\350\220\250FSP\351\205\215\347\275\256\345\267\245\345\205\267.md" @@ -0,0 +1,22 @@ +## 在 MDK 中使用 FSP + +1. 打开 MDK,选择 “Tools -> Customize Tools Menu…” +2. 点击 “new” 图标,添加一条自定义命令: RA Smart Configurator +3. Command 输入工具的安装路径, 点击“…”找到安装路径下的“rasc.exe”文件并选中 (setup_fsp_v3_1_0_rasc_ 安装目录下) +4. Initial Folder 输入参数: $P +5. Arguments 输入参数: --device $D --compiler ARMv6 configuration.xml +6. 点击 OK 保存命令“Tools -> RA smart Configurator” + +![img](picture/customize.png) + +7. 点击添加的命令打开配置工具:RA Smart Config + +![image.png](picture/openrasc.png) + +## UART + +- 添加一个 UART 端口外设配置 + +![image.png](picture/rascuart.png) + +![image.png](picture/rascuart1.png) \ No newline at end of file diff --git a/bsp/ra6m4-cpk/project.uvoptx b/bsp/ra6m4-cpk/project.uvoptx index e6665367e3ba388dc455712b7a0199a931ee8fe8..e5d28d3a0ad1d71a58ca8e5b6139249c0ac98e2b 100644 --- a/bsp/ra6m4-cpk/project.uvoptx +++ b/bsp/ra6m4-cpk/project.uvoptx @@ -591,7 +591,7 @@ :Renesas RA Smart Configurator:Common Sources - 0 + 1 0 0 0 diff --git a/bsp/ra6m4-cpk/ra_cfg/.gitignore b/bsp/ra6m4-cpk/ra_cfg/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..dcc6ede7bfcca136d6bdc5c9e229925b277d8ca3 --- /dev/null +++ b/bsp/ra6m4-cpk/ra_cfg/.gitignore @@ -0,0 +1 @@ +/bsp/*.h \ No newline at end of file diff --git a/bsp/ra6m4-cpk/src/hal_entry.c b/bsp/ra6m4-cpk/src/hal_entry.c index c36361fa2fa6b37a65e32d07cda6b154c25ba92b..443c8ddadc7917295611db8cc9ca748eecb6a78c 100644 --- a/bsp/ra6m4-cpk/src/hal_entry.c +++ b/bsp/ra6m4-cpk/src/hal_entry.c @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 * * Change Logs: - * Date Author Notes - * 2021-10-10 Sherman first version + * Date Author Notes + * 2021-10-10 Sherman first version */ #include @@ -14,8 +14,9 @@ void hal_entry(void) { rt_kprintf("\nHello RT-Thread!\n"); + while (1) { rt_thread_mdelay(1000); } -} +} \ No newline at end of file