Skip to content

Commit 1572a44

Browse files
zhuzhuzhusmysterywolf
authored andcommitted
[dm2.0] add new bsp for rk platform
1 parent f98f772 commit 1572a44

Some content is hidden

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

42 files changed

+17198
-0
lines changed

bsp/rockchip/rk3500/.config

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

bsp/rockchip/rk3500/Kconfig

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
source "$BSP_DIR/driver/Kconfig"
21+
22+
config SOC_RK3568
23+
bool
24+
select ARCH_ARMV8
25+
select ARCH_CPU_64BIT
26+
select RT_USING_CACHE
27+
select RT_USING_COMPONENTS_INIT
28+
select RT_USING_USER_MAIN
29+
select ARCH_ARM_BOOTWITH_FLUSH_CACHE
30+
default y
31+

bsp/rockchip/rk3500/README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
2+
3+
4+
5+
# RK3568 BSP Introduction
6+
7+
[中文页]() | English
8+
9+
## 1. Introduction
10+
11+
RK3568 is a general-purpose SOC, quad-core 64-bit Cortex-A55 processor, with 22nm lithography process, has frequency up to 2.0GHz and Mali G52 GPU, support 4K decoding and 1080P encoding. Support mangy interfaces such as SATA/PCIE/USB3.0, an 0.8T NPU for lightweight AI applications. Support dual Gigabit Ethernet ports, LPDDR4 memory, etc.
12+
13+
This project ported RT-Thread on RK3568, you can use the RADXA ROCK 3A version of the RK3568 in low-priced, which can even replace the Raspberry Pi 4B.
14+
15+
## 2. Compiling
16+
17+
Usage ARM Developer GNU ToolChain, it support Linux and Windows:
18+
19+
```plaintext
20+
https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads/
21+
```
22+
23+
24+
25+
Download the `xxx-aarch64-none-elf` of x86_64 hosted platform, set the `RTT_EXEC_PATH` is system environment after decompress the binary.
26+
27+
Enter directory `rt-thread/bsp/qemu-virt64-aarch64` and input:
28+
29+
```plaintext
30+
scons
31+
```
32+
33+
34+
35+
## 3. Execution
36+
37+
RK3568 has different Kernel install methods according to different boardsit, recommend to install into the SD card: ([Official](https://wiki.t-firefly.com/en/ROC-RK3568-PC/hardware_doc.html)|[RADXA ROCK 3A](https://wiki.radxa.com/Rock3/install/microSD)).
38+
39+
After install Kernel, storage the `rtthread.bin` to EFI partition (the second partition), and add this line in the front of `boot.cmd` in this partition:
40+
41+
```shell
42+
fatload mmc 1:1 0x208000 /rtthread.bin;dcache flush;go 0x208000
43+
```
44+
45+
46+
47+
After modifying the script, build a binary script `boot.scr ` in this partition:
48+
49+
```shell
50+
# Install the uboot-mkimage package on Linux, or use MSYS2 to install the u-boot-tools package on Windows
51+
mkimage -C none -A arm -T script -d boot.cmd boot.scr
52+
```
53+
54+
55+
56+
According to different boards, the serial port can support up to UART0~9, this project uses UART2 ([Official](https://wiki.t-firefly.com/en/ROC-RK3568-PC/debug.html)|[RADXA ROCK 3A](https://wiki.radxa.com/Rock3/dev/serial-console)) by default, the baud rate is 1500000, please make sure that the serial port used supports this baud rate.
57+
58+
```plaintext
59+
heap: [0x002663f0 - 0x042663f0]
60+
61+
\ | /
62+
- RT - Thread Operating System
63+
/ | \ 4.1.0 build Mar 19 2022 17:17:29
64+
2006 - 2022 Copyright by RT-Thread team
65+
Hi, this is RT-Thread!!
66+
msh />
67+
```
68+
69+
70+
71+
## 4. Condition
72+
73+
| Driver | Condition | Remark |
74+
| ------ | --------- | ------- |
75+
| UART | Support | UART0~9 |

bsp/rockchip/rk3500/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+
from building import *
4+
5+
cwd = GetCurrentDir()
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/rockchip/rk3500/SConstruct

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import os
2+
import sys
3+
import rtconfig
4+
5+
from rtconfig import RTT_ROOT
6+
7+
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
8+
from building import *
9+
10+
TARGET = 'rtthread.' + rtconfig.TARGET_EXT
11+
12+
DefaultEnvironment(tools=[])
13+
env = Environment(tools = ['mingw'],
14+
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
15+
CC = rtconfig.CC, CFLAGS = rtconfig.CFLAGS,
16+
CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
17+
AR = rtconfig.AR, ARFLAGS = '-rc',
18+
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
19+
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
20+
env['ASCOM'] = env['ASPPCOM']
21+
22+
Export('RTT_ROOT')
23+
Export('rtconfig')
24+
25+
# prepare building environment
26+
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu = False)
27+
28+
# make a building
29+
DoBuilding(TARGET, objs)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from building import *
2+
3+
cwd = GetCurrentDir()
4+
src = Glob('*.c') + Glob('*.cpp')
5+
CPPPATH = [cwd]
6+
7+
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
8+
9+
list = os.listdir(cwd)
10+
for item in list:
11+
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
12+
group += SConscript(os.path.join(item, 'SConscript'))
13+
14+
Return('group')
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright (c) 2006-2024 RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2017-5-30 Bernard the first version
9+
*/
10+
11+
#include <rtthread.h>
12+
13+
int main(int argc, char** argv)
14+
{
15+
rt_kprintf("Hi, this is RT-Thread!!\n");
16+
17+
return 0;
18+
}

bsp/rockchip/rk3500/driver/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
menu "RT-Thread rockchip RK3500 drivers"
2+
3+
source "$BSP_DIR/driver/clk/Kconfig"
4+
source "$BSP_DIR/driver/uart8250/Kconfig"
5+
source "$BSP_DIR/driver/reset/Kconfig"
6+
source "$BSP_DIR/driver/hwtimer/Kconfig"
7+
endmenu
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# RT-Thread building script for component
2+
3+
from building import *
4+
5+
cwd = GetCurrentDir()
6+
src = Glob('*.c')
7+
list = os.listdir(cwd)
8+
CPPPATH = [cwd]
9+
objs = []
10+
11+
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
12+
13+
for d in list:
14+
path = os.path.join(cwd, d)
15+
if os.path.isfile(os.path.join(path, 'SConscript')):
16+
objs = objs + SConscript(os.path.join(d, 'SConscript'))
17+
objs = objs + group
18+
19+
Return('objs')

bsp/rockchip/rk3500/driver/board.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright (c) 2006-2024 RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2022-3-08 GuEe-GUI the first version
9+
*/
10+
#include <setup.h>
11+
#include <board.h>
12+
#include <psci.h>
13+
14+
void rt_hw_board_init(void)
15+
{
16+
#if RT_VER_NUM < 0x50200
17+
rt_fdt_commit_memregion_early(&(rt_region_t)
18+
{
19+
.name = "memheap",
20+
.start = (rt_size_t)rt_kmem_v2p(HEAP_BEGIN),
21+
.end = (rt_size_t)rt_kmem_v2p(HEAP_END),
22+
}, RT_TRUE);
23+
#endif
24+
rt_hw_common_setup();
25+
}
26+
27+
void reboot(void)
28+
{
29+
psci_system_reboot();
30+
}
31+
MSH_CMD_EXPORT(reboot, reboot...);
32+
33+
void rt_hw_cpu_shutdown(void)
34+
{
35+
psci_system_off();
36+
}
37+
MSH_CMD_EXPORT_ALIAS(rt_hw_cpu_shutdown, shutdown, shutdown...);

0 commit comments

Comments
 (0)