Skip to content

Commit 60287b6

Browse files
author
chenzx
committed
add t-head smart-evb bsp, and risc-v cpu e906
1 parent 5a6a7e3 commit 60287b6

Some content is hidden

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

46 files changed

+10424
-3
lines changed

bsp/thead-smart/.config

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

bsp/thead-smart/Kconfig

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
mainmenu "RT-Thread 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+
# you can change the RTT_ROOT default "../.." to your rtthread_root,
14+
# example : default "F:/git_repositories/rt-thread"
15+
16+
config PKGS_DIR
17+
string
18+
option env="PKGS_ROOT"
19+
default "packages"
20+
21+
source "$RTT_DIR/Kconfig"
22+
source "$PKGS_DIR/Kconfig"
23+
24+
config SOC_THEAD_SMART
25+
bool
26+
select RT_USING_COMPONENTS_INIT
27+
select RT_USING_USER_MAIN
28+
default y
29+
30+
if RT_USING_SERIAL
31+
32+
config RT_USING_UART1
33+
bool "Using uart1"
34+
default y
35+
36+
endif

bsp/thead-smart/README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# T-HEAD SMART-EVB Introduction
2+
SMART-EVB is a development board provided by T-HEAD, based on FPGA to provide implementation, integrating T-HEAD's RISC-V CPU (eg. E902/E906/C906) and C-SKY CPU (eg. E805/E804/E803/E802 ), integrates basic peripheral resources such as GPIO/TIMER/UART/RAM.
3+
4+
##The main resources on board are as follows:
5+
1. SMART-EVB for E906/E906F/E906FD
6+
| res | description |
7+
| -- | -- |
8+
|ISA | RISCV |
9+
|CPU | E906 |
10+
|FREQ| 20MHz |
11+
|SRAM| 768KB |
12+
13+
14+
2. SMART-EVB for E804/E804F/E804D
15+
| res | description |
16+
| -- | -- |
17+
|ISA | C-SKY |
18+
|CPU | E804 |
19+
|FREQ| 20MHz |
20+
|SRAM| 768KB |
21+
22+
23+
# Compile T-HEAD BSP
24+
SMART-EVB BSP supports GCC compiler, the version information is:
25+
1. SMART-EVB for E906/E906F/E906FD
26+
| IDE/Compiler| version|
27+
| - | - |
28+
| GCC | gcc version 8.4.0 (C-SKY RISCV Tools V1.9.6 B20200616) |
29+
30+
# run smart-evb bsp
31+
1. Connect JTAG
32+
2. Connect the serial port
33+
3. riscv64-unknown-elf-gdb rtthread-e906f.elf
34+
35+
run log as follows:
36+
```
37+
\ | /
38+
- RT - Thread Operating System
39+
/ | \ 4.0.3 build Sep 2 2020
40+
2006 - 2020 Copyright by rt-thread team
41+
msh >
42+
```
43+
44+
45+

bsp/thead-smart/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/thead-smart/SConstruct

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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-' + rtconfig.CPU + '.' + rtconfig.TARGET_EXT
14+
15+
env = Environment(tools = ['mingw'],
16+
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
17+
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
18+
CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
19+
AR = rtconfig.AR, ARFLAGS = '-rc',
20+
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
21+
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
22+
23+
# add --start-group and --end-group for GNU GCC
24+
env['LINKCOM'] = '$LINK -o $TARGET $LINKFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS -Wl,--start-group $_LIBFLAGS -Wl,--end-group'
25+
26+
Export('RTT_ROOT')
27+
Export('rtconfig')
28+
29+
# prepare building environment
30+
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
31+
32+
# make a building
33+
DoBuilding(TARGET, objs)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Import('RTT_ROOT')
2+
Import('rtconfig')
3+
from building import *
4+
5+
cwd = GetCurrentDir()
6+
src = Glob('*.c')
7+
CPPPATH = GetCurrentDir()
8+
9+
CCFLAGS = ' -c -ffunction-sections'
10+
11+
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH, CCFLAGS=CCFLAGS)
12+
13+
Return('group')
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2020-08-20 zx.chen first version
9+
*/
10+
11+
#include <rtthread.h>
12+
13+
int main(void)
14+
{
15+
16+
return 0;
17+
}
18+
19+
/*@}*/

bsp/thead-smart/drivers/SConscript

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Import('RTT_ROOT')
2+
Import('rtconfig')
3+
from building import *
4+
5+
cwd = GetCurrentDir()
6+
7+
# add the general drivers.
8+
src = Glob("*.c") + Glob("*.cpp") + Glob("*.S")
9+
10+
CPPPATH = [cwd]
11+
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
12+
13+
Return('group')

bsp/thead-smart/drivers/board.c

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright (c) 2006-2018, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2020-08-20 zx.chen add T-HEAD header file csi_core.h
9+
*/
10+
11+
#include <rthw.h>
12+
#include <rtthread.h>
13+
14+
#include "board.h"
15+
#include "csi_core.h"
16+
#include "drv_usart.h"
17+
18+
extern int __bss_end__;
19+
#define SYS_HEAP_BEGIN (&__bss_end__)
20+
21+
#include "core_rv32.h"
22+
23+
24+
extern usart_handle_t console_handle;
25+
extern void ioreuse_initial(void);
26+
27+
28+
/**
29+
* This function will initial smartl-evb(e906) board.
30+
*/
31+
void rt_hw_board_init(void)
32+
{
33+
#ifdef RT_USING_COMPONENTS_INIT
34+
rt_components_board_init();
35+
#endif
36+
/* initialize hardware usart */
37+
rt_hw_usart_init();
38+
39+
#ifdef RT_USING_CONSOLE
40+
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
41+
#endif
42+
43+
#ifdef RT_USING_HEAP
44+
rt_system_heap_init((void *)SYS_HEAP_BEGIN, (void *)E906FD_IRAM_END);
45+
#endif
46+
}
47+
48+
/*@}*/

bsp/thead-smart/drivers/board.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2020-08-20 zx.chen add E906 ram size
9+
*/
10+
11+
#ifndef __BOARD_H__
12+
#define __BOARD_H__
13+
14+
#define APB_DEFAULT_FREQ 20000000 /* Hz */
15+
#define E906FD_IRAM_SIZE 128
16+
#define E906FD_IRAM_END (0x20000000 + E906FD_IRAM_SIZE * 1024)
17+
18+
#endif /* __BOARD_H__ */

0 commit comments

Comments
 (0)