Skip to content

Commit 5958cf9

Browse files
committed
add bsp-template rename ra4e2-ek
1 parent da5a463 commit 5958cf9

File tree

17 files changed

+1588
-0
lines changed

17 files changed

+1588
-0
lines changed

bsp/renesas/ra4e2-ek/.config

Lines changed: 692 additions & 0 deletions
Large diffs are not rendered by default.

bsp/renesas/ra4e2-ek/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/RTE
2+
/Listings
3+
/Objects
4+
ra_cfg.txt
5+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# files format check exclude path, please follow the instructions below to modify;
2+
# If you need to exclude an entire folder, add the folder path in dir_path;
3+
# If you need to exclude a file, add the path to the file in file_path.
4+
5+
dir_path:
6+
- ra
7+
- ra_gen
8+
- ra_cfg
9+
- RTE

bsp/renesas/ra4e2-ek/Kconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
mainmenu "RT-Thread Configuration"
2+
3+
BSP_DIR := .
4+
5+
RTT_DIR := ../../..
6+
7+
# you can change the RTT_ROOT default "../.." to your rtthread_root,
8+
# example : default "F:/git_repositories/rt-thread"
9+
10+
PKGS_DIR := packages
11+
12+
ENV_DIR := /
13+
14+
source "$(RTT_DIR)/Kconfig"
15+
osource "$PKGS_DIR/Kconfig"
16+
rsource "../libraries/Kconfig"
17+
source "$(BSP_DIR)/board/Kconfig"

