Skip to content

Commit 7258328

Browse files
committed
bsp:
add support to zynqmp-r5 core and zynqmp-r5-axu4ev board
1 parent f7b553b commit 7258328

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+16855
-0
lines changed

bsp/zynqmp-r5-axu4ev/.config

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

bsp/zynqmp-r5-axu4ev/Kconfig

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
mainmenu "RT-Thread Project Configuration"
2+
3+
config BSP_DIR
4+
string
5+
option env="BSP_ROOT"
6+
default "."
7+
8+
config RTT_DIR
9+
string
10+
option env="RTT_ROOT"
11+
default "../.."
12+
13+
config PKGS_DIR
14+
string
15+
option env="PKGS_ROOT"
16+
default "packages"
17+
18+
source "$RTT_DIR/Kconfig"
19+
source "$PKGS_DIR/Kconfig"
20+
21+
config SOC_ZYNQMP_R5
22+
bool
23+
select RT_USING_COMPONENTS_INIT
24+
select RT_USING_USER_MAIN
25+
default y
26+
27+
source "$BSP_DIR/drivers/Kconfig"

bsp/zynqmp-r5-axu4ev/README.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# AXU4EV-E BSP (Board Support Package) Execution Instruction
2+
3+
[中文页](README_zh.md) |
4+
5+
## **Introduction**
6+
7+
This document records the execution instruction of the BSP (board support package) for the AXU4EV-E development board.
8+
9+
The document is covered in three parts:
10+
11+
- AXU4EV-E Board Resources Introduction
12+
- Quickly Get Started
13+
- Advanced Features
14+
- BSP Migration
15+
16+
By reading the Quickly Get Started section developers can quickly get their hands on this BSP and run RT-Thread on the board. More advanced features will be introduced in the Advanced Features section to help developers take advantage of RT-Thread to drive more on-board resources.
17+
18+
## AXU4EV-E Resources Introduction
19+
20+
ALINX AXU4EV-E: Xilinx Zynq UltraScale+ MPSOC XCZU4EV-1SFVC784I Ethernet FPGA development board, the SoM Core board is the smallest system, mainly composed of XCZU4EV-1SFVC784I + 5 DDR4 + eMMC + 1 QSPI FLASH. The Carrier board expands a wealth of peripheral interfaces for the core board, including 1 SATA M.2 interface, 1 DP output interface, 4 USB3.0 interfaces, 2 Gigabit Ethernet interfaces, 2 UART interfaces, 1 SD card interface, 2*40-pin Expansion Connectors for Modules, 2 CAN bus interfaces, 2 RS485 interfaces, 1 MIPI interface, Keys and LEDs. High-speed data exchange and transmission, data storage, pre-verification and post-application of data processing, video transmission processing, deep learning, artificial intelligence and industrial control, is a professional ZYNQ development platform. suitable for students, engineers and other groups engaged in the development of MPSoCs.
21+
22+
For more details about this board, please refer to [Alinx Electronic Technology (Shanghai) Co.,Ltd.](http://www.alinx.com/en/)
23+
24+
## **Peripheral Condition**
25+
26+
Each peripheral supporting condition for this BSP is as follows:
27+
28+
| **Core** | **Support** | **Remark** |
29+
| :----------------- | :----------: | :------------------------------------- |
30+
| R5-CPU0 | Support | The R5-CPU0 is running the system |
31+
| **On-board Peripherals** | **Support** | **Remark** |
32+
| None | | |
33+
| **On-chip Peripherals** | **Support** | **Remark** |
34+
| GPIO | Support | |
35+
| UART | Support | UART0 |
36+
| TIMER | Support | TTC0 provides system clock |
37+
| EMMC | Support | SD0 Controller |
38+
39+
## Execution Instruction
40+
41+
### Quickly Get Started
42+
43+
This BSP only support the GCC development environment. Here's an example to introduce how to run the system.
44+
45+
#### Compile and Download
46+
47+
1. Open the env tool under BSP. Enter `scons` to compile.
48+
49+
2. After compiling, `rtthread-zynqmp-r5.elf` file will be generated in BSP directory.
50+
51+
3. Use Xilinx Vitis to generate fsbl, and then create "Debug Configuration", select the `rtthread-zynqmp-r5.elf` file as the application.
52+
53+
4. Use the debugger to connect the PC and the development board. Set the dial switch to JTAG to start. Then connect the power supply. Click start debugging or running.
54+
55+
Since the compiler has debugging information by default (see rtconfig.py In BUILD, so when debugging in Xilinx Vitis, you can also open source files to set breakpoints for debugging.
56+
57+
#### Software Solidification
58+
59+
1. Open the env tool under BSP. Enter `scons` to compile.
60+
61+
2. After compiling, `rtthread-zynqmp-r5.elf` file will be generated in BSP directory.
62+
63+
3. Use Xilinx Vitis or Xilinx SDK to generate fsbl, and then use the bootgen tool provided by Xilinx to make fsbl BOOT.bin Documents.
64+
65+
For example, use the command line:
66+
67+
```
68+
bootgen -image ./output.bif -arch zynqmp -o ./BOOT.bin -w on
69+
```
70+
71+
And the outpu.bif file could be:
72+
```
73+
//arch = zynqmp; split = false; format = BIN
74+
the_ROM_image:
75+
{
76+
[bootloader, destination_cpu = r5-0]./fsbl.elf
77+
[destination_cpu = r5-0, exception_level = el-3]./rtthread-zynqmp-r5.elf
78+
}
79+
```
80+
81+
4. According to the document provided by Alinx, put BOOT.bin into SD card or burn to QSPI flash, set the startup mode through dial switch, and then connect the power supply to start.
82+
83+
84+
#### Running Results
85+
86+
Once the project is successfully downloaded, the system runs automatically.
87+
88+
Connect the serial port of the board to PC, communicate with it via a serial terminal tool (115200bps, 8N1). Restart the board and the startup information of RT-Thread will be observed:
89+
90+
```bash
91+
\ | /
92+
- RT - Thread Operating System
93+
/ | \ 4.0.3 build Nov 27 2020
94+
2006 - 2020 Copyright by rt-thread team
95+
msh />
96+
```
97+
98+
### **Advanced Features**
99+
100+
This BSP enables EMMC driver and DFS file system by default. If you need to use a file system, you can format and mount it by yourself.
101+
102+
## BSP Migration
103+
104+
If you need to ported the BSP to another development board of Xilinx Zynq UltraScale+ MPSOC development platform, it is also convenient. The main modifications are as follows:
105+
106+
1. Memory: `psu_r5_ddr_0_MEM_0` in `zynqmp-r5.ld` (if DDR memory is less than 2G)
107+
2. Main Frequency: `XPAR_CPU_CORTEXR5_0_CPU_CLK_FREQ_HZ` in `zynqmp-r5.h`
108+
3. Pin and Frequency of Serial Port: `rxmio`, `txmio` and `XPAR_PSU_UART_0_UART_CLK_FREQ_HZ` in `drv_uart.c`
109+
4. Timer Frequency: `XPAR_PSU_TTC_0_TTC_CLK_FREQ_HZ` in `drv_timer.c`
110+
5. SD Controller: Block device driver initialization in `drv_sdcard.c`
111+
112+
The parameter macro definition in `xparameters.h` does not need to be modified manually. You can directly copy the `xparameters.h` file of the development board generated in Xilinx Vitis.

bsp/zynqmp-r5-axu4ev/README_zh.md

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# AXU4EV-E 开发板 BSP 说明
2+
3+
## 简介
4+
5+
本文档是为 AXU4EV-E 开发板提供的 BSP (板级支持包) 说明。
6+
7+
主要内容如下:
8+
9+
- 开发板资源介绍
10+
- BSP 快速上手
11+
- 进阶使用方法
12+
13+
通过阅读快速上手章节开发者可以快速地上手该 BSP,将 RT-Thread 运行在开发板上。在进阶使用指南章节,将会介绍更多高级功能,帮助开发者利用 RT-Thread 驱动更多板载资源。
14+
15+
## 开发板介绍
16+
17+
AXU4EV-E 开发板是 芯驿电子科技(上海)有限公司 推出的一款基于 XILINX Zynq UltraScale+ MPSoCs 开发平台的开发板。这款 MPSoCs 开发平台采用核心板加扩展板的模式,方便用户对核心板的二次开发利用。核心板使用 XILINX Zynq UltraScale+ EV 芯片 ZU4EV 的解决方案,它采用Processing System(PS)+Programmable Logic(PL)技术将四核ARM Cortex-A53 和FPGA 可编程逻辑集成在一颗芯片上。另外核心板上 PS 端带有 4 片共 4GB 高速 DDR4 SDRAM 芯片,1 片 8GB的 eMMC 存储芯片和 1 片 256Mb 的 QSPI FLASH 芯片;核心板上 PL 端带有 1 片 1GB 的DDR4 SDRAM 芯片 。
18+
19+
开发板更多详细信息请参考[芯驿电子科技(上海)有限公司](http://www.alinx.cn/)
20+
21+
## 外设支持
22+
23+
本 BSP 目前对外设的支持情况如下:
24+
25+
| **核心** | **支持情况** | **备注** |
26+
| :----------------- | :----------: | :------------------------------------- |
27+
| R5-CPU0 | 支持 | 运行系统的为R5核的CPU0 |
28+
| **板载外设** | **支持情况** | **备注** |
29+
|| | |
30+
| **片上外设** | **支持情况** | **备注** |
31+
| GPIO | 支持 | |
32+
| UART | 支持 | UART0 |
33+
| TIMER | 支持 | TTC0提供系统时钟 |
34+
| EMMC | 支持 | SD0控制器 |
35+
36+
## 使用说明
37+
38+
使用说明分为如下两个章节:
39+
40+
- 快速上手
41+
42+
本章节是为刚接触 RT-Thread 的新手准备的使用说明,遵循简单的步骤即可将 RT-Thread 操作系统运行在该开发板上,看到实验效果 。
43+
44+
- 进阶使用
45+
46+
本章节是为需要在 RT-Thread 操作系统上使用更多开发板资源的开发者准备的。通过使用 ENV 工具对 BSP 进行配置,可以开启更多板载资源,实现更多高级功能。
47+
48+
49+
### 快速上手
50+
51+
本 BSP 为仅支持 GCC 开发环境,下面介绍如何将系统运行起来。
52+
53+
#### 编译下载
54+
55+
1. 在 bsp 下打开 env 工具,输入`scons`进行编译。
56+
57+
2. 编译完成后在 bsp 目录下会生成 `rtthread-zynqmp-r5.elf` 文件。
58+
59+
3. 使用 Xilinx Vitis 产生 FSBL,然后创建 “Debug Configuration”,Application 选择`rtthread-zynqmp-r5.elf` 文件。
60+
61+
4. 使用调试器连接 PC 和开发板,通过拨码开关设置为 JTAG 启动,然后连接电源,点击开始调试或运行即可。
62+
63+
由于编译时默认带有调试信息(见 rtconfig.py 中 BUILD),所以在 Xilinx Vitis 中调试时同样可以打开源文件设断点进行调试。
64+
65+
#### 固化程序
66+
67+
1. 在 bsp 下打开 env 工具,输入`scons`进行编译。
68+
69+
2. 编译完成后在 bsp 目录下会生成 `rtthread-zynqmp-r5.elf` 文件。
70+
71+
3. 使用 Xilinx Vitis 或 Xilinx SDK 产生 FSBL,然后使用 Xilinx 提供的 bootgen 工具制作 BOOT.bin 文件。
72+
73+
例如使用命令行方式:
74+
75+
```
76+
bootgen -image ./output.bif -arch zynqmp -o ./BOOT.bin -w on
77+
```
78+
79+
其中 output.bif 文件可以是:
80+
```
81+
//arch = zynqmp; split = false; format = BIN
82+
the_ROM_image:
83+
{
84+
[bootloader, destination_cpu = r5-0]./fsbl.elf
85+
[destination_cpu = r5-0, exception_level = el-3]./rtthread-zynqmp-r5.elf
86+
}
87+
```
88+
89+
4. 根据 ALINX 提供的文档将 BOOT.bin 放进SD卡或烧录到 QSPI FLASH 中,通过拨码开关设置启动方式,然后连接电源即可启动。
90+
91+
92+
#### 运行结果
93+
94+
下载程序成功之后,系统会自动运行。
95+
96+
连接开发板对应串口到 PC , 在终端工具里打开相应的串口(115200-8-1-N),复位设备后,可以看到 RT-Thread 的输出信息:
97+
98+
```bash
99+
\ | /
100+
- RT - Thread Operating System
101+
/ | \ 4.0.3 build Nov 27 2020
102+
2006 - 2020 Copyright by rt-thread team
103+
msh />
104+
```
105+
106+
### 进阶使用
107+
108+
此 BSP 默认开启了 EMMC 驱动和 DFS 文件系统,如果需要使用文件系统可以自行格式化并挂载。
109+
110+
111+
## 板级移植
112+
113+
如果需要将BSP移植到其他 XILINX Zynq UltraScale+ MPSoCs 开发平台的开发板上也比较方便,主要修改的地方有以下几点:
114+
115+
1. 内存: 如果 DDR memory 小于 2G,需要修改`zynqmp-r5.ld`链接文件中的`psu_r5_ddr_0_MEM_0`
116+
2. 主频: `xparameters.h`中的`XPAR_CPU_CORTEXR5_0_CPU_CLK_FREQ_HZ`
117+
3. 串口引脚和频率:`drv_uart.c`中的`rxmio`, `txmio``xparameters.h`中的`XPAR_PSU_UART_0_UART_CLK_FREQ_HZ`
118+
4. 定时器频率:`xparameters.h`中的`XPAR_PSU_TTC_0_TTC_CLK_FREQ_HZ`
119+
5. SD控制器:`drv_sdcard.c`中的块设备驱动初始化
120+
121+
以上需要修改的`xparameters.h`中的参数宏定义不需要手动修改,可以直接将Xilinx Vitis中产生的开发板的`xparameters.h`文件复制过来即可。
122+
123+
124+
125+
## 注意事项
126+
127+
-
128+
129+
## 联系人信息
130+
131+
维护人:
132+
133+
- [王华辰](https://github.com/Wang-Huachen/)

bsp/zynqmp-r5-axu4ev/SConscript

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# for module compiling
2+
import os
3+
Import('RTT_ROOT')
4+
5+
cwd = str(Dir('#'))
6+
objs = []
7+
list = os.listdir(cwd)
8+
9+
for d in list:
10+
path = os.path.join(cwd, d)
11+
if os.path.isfile(os.path.join(path, 'SConscript')):
12+
objs = objs + SConscript(os.path.join(d, 'SConscript'))
13+
14+
Return('objs')

bsp/zynqmp-r5-axu4ev/SConstruct

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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+
from building import *
12+
13+
TARGET = 'rtthread-zynqmp-r5.' + rtconfig.TARGET_EXT
14+
15+
DefaultEnvironment(tools=[])
16+
env = Environment(tools = ['mingw'],
17+
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
18+
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
19+
AR = rtconfig.AR, ARFLAGS = '-rc',
20+
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
21+
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
22+
23+
Export('RTT_ROOT')
24+
Export('rtconfig')
25+
26+
# prepare building environment
27+
objs = PrepareBuilding(env, RTT_ROOT)
28+
29+
# make a building
30+
DoBuilding(TARGET, objs)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Import('RTT_ROOT')
2+
Import('rtconfig')
3+
from building import *
4+
5+
cwd = os.path.join(str(Dir('#')), 'applications')
6+
src = Glob('*.c')
7+
CPPPATH = [cwd, str(Dir('#'))]
8+
9+
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
10+
11+
Return('group')
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include <rtthread.h>
2+
#include <rtdevice.h>
3+
4+
#define LED_PIN 40
5+
int main(void)
6+
{
7+
rt_pin_mode(LED_PIN, PIN_MODE_OUTPUT);
8+
9+
while (1)
10+
{
11+
rt_pin_write(LED_PIN, PIN_HIGH);
12+
rt_thread_mdelay(500);
13+
rt_pin_write(LED_PIN, PIN_LOW);
14+
rt_thread_mdelay(500);
15+
}
16+
17+
return RT_EOK;
18+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
menu "Hardware Drivers Config"
2+
3+
menu "Onboard Peripheral Drivers"
4+
5+
endmenu
6+
7+
menu "On-chip Peripheral Drivers"
8+
9+
menuconfig BSP_USING_UART
10+
bool "Enable UART"
11+
default y
12+
select RT_USING_SERIAL
13+
if BSP_USING_UART
14+
config BSP_USING_UART0
15+
bool "Enable UART0"
16+
default y
17+
endif
18+
19+
menuconfig BSP_USING_SDIO
20+
bool "Enable SDIO"
21+
default y
22+
if BSP_USING_SDIO
23+
config BSP_USING_SD0
24+
bool "Enable SD0 EMMC"
25+
default y
26+
endif
27+
28+
endmenu
29+
30+
menu "Board extended module Drivers"
31+
32+
endmenu
33+
34+
endmenu
35+

0 commit comments

Comments
 (0)