bsp/renesas/ra4e2-ek/README.md

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
# 瑞萨 CPK-RA6M4 开发板 BSP 说明
2+
3+
## 简介
4+
5+
本文档为瑞萨 CPK-RA6M4 开发板提供的 BSP (板级支持包) 说明。通过阅读快速上手章节开发者可以快速地上手该 BSP,将 RT-Thread 运行在开发板上。
6+
7+
主要内容如下:
8+
9+
- 开发板介绍
10+
- BSP 快速上手指南
11+
12+
## 开发板介绍
13+
14+
基于瑞萨 RA6M4 MCU 开发的 CPK-RA6M4 MCU 评估板,通过灵活配置软件包和 IDE,可帮助用户对 RA6M4 MCU 群组的特性轻松进行评估,并对嵌入系统应用程序进行开发。
15+
16+
开发板正面外观如下图:
17+
18+
![image-20211011174017429](docs/picture/cpk-ra6m4.png)
19+
20+
该开发板常用 **板载资源** 如下:
21+
22+
- MCU:R7FA6M4AF3CFB,200MHz,Arm Cortex®-M33 内核,1MB 代码闪存, 256kB SRAM
23+
- 调试接口:板载 J-Link 接口
24+
- 扩展接口:两个 PMOD 连接器
25+
26+
**更多详细资料及工具**
27+
28+
## 外设支持
29+
30+
本 BSP 目前对外设的支持情况如下:
31+
32+
| **片上外设** | **支持情况** | **备注** |
33+
| :----------------- | :----------------- | :------------- |
34+
| UART | 支持 | UART7 为默认日志输出端口 |
35+
| GPIO | 支持 | |
36+
| IIC | 支持 | 软件 |
37+
| WDT | 支持 | |
38+
| RTC | 支持 | |
39+
| ADC | 支持 | |
40+
| DAC | 支持 | |
41+
| SPI | 支持 | |
42+
| FLASH | 支持 | |
43+
| PWM | 支持 | |
44+
| CAN | 支持 | |
45+
| 持续更新中... | | |
46+
| **外接外设** | **支持情况** | **备注** |
47+
| WiFi 模块 | 支持 | [RW007 WiFi 网络模块](https://github.com/RT-Thread-packages/rw007) |
48+
| 温湿度传感器 | 支持 | [HS300x 温湿度模块](https://github.com/Guozhanxin/hs300x) |
49+
| 室内空气质量传感器 | 支持 | [zmod4410 室内空气质量模块](https://github.com/ShermanShao/zmod4410) |
50+
| 光线传感器 | 支持 | [isl29035光线传感器模块](https://github.com/ShermanShao/isl29035) |
51+
52+
53+
## 使用说明
54+
55+
使用说明分为如下两个章节:
56+
57+
- 快速上手
58+
59+
本章节是为刚接触 RT-Thread 的新手准备的使用说明,遵循简单的步骤即可将 RT-Thread 操作系统运行在该开发板上,看到实验效果 。
60+
- 进阶使用
61+
62+
本章节是为需要在 RT-Thread 操作系统上使用更多开发板资源的开发者准备的。通过使用 ENV 工具对 BSP 进行配置,可以开启更多板载资源,实现更多高级功能。
63+
64+
### 快速上手
65+
66+
本 BSP 目前仅提供 MDK5 工程。下面以 MDK5 开发环境为例,介绍如何将系统运行起来。
67+
68+
**硬件连接**
69+
70+
使用 USB 数据线连接开发板到 PC,使用 J-link 接口下载和 DEBUG 程序。使用 USB 转串口工具连接 UART7:P613(TXD)、P614(RXD)。
71+
72+
**编译下载**
73+
74+
- 编译:双击 project.uvprojx 文件,打开 MDK5 工程,编译程序。
75+
76+
> 注意:此工程需要使用 J-Flash Lite 工具烧录程序。建议使用 V7.50 及以上版本烧录工程。[J-Link 下载链接](https://www.segger.com/downloads/jlink/)
77+
78+
- 下载:打开 J-Flash lite 工具,选择芯片型号 R7FA6M4AF,点击 OK 进入工具。选择 BSP 目录下 MDK 编译出的 /object/ra6m4.hex 文件,点击 Program Device 按钮开始烧录。具体操作过程可参考下图步骤:
79+
80+
![image-20211011181555421](docs/picture/jflash1.png)
81+
82+
![image-20211011182047981](docs/picture/jflash2.png)
83+
84+
![image-20211011182434519](docs/picture/jflash.png)
85+
86+
![image-20211011182949604](docs/picture/jflash3.png)
87+
88+
**查看运行结果**
89+
90+
下载程序成功之后,系统会自动运行并打印系统信息。
91+
92+
连接开发板对应串口到 PC , 在终端工具里打开相应的串口(115200-8-1-N),复位设备后,可以看到 RT-Thread 的输出信息。输入 help 命令可查看系统中支持的命令。
93+
94+
```bash
95+
\ | /
96+
- RT - Thread Operating System
97+
/ | \ 4.0.4 build Oct 11 2021
98+
2006 - 2021 Copyright by rt-thread team
99+
100+
Hello RT-Thread!
101+
msh >
102+
msh >help
103+
RT-Thread shell commands:
104+
reboot - Reboot System
105+
help - RT - Thread shell help.
106+
ps - List threads in the system.
107+
free - Show the memory usage in the system.
108+
hello - say hello world
109+
clear - clear the terminal screen
110+
version - show RT - Thread version information
111+
list_thread - list thread
112+
list_sem - list semaphore in system
113+
list_event - list event in system
114+
list_mutex - list mutex in system
115+
list_mailbox - list mail box in system
116+
list_msgqueue - list message queue in system
117+
list_timer - list timer in system
118+
list_device - list device in system
119+
list - list all commands in system
120+
121+
msh >
122+
```
123+
124+
**应用入口函数**
125+
126+
应用层的入口函数在 **bsp\ra6m4-cpk\src\hal_emtry.c** 中 的 `void hal_entry(void)` 。用户编写的源文件可直接放在 src 目录下。
127+
128+
```c
129+
void hal_entry(void)
130+
{
131+
rt_kprintf("\nHello RT-Thread!\n");
132+
133+
while (1)
134+
{
135+
rt_pin_write(LED3_PIN, PIN_HIGH);
136+
rt_thread_mdelay(500);
137+
rt_pin_write(LED3_PIN, PIN_LOW);
138+
rt_thread_mdelay(500);
139+
}
140+
}
141+
```
142+
143+
### 进阶使用
144+
145+
**资料及文档**
146+
147+
- [开发板官网主页](https://www2.renesas.cn/cn/zh/products/microcontrollers-microprocessors/ra-cortex-m-mcus/cpk-ra6m4-evaluation-board)
148+
- [开发板用户手册](https://www2.renesas.cn/cn/zh/document/mah/1527156?language=zh&r=1527191)
149+
- [瑞萨RA MCU 基础知识](https://www2.renesas.cn/cn/zh/document/gde/1520091)
150+
- [RA6 MCU 快速设计指南](https://www2.renesas.cn/cn/zh/document/apn/ra6-quick-design-guide)
151+
- [RA6M4_datasheet](https://www2.renesas.cn/cn/zh/document/dst/ra6m4-group-datasheet)
152+
- [RA6M4 Group User’s Manual: Hardware](https://www2.renesas.cn/cn/zh/document/man/ra6m4-group-user-s-manual-hardware)
153+
154+
**FSP 配置**
155+
156+
需要修改瑞萨的 BSP 外设配置或添加新的外设端口,需要用到瑞萨的 [FSP](https://www2.renesas.cn/jp/zh/software-tool/flexible-software-package-fsp#document) 配置工具。请务必按照如下步骤完成配置。配置中有任何问题可到[RT-Thread 社区论坛](https://club.rt-thread.org/)中提问。
157+
158+
1. [下载灵活配置软件包 (FSP) | Renesas](https://www.renesas.com/cn/zh/software-tool/flexible-software-package-fsp),请使用 FSP 3.5.0 版本
159+
2. 下载安装完成后,需要添加 CPK-RA6M4 开发板的官方板级支持包
160+
> 打开[ CPK-RA6M4 开发板详情页](https://www2.renesas.cn/jp/zh/products/microcontrollers-microprocessors/ra-cortex-m-mcus/cpk-ra6m4-evaluation-board),在**“下载”**列表中找到 **”CPK-RA6M4板级支持包“**,点击链接即可下载
161+
3. 如何将 **”CPK-RA6M4板级支持包“**添加到 FSP 中,请参考文档[如何导入板级支持包](https://www2.renesas.cn/document/ppt/1527171?language=zh&r=1527191)
162+
4. 请查看文档:[使用瑞萨 FSP 配置工具](./docs/使用瑞萨FSP配置工具.md)。在 MDK 中通过添加自定义命名来打开当前工程的 FSP 配置。
163+
164+
**ENV 配置**
165+
166+
- 如何使用 ENV 工具:[RT-Thread env 工具用户手册](https://www.rt-thread.org/document/site/#/development-tools/env/env)
167+
168+
此 BSP 默认只开启了 UART7 的功能,如果需使用更多高级功能例如组件、软件包等,需要利用 ENV 工具进行配置。
169+
170+
步骤如下:
171+
1. 在 bsp 下打开 env 工具。
172+
2. 输入`menuconfig`命令配置工程,配置好之后保存退出。
173+
3. 输入`pkgs --update`命令更新软件包。
174+
4. 输入`scons --target=mdk5` 命令重新生成工程。
175+
176+
177+
## FAQ
178+
179+
### 使用 MDK 的 DEBUG 时如果遇到提示 “Error: Flash Download failed Cortex-M33” 怎么办?
180+
181+
可按照下图操作,修改 Utilities 中的选项:
182+
183+
![image-20211214102231248](docs/picture/readme_faq1.png)
184+
185+
## 联系人信息
186+
187+
在使用过程中若您有任何的想法和建议,建议您通过以下方式来联系到我们 [RT-Thread 社区论坛](https://club.rt-thread.org/)
188+
189+
## 贡献代码
190+
191+
如果您对 CPK-RA6M4 感兴趣,并且有一些好玩的项目愿意与大家分享的话欢迎给我们贡献代码,您可以参考 [如何向 RT-Thread 代码贡献](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/development-guide/github/github)。

bsp/renesas/ra4e2-ek/SConscript

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# for module compiling
2+
import os
3+
Import('RTT_ROOT')
4+
Import('rtconfig')
5+
from building import *
6+
7+
cwd = GetCurrentDir()
8+
src = []
9+
CPPPATH = []
10+
list = os.listdir(cwd)
11+
12+
if rtconfig.PLATFORM in ['iccarm']:
13+
print("\nThe current project does not support IAR build\n")
14+
Return('group')
15+
elif rtconfig.PLATFORM in ['gcc', 'armclang']:
16+
if GetOption('target') != 'mdk5':
17+
CPPPATH = [cwd]
18+
src = Glob('./src/*.c')
19+
20+
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
21+
22+
for d in list:
23+
path = os.path.join(cwd, d)
24+
if os.path.isfile(os.path.join(path, 'SConscript')):
25+
group = group + SConscript(os.path.join(d, 'SConscript'))
26+
27+
Return('group')

bsp/renesas/ra4e2-ek/SConstruct

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import os
2+
import sys
3+
import rtconfig
4+
5+
if os.getenv('RTT_ROOT'):
6+
RTT_ROOT = os.getenv('RTT_ROOT')
7+
else:
8+
RTT_ROOT = os.path.normpath(os.getcwd() + '/../../..')
9+
10+
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
11+
try:
12+
from building import *
13+
except:
14+
print('Cannot found RT-Thread root directory, please check RTT_ROOT')
15+
print(RTT_ROOT)
16+
exit(-1)
17+
18+
TARGET = 'rtthread.' + rtconfig.TARGET_EXT
19+
20+
DefaultEnvironment(tools=[])
21+
env = Environment(tools = ['mingw'],
22+
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
23+
CC = rtconfig.CC, CFLAGS = rtconfig.CFLAGS,
24+
AR = rtconfig.AR, ARFLAGS = '-rc',
25+
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
26+
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
27+
28+
if rtconfig.PLATFORM in ['iccarm']:
29+
env.Replace(CCCOM = ['$CC $CFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES'])
30+
env.Replace(ARFLAGS = [''])
31+
env.Replace(LINKCOM = env["LINKCOM"] + ' --map project.map')
32+
33+
Export('RTT_ROOT')
34+
Export('rtconfig')
35+
36+
SDK_ROOT = os.path.abspath('./')
37+
if os.path.exists(SDK_ROOT + '/libraries'):
38+
libraries_path_prefix = SDK_ROOT + '/libraries'
39+
else:
40+
libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries'
41+
42+
SDK_LIB = libraries_path_prefix
43+
Export('SDK_LIB')
44+
45+
rtconfig.BSP_LIBRARY_TYPE = None
46+
47+
# prepare building environment
48+
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
49+
50+
# include drivers
51+
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'HAL_Drivers', 'SConscript')))
52+
53+
# make a building
54+
DoBuilding(TARGET, objs)

bsp/renesas/ra4e2-ek/board/Kconfig

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
menu "Hardware Drivers Config"
2+
3+
config SOC_R7FA6M4AF
4+
bool
5+
select SOC_SERIES_R7FA6M4
6+
select RT_USING_COMPONENTS_INIT
7+
select RT_USING_USER_MAIN
8+
default y
9+
10+
menu "Onboard Peripheral Drivers"
11+
12+
endmenu
13+
14+
menu "On-chip Peripheral Drivers"
15+
16+
rsource "../../libraries/HAL_Drivers/Kconfig"
17+
18+
menuconfig BSP_USING_UART
19+
bool "Enable UART"
20+
default y
21+
select RT_USING_SERIAL
22+
select RT_USING_SERIAL_V2
23+
if BSP_USING_UART
24+
25+
menuconfig BSP_USING_UART0
26+
bool "Enable UART0"
27+
default n
28+
if BSP_USING_UART0
29+
config BSP_UART0_RX_USING_DMA
30+
bool "Enable UART0 RX DMA"
31+
depends on BSP_USING_UART0 && RT_SERIAL_USING_DMA
32+
default n
33+
34+
config BSP_UART0_TX_USING_DMA
35+
bool "Enable UART0 TX DMA"
36+
depends on BSP_USING_UART0 && RT_SERIAL_USING_DMA
37+
default n
38+
39+
config BSP_UART0_RX_BUFSIZE
40+
int "Set UART0 RX buffer size"
41+
range 64 65535
42+
depends on RT_USING_SERIAL_V2
43+
default 256
44+
45+
config BSP_UART0_TX_BUFSIZE
46+
int "Set UART0 TX buffer size"
47+
range 0 65535
48+
depends on RT_USING_SERIAL_V2
49+
default 0
50+
endif
51+
endif
52+
53+
endmenu
54+
55+
menu "Board extended module Drivers"
56+
57+
endmenu
58+
endmenu
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import os
2+
from building import *
3+
4+
objs = []
5+
cwd = GetCurrentDir()
6+
list = os.listdir(cwd)
7+
8+
for item in list:
9+
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
10+
objs = objs + SConscript(os.path.join(item, 'SConscript'))
11+
12+
Return('objs')

0 commit comments

Comments
 (0)