mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-10-02 14:23:19 +08:00
[bsp][phytium]适配rt-thread5.0.0 版本 (#7441)
Co-authored-by: 朱耿宇 <zhugengyu@phytium.com.cn>
This commit is contained in:
+11
-1
@@ -1 +1,11 @@
|
||||
*.dis
|
||||
*.dis
|
||||
*.asm
|
||||
/aarch32/tools/gnu_gcc/*
|
||||
/aarch32/tools/ci.py
|
||||
/aarch32/tools/get_toolchain.py
|
||||
/aarch32/smart-env.sh
|
||||
/aarch64/tools/gnu_gcc/*
|
||||
/aarch64/tools/ci.py
|
||||
/aarch64/tools/get_toolchain.py
|
||||
/aarch64/smart-env.sh
|
||||
**/**/makefile
|
||||
+79
-36
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -38,14 +38,14 @@ menu "Standalone Setting"
|
||||
config TARGET_ARMV8_AARCH32
|
||||
bool "Armv8 Aarch32"
|
||||
default y
|
||||
|
||||
|
||||
config USE_AARCH64_L1_TO_AARCH32
|
||||
bool
|
||||
prompt "Use Aarch64 L1 to Aarch32 code"
|
||||
default y
|
||||
help
|
||||
Use the Aarch64 to Aarch32 mode function
|
||||
|
||||
|
||||
source "$STANDALONE_DIR/board/Kconfig"
|
||||
source "$STANDALONE_DIR/drivers/Kconfig"
|
||||
source "$STANDALONE_DIR/common/Kconfig"
|
||||
|
||||
@@ -1,18 +1,48 @@
|
||||
|
||||
# AARCH32 工作模式使用
|
||||
|
||||
- 当开发者需要基于 Phytium 系列芯片进行开发时,可以从以下几个步骤出发配置芯片
|
||||
|
||||
## 1. 准备编译环境
|
||||
|
||||
## 1. 如何选择芯片
|
||||
- 在 aarch32 目录下创建 tools 目录,后续用于存放 RT-Thread 编译工具链
|
||||
|
||||
- Windows Env 环境下
|
||||
|
||||
```shell
|
||||
menuconfig
|
||||
```sh
|
||||
cd ./aarch32
|
||||
mkdir tools
|
||||
```
|
||||
|
||||
- Linux 环境下
|
||||
- 在 tools 目录下下载两个 python 脚本,get_toolchain.py 和 ci.py,下载完后给两个脚本添加执行权限
|
||||
|
||||
```shell
|
||||
cd ./tools
|
||||
wget https://gitee.com/rtthread/ART-Pi-smart/raw/master/tools/get_toolchain.py
|
||||
wget https://gitee.com/rtthread/ART-Pi-smart/raw/master/tools/ci.py
|
||||
chmod +x get_toolchain.py ci.py
|
||||
```
|
||||
|
||||
- 然后运行 get_toolchain.py 脚本,拉取 aarch32 交叉编译链`arm-linux-musleabi_for_x86_64-pc-linux-gnu`
|
||||
|
||||
```shell
|
||||
python3 ./get_toolchain.py arm
|
||||
```
|
||||
|
||||
> RT-Thread 5.0 后必须使用这个带 musl-libc 的编译链,不能使用`arm-none-eabi`
|
||||
|
||||
- 在 aarch32 目录下下载脚本 smart-env.sh ,然后运行脚本生效环境变量
|
||||
|
||||
```shell
|
||||
cd ./aarch32
|
||||
wget https://gitee.com/rtthread/ART-Pi-smart/raw/master/smart-env.sh
|
||||
source ./smart-env.sh arm
|
||||
```
|
||||
|
||||
- 如下所示是 aarch32 编译相关的环境变量,运行 scons 前要确保环境变量设置正确
|
||||
|
||||

|
||||
|
||||
## 2. 如何选择芯片
|
||||
|
||||
- 以 E2000Q RT-Smart为例,Linux 环境下,运行 make load_e2000q_rtsmart 加载默认的 rtconfig, 然后输入下列命令,进入 menuconfig 进一步配置,
|
||||
|
||||
```shell
|
||||
scons --menuconfig
|
||||
@@ -27,8 +57,7 @@ Standalone Setting > Board Configuration > Chip
|
||||

|
||||

|
||||
|
||||
## 2. 如何选择驱动
|
||||
|
||||
## 3. 如何选择驱动
|
||||
|
||||
```shell
|
||||
scons --menuconfig
|
||||
@@ -42,9 +71,7 @@ Hardware Drivers > On-chip Peripheral Drivers
|
||||
|
||||

|
||||
|
||||
|
||||
## 3. 开启SDK中内部调试信息
|
||||
|
||||
## 4. 开启SDK中内部调试信息
|
||||
|
||||
```shell
|
||||
scons --menuconfig
|
||||
@@ -55,8 +82,19 @@ Hardware Drivers > On-chip Peripheral Drivers
|
||||

|
||||
|
||||
|
||||
## 4. 如何切换至RT-Thread Smart 工作模式
|
||||
|
||||
## 4. 编译程序
|
||||
```shell
|
||||
|
||||
scons --menuconfig
|
||||
|
||||
```
|
||||
|
||||

|
||||
|
||||
开发者通过以上配置开启RT-Thread Smart 功能
|
||||
|
||||
## 5. 编译程序
|
||||
|
||||
```shell
|
||||
scons -c
|
||||
@@ -71,18 +109,36 @@ rtthread_a32.elf
|
||||
rtthread_a32.map
|
||||
```
|
||||
|
||||
## 5. 打包导出工程源代码
|
||||
## 6. 启动镜像程序
|
||||
|
||||
- 可以用串口通过 XMODEM 协议将 bin/elf 文件上传到开发板,然后启动,
|
||||
|
||||
- 首先在 Phytium 开发板上输入,上传 bin 文件
|
||||
|
||||
```
|
||||
loadx 80080000
|
||||
```
|
||||
|
||||

|
||||
|
||||
- 加载 bin 文件完成后,输入下列命令启动
|
||||
|
||||
```
|
||||
go 80080000
|
||||
```
|
||||
|
||||
## 7. 打包导出工程源代码
|
||||
|
||||
- 指定工程名和路径,打包RT-Thread内核和Phytium BSP代码,可以导出一个工程工程
|
||||
|
||||
```
|
||||
python ./export_project.py -n=phytium-a32 -o=D:/proj/rt-thread-e2000/phytium-a32
|
||||
```
|
||||
|
||||

|
||||
|
||||
- 进入打包工程的目录,修改工程根目录 Kconfig 中的路径 BSP_DIR 和 STANDALONE_DIR
|
||||
|
||||
- 进入打包工程的目录,修改工程根目录 Kconfig 中的路径 BSP_DIR 和 STANDALONE_DIR
|
||||
> env 环境中的 menuconfig 不会调用 SConstruct 修改路径环境变量,因此需要手动修改路径
|
||||
|
||||
```
|
||||
@@ -99,10 +155,12 @@ config STANDALONE_DIR
|
||||
|
||||
- 输入 menuconfig 和 scons 完成编译
|
||||
|
||||
## 8. 将工程导入 RT-Studio
|
||||
|
||||
## 6. 将工程导入 RT-Studio
|
||||
|
||||
- 在 RT-Studio 使用功能`RT-Thread Bsp 到工作空间`,导入 5. 中导出的 BSP 工程
|
||||
- 在 RT-Studio 使用功能 `RT-Thread Bsp 到工作空间`,导入 5. 中导出的 BSP 工程
|
||||
- 设置 BSP 工程的交叉编译链后进行后续开发
|
||||
|
||||

|
||||

|
||||
|
||||
python get_toolchain.py arm
|
||||
./smart-env.bat
|
||||
|
||||
@@ -53,6 +53,11 @@ if not IS_EXPORTED: # if project is not exported, libraries and board need to ma
|
||||
# include board
|
||||
objs.extend(SConscript(os.path.join(BSP_ROOT + '/board', 'SConscript')))
|
||||
|
||||
|
||||
if GetDepend('RT_USING_SMART'):
|
||||
# use smart link.lds
|
||||
env['LINKFLAGS'] = env['LINKFLAGS'].replace('link.lds', 'link_smart.lds')
|
||||
|
||||
# make a building
|
||||
DoBuilding(TARGET, objs)
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ void demo_core(void)
|
||||
int main(void)
|
||||
{
|
||||
#ifdef RT_USING_SMP
|
||||
demo_core();
|
||||
// demo_core();
|
||||
#endif
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Email: opensource_embedded@phytium.com.cn
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2023-04-27 huanghe first version
|
||||
*
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#ifdef RT_USING_DFS_RAMFS
|
||||
#include <dfs_fs.h>
|
||||
|
||||
extern struct dfs_ramfs *dfs_ramfs_create(rt_uint8_t *pool, rt_size_t size);
|
||||
|
||||
int mnt_init(void)
|
||||
{
|
||||
rt_uint8_t *pool = RT_NULL;
|
||||
rt_size_t size = 8*1024*1024;
|
||||
|
||||
pool = rt_malloc(size);
|
||||
if (pool == RT_NULL)
|
||||
return 0;
|
||||
|
||||
if (dfs_mount(RT_NULL, "/", "ram", 0, (const void *)dfs_ramfs_create(pool, size)) == 0)
|
||||
rt_kprintf("RAM file system initializated!\n");
|
||||
else
|
||||
rt_kprintf("RAM file system initializate failed!\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
INIT_ENV_EXPORT(mnt_init);
|
||||
#endif
|
||||
|
||||
#ifdef BSP_USING_SDCARD_FATFS
|
||||
#include <dfs_fs.h>
|
||||
#include <dfs_file.h>
|
||||
#define DBG_TAG "app.filesystem"
|
||||
#define DBG_LVL DBG_INFO
|
||||
#include <rtdbg.h>
|
||||
static int filesystem_mount(void)
|
||||
{
|
||||
while(rt_device_find("sd0") == RT_NULL)
|
||||
{
|
||||
rt_thread_mdelay(1);
|
||||
}
|
||||
|
||||
int ret = dfs_mount("sd0", "/", "elm", 0, 0);
|
||||
if (ret != 0)
|
||||
{
|
||||
rt_kprintf("ret: %d\n",ret);
|
||||
LOG_E("sd0 mount to '/' failed!");
|
||||
return ret;
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
INIT_ENV_EXPORT(filesystem_mount);
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,18 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (c) 2022, RT-Thread Development Team
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Email: opensource_embedded@phytium.com.cn
|
||||
#
|
||||
#
|
||||
# Change Logs:
|
||||
# Date Author Notes
|
||||
# 2022-11-15 zhugengyu The first version
|
||||
#
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import argparse
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 156 KiB |
@@ -5,18 +5,25 @@ ENTRY(_boot)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x80100000;
|
||||
. = 0x80080000;
|
||||
|
||||
.text :
|
||||
{
|
||||
|
||||
*(.boot)
|
||||
. = ALIGN(64);
|
||||
|
||||
|
||||
*(.vectors)
|
||||
*(.text)
|
||||
*(.text.*)
|
||||
|
||||
/* section information for utest */
|
||||
. = ALIGN(4);
|
||||
__rt_utest_tc_tab_start = .;
|
||||
KEEP(*(UtestTcTab))
|
||||
__rt_utest_tc_tab_end = .;
|
||||
|
||||
|
||||
/* section information for finsh shell */
|
||||
. = ALIGN(4);
|
||||
__fsymtab_start = .;
|
||||
@@ -42,6 +49,13 @@ SECTIONS
|
||||
} =0
|
||||
__text_end = .;
|
||||
|
||||
.ARM.exidx :
|
||||
{
|
||||
__exidx_start = .;
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
__exidx_end = .;
|
||||
}
|
||||
|
||||
__rodata_start = .;
|
||||
.rodata : { *(.rodata) *(.rodata.*) }
|
||||
__rodata_end = .;
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||
OUTPUT_ARCH(arm)
|
||||
|
||||
ENTRY(_boot)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
/* . = 0x80080000; */
|
||||
. = 0xc0080000;
|
||||
|
||||
.text :
|
||||
{
|
||||
|
||||
*(.boot)
|
||||
. = ALIGN(64);
|
||||
|
||||
*(.vectors)
|
||||
*(.text)
|
||||
*(.text.*)
|
||||
|
||||
/* section information for utest */
|
||||
. = ALIGN(4);
|
||||
__rt_utest_tc_tab_start = .;
|
||||
KEEP(*(UtestTcTab))
|
||||
__rt_utest_tc_tab_end = .;
|
||||
|
||||
|
||||
/* section information for finsh shell */
|
||||
. = ALIGN(4);
|
||||
__fsymtab_start = .;
|
||||
KEEP(*(FSymTab))
|
||||
__fsymtab_end = .;
|
||||
. = ALIGN(4);
|
||||
__vsymtab_start = .;
|
||||
KEEP(*(VSymTab))
|
||||
__vsymtab_end = .;
|
||||
. = ALIGN(4);
|
||||
|
||||
/* section information for modules */
|
||||
. = ALIGN(4);
|
||||
__rtmsymtab_start = .;
|
||||
KEEP(*(RTMSymTab))
|
||||
__rtmsymtab_end = .;
|
||||
|
||||
/* section information for initialization */
|
||||
. = ALIGN(4);
|
||||
__rt_init_start = .;
|
||||
KEEP(*(SORT(.rti_fn*)))
|
||||
__rt_init_end = .;
|
||||
} =0
|
||||
__text_end = .;
|
||||
|
||||
.ARM.exidx :
|
||||
{
|
||||
__exidx_start = .;
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
__exidx_end = .;
|
||||
}
|
||||
|
||||
__rodata_start = .;
|
||||
.rodata : { *(.rodata) *(.rodata.*) }
|
||||
__rodata_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
.ctors :
|
||||
{
|
||||
PROVIDE(__ctors_start__ = .);
|
||||
/* new GCC version uses .init_array */
|
||||
KEEP(*(SORT(.init_array.*)))
|
||||
KEEP(*(.init_array))
|
||||
PROVIDE(__ctors_end__ = .);
|
||||
}
|
||||
|
||||
.dtors :
|
||||
{
|
||||
PROVIDE(__dtors_start__ = .);
|
||||
KEEP(*(SORT(.dtors.*)))
|
||||
KEEP(*(.dtors))
|
||||
PROVIDE(__dtors_end__ = .);
|
||||
}
|
||||
|
||||
. = ALIGN(16 * 1024);
|
||||
.l1_page_table :
|
||||
{
|
||||
__l1_page_table_start = .;
|
||||
. += 16K;
|
||||
}
|
||||
|
||||
. = ALIGN(8);
|
||||
__data_start = .;
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
}
|
||||
__data_end = .;
|
||||
|
||||
. = ALIGN(8);
|
||||
__bss_start = .;
|
||||
.bss :
|
||||
{
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
}
|
||||
. = ALIGN(4);
|
||||
__bss_end = .;
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
|
||||
_end = .;
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
.PHONY: debug boot all clean menuconfig
|
||||
|
||||
CC = $(RTT_EXEC_PATH)/$(RTT_CC_PREFIX)gcc
|
||||
CXX = $(RTT_EXEC_PATH)/$(RTT_CC_PREFIX)g++
|
||||
CPP = $(RTT_EXEC_PATH)/$(RTT_CC_PREFIX)gcc -E -P -x c
|
||||
STRIP = $(RTT_EXEC_PATH)/$(RTT_CC_PREFIX)strip --strip-unneeded
|
||||
OBJCOPY = $(RTT_EXEC_PATH)/$(RTT_CC_PREFIX)objcopy
|
||||
OBJDUMP = $(RTT_EXEC_PATH)/$(RTT_CC_PREFIX)objdump
|
||||
LD = $(RTT_EXEC_PATH)/$(RTT_CC_PREFIX)ld
|
||||
AR = $(RTT_EXEC_PATH)/$(RTT_CC_PREFIX)ar rcs
|
||||
NM = $(RTT_EXEC_PATH)/$(RTT_CC_PREFIX)nm
|
||||
OD = $(RTT_EXEC_PATH)/$(RTT_CC_PREFIX)objdump
|
||||
|
||||
include .config
|
||||
|
||||
ifdef CONFIG_TARGET_E2000Q
|
||||
RTCONFIG := e2000q
|
||||
endif
|
||||
|
||||
ifdef CONFIG_TARGET_E2000D
|
||||
RTCONFIG := e2000d
|
||||
endif
|
||||
|
||||
ifdef CONFIG_RT_USING_SMART
|
||||
RTCONFIG := $(RTCONFIG)_rtsmart
|
||||
else
|
||||
RTCONFIG := $(RTCONFIG)_rtthread
|
||||
endif
|
||||
|
||||
boot:
|
||||
make all
|
||||
cp rtthread_a32.elf /mnt/d/tftboot
|
||||
cp rtthread_a32.bin /mnt/d/tftboot
|
||||
|
||||
debug:
|
||||
@$(OD) -D rtthread_a32.elf > rtthread_a32.asm
|
||||
@$(OD) -S rtthread_a32.elf > rtthread_a32.dis
|
||||
|
||||
all:
|
||||
@echo "Build started..."
|
||||
scons -j1024
|
||||
|
||||
clean:
|
||||
@echo "Cleaning..."
|
||||
scons -c
|
||||
|
||||
menuconfig:
|
||||
@echo "Running menuconfig..."
|
||||
scons --menuconfig
|
||||
|
||||
saveconfig:
|
||||
@echo "Save configs to" ./configs/$(RTCONFIG)
|
||||
@cp ./.config ./configs/$(RTCONFIG) -f
|
||||
@cp ./rtconfig.h ./configs/$(RTCONFIG).h -f
|
||||
|
||||
load_e2000q_rtsmart:
|
||||
@echo "Load configs from ./configs/e2000q_rtsmart"
|
||||
@cp ./configs/e2000q_rtsmart ./.config -f
|
||||
@cp ./configs/e2000q_rtsmart.h ./rtconfig.h -f
|
||||
@scons -c
|
||||
|
||||
load_e2000q_rtthread:
|
||||
@echo "Load configs from ./configs/e2000q_rtthread"
|
||||
@cp ./configs/e2000q_rtthread ./.config -f
|
||||
@cp ./configs/e2000q_rtthread.h ./rtconfig.h -f
|
||||
@scons -c
|
||||
|
||||
load_e2000d_rtsmart:
|
||||
@echo "Load configs from ./configs/e2000d_rtsmart"
|
||||
@cp ./configs/e2000d_rtsmart ./.config -f
|
||||
@cp ./configs/e2000d_rtsmart.h ./rtconfig.h -f
|
||||
@scons -c
|
||||
|
||||
load_e2000d_rtthread:
|
||||
@echo "Load configs from ./configs/e2000d_rtthread"
|
||||
@cp ./configs/e2000d_rtthread ./.config -f
|
||||
@cp ./configs/e2000d_rtthread.h ./rtconfig.h -f
|
||||
scons -c
|
||||
@@ -6,10 +6,11 @@
|
||||
|
||||
/* RT-Thread Kernel */
|
||||
|
||||
#define RT_NAME_MAX 8
|
||||
#define RT_NAME_MAX 16
|
||||
#define RT_USING_SMART
|
||||
#define RT_USING_SMP
|
||||
#define RT_CPUS_NR 4
|
||||
#define RT_ALIGN_SIZE 8
|
||||
#define RT_CPUS_NR 2
|
||||
#define RT_ALIGN_SIZE 4
|
||||
#define RT_THREAD_PRIORITY_32
|
||||
#define RT_THREAD_PRIORITY_MAX 32
|
||||
#define RT_TICK_PER_SECOND 1000
|
||||
@@ -18,15 +19,16 @@
|
||||
#define RT_HOOK_USING_FUNC_PTR
|
||||
#define RT_USING_IDLE_HOOK
|
||||
#define RT_IDLE_HOOK_LIST_SIZE 4
|
||||
#define IDLE_THREAD_STACK_SIZE 256
|
||||
#define SYSTEM_THREAD_STACK_SIZE 256
|
||||
#define IDLE_THREAD_STACK_SIZE 4096
|
||||
#define SYSTEM_THREAD_STACK_SIZE 4096
|
||||
#define RT_USING_TIMER_SOFT
|
||||
#define RT_TIMER_THREAD_PRIO 4
|
||||
#define RT_TIMER_THREAD_STACK_SIZE 512
|
||||
#define RT_TIMER_THREAD_STACK_SIZE 4096
|
||||
|
||||
/* kservice optimization */
|
||||
|
||||
#define RT_KSERVICE_USING_STDLIB
|
||||
#define RT_KPRINTF_USING_LONGLONG
|
||||
#define RT_DEBUG
|
||||
|
||||
/* Inter-Thread communication */
|
||||
@@ -42,6 +44,8 @@
|
||||
#define RT_PAGE_MAX_ORDER 11
|
||||
#define RT_USING_MEMPOOL
|
||||
#define RT_USING_SMALL_MEM
|
||||
#define RT_USING_MEMHEAP
|
||||
#define RT_MEMHEAP_FAST_MODE
|
||||
#define RT_USING_SMALL_MEM_AS_HEAP
|
||||
#define RT_USING_HEAP
|
||||
|
||||
@@ -49,15 +53,16 @@
|
||||
|
||||
#define RT_USING_DEVICE
|
||||
#define RT_USING_CONSOLE
|
||||
#define RT_CONSOLEBUF_SIZE 128
|
||||
#define RT_CONSOLEBUF_SIZE 256
|
||||
#define RT_CONSOLE_DEVICE_NAME "uart1"
|
||||
#define RT_VER_NUM 0x50000
|
||||
#define RT_VER_NUM 0x50001
|
||||
#define RT_USING_CACHE
|
||||
#define RT_USING_HW_ATOMIC
|
||||
#define RT_USING_CPU_FFS
|
||||
#define ARCH_MM_MMU
|
||||
#define ARCH_ARM
|
||||
#define ARCH_ARM_MMU
|
||||
#define KERNEL_VADDR_START 0xc0000000
|
||||
#define ARCH_ARM_CORTEX_A
|
||||
#define RT_USING_GIC_V3
|
||||
|
||||
@@ -65,7 +70,7 @@
|
||||
|
||||
#define RT_USING_COMPONENTS_INIT
|
||||
#define RT_USING_USER_MAIN
|
||||
#define RT_MAIN_THREAD_STACK_SIZE 2048
|
||||
#define RT_MAIN_THREAD_STACK_SIZE 8192
|
||||
#define RT_MAIN_THREAD_PRIORITY 10
|
||||
#define RT_USING_MSH
|
||||
#define RT_USING_FINSH
|
||||
@@ -80,22 +85,43 @@
|
||||
#define MSH_USING_BUILT_IN_COMMANDS
|
||||
#define FINSH_USING_DESCRIPTION
|
||||
#define FINSH_ARG_MAX 10
|
||||
|
||||
/* DFS: device virtual file system */
|
||||
|
||||
#define RT_USING_DFS
|
||||
#define DFS_USING_POSIX
|
||||
#define DFS_USING_WORKDIR
|
||||
#define DFS_FD_MAX 16
|
||||
#define RT_USING_DFS_V1
|
||||
#define DFS_FILESYSTEMS_MAX 4
|
||||
#define DFS_FILESYSTEM_TYPES_MAX 4
|
||||
#define DFS_FD_MAX 16
|
||||
#define RT_USING_DFS_DEVFS
|
||||
#define RT_USING_DFS_RAMFS
|
||||
#define RT_USING_LWP
|
||||
#define RT_LWP_MAX_NR 30
|
||||
#define LWP_TASK_STACK_SIZE 16384
|
||||
#define RT_CH_MSG_MAX_NR 1024
|
||||
#define LWP_CONSOLE_INPUT_BUFFER_SIZE 1024
|
||||
#define LWP_TID_MAX_NR 64
|
||||
#define LWP_ENABLE_ASID
|
||||
#define RT_LWP_SHM_MAX_NR 64
|
||||
|
||||
/* Device Drivers */
|
||||
|
||||
#define RT_USING_DEVICE_IPC
|
||||
#define RT_UNAMED_PIPE_NUMBER 64
|
||||
#define RT_USING_SYSTEM_WORKQUEUE
|
||||
#define RT_SYSTEM_WORKQUEUE_STACKSIZE 4096
|
||||
#define RT_SYSTEM_WORKQUEUE_PRIORITY 23
|
||||
#define RT_USING_SERIAL
|
||||
#define RT_USING_SERIAL_V1
|
||||
#define RT_SERIAL_USING_DMA
|
||||
#define RT_SERIAL_RB_BUFSZ 64
|
||||
#define RT_USING_PIN
|
||||
#define RT_SERIAL_RB_BUFSZ 1024
|
||||
#define RT_USING_TTY
|
||||
#define RT_USING_NULL
|
||||
#define RT_USING_ZERO
|
||||
#define RT_USING_RANDOM
|
||||
#define RT_USING_RTC
|
||||
|
||||
/* Using USB */
|
||||
|
||||
@@ -106,9 +132,23 @@
|
||||
|
||||
/* POSIX (Portable Operating System Interface) layer */
|
||||
|
||||
#define RT_USING_POSIX_FS
|
||||
#define RT_USING_POSIX_DEVIO
|
||||
#define RT_USING_POSIX_STDIO
|
||||
#define RT_USING_POSIX_POLL
|
||||
#define RT_USING_POSIX_SELECT
|
||||
#define RT_USING_POSIX_TERMIOS
|
||||
#define RT_USING_POSIX_AIO
|
||||
#define RT_USING_POSIX_DELAY
|
||||
#define RT_USING_POSIX_CLOCK
|
||||
#define RT_USING_POSIX_TIMER
|
||||
|
||||
/* Interprocess Communication (IPC) */
|
||||
|
||||
#define RT_USING_POSIX_PIPE
|
||||
#define RT_USING_POSIX_PIPE_SIZE 512
|
||||
#define RT_USING_POSIX_MESSAGE_QUEUE
|
||||
#define RT_USING_POSIX_MESSAGE_SEMAPHORE
|
||||
|
||||
/* Socket is in the 'Network' category */
|
||||
|
||||
@@ -118,6 +158,11 @@
|
||||
|
||||
/* Utilities */
|
||||
|
||||
#define RT_USING_RYM
|
||||
#define YMODEM_USING_FILE_TRANSFER
|
||||
#define RT_USING_UTEST
|
||||
#define UTEST_THR_STACK_SIZE 4096
|
||||
#define UTEST_THR_PRIORITY 20
|
||||
#define RT_USING_ADT
|
||||
|
||||
/* RT-Thread Utestcases */
|
||||
@@ -254,7 +299,7 @@
|
||||
|
||||
/* Board Configuration */
|
||||
|
||||
#define TARGET_E2000Q
|
||||
#define TARGET_E2000D
|
||||
#define TARGET_E2000
|
||||
#define DEFAULT_DEBUG_PRINT_UART1
|
||||
|
||||
|
||||
@@ -2,67 +2,53 @@ import os
|
||||
import rtconfig
|
||||
|
||||
# toolchains options
|
||||
ARCH='arm'
|
||||
CPU='cortex-a'
|
||||
CROSS_TOOL='gcc'
|
||||
|
||||
if os.getenv('RTT_ROOT'):
|
||||
RTT_ROOT = os.getenv('RTT_ROOT')
|
||||
else:
|
||||
RTT_ROOT = r'../../..'
|
||||
|
||||
if os.getenv('RTT_CC'):
|
||||
CROSS_TOOL = os.getenv('RTT_CC')
|
||||
|
||||
# only support GNU GCC compiler.
|
||||
ARCH ='arm'
|
||||
CPU ='cortex-a'
|
||||
CROSS_TOOL = 'gcc'
|
||||
PLATFORM = 'gcc'
|
||||
EXEC_PATH = r'/usr/lib/arm-none-eabi/bin'
|
||||
if os.getenv('AARCH32_CROSS_PATH'):
|
||||
EXEC_PATH = os.getenv('AARCH32_CROSS_PATH')
|
||||
print('EXEC_PATH = {}'.format(EXEC_PATH))
|
||||
else:
|
||||
print('AARCH32_CROSS_PATH not found')
|
||||
EXEC_PATH = os.getenv('RTT_EXEC_PATH') or r'/usr/bin'
|
||||
BUILD = 'debug'
|
||||
|
||||
BUILD = 'debug'
|
||||
LINK_SCRIPT = 'link.lds'
|
||||
|
||||
LIBPATH = EXEC_PATH + r'/../lib'
|
||||
|
||||
if PLATFORM == 'gcc':
|
||||
# toolchains
|
||||
PREFIX = 'arm-none-eabi-'
|
||||
CC = PREFIX + 'gcc'
|
||||
CXX = PREFIX + 'g++'
|
||||
AS = PREFIX + 'gcc'
|
||||
AR = PREFIX + 'ar'
|
||||
LINK = PREFIX + 'gcc'
|
||||
PREFIX = os.getenv('RTT_CC_PREFIX') or 'arm-none-eabi-'
|
||||
CC = PREFIX + 'gcc'
|
||||
CXX = PREFIX + 'g++'
|
||||
AS = PREFIX + 'gcc'
|
||||
AR = PREFIX + 'ar'
|
||||
LINK = PREFIX + 'gcc'
|
||||
TARGET_EXT = 'elf'
|
||||
SIZE = PREFIX + 'size'
|
||||
SIZE = PREFIX + 'size'
|
||||
OBJDUMP = PREFIX + 'objdump'
|
||||
OBJCPY = PREFIX + 'objcopy'
|
||||
STRIP = PREFIX + 'strip'
|
||||
OBJCPY = PREFIX + 'objcopy'
|
||||
STRIP = PREFIX + 'strip'
|
||||
CFPFLAGS = ' -msoft-float'
|
||||
AFPFLAGS = ' -mfloat-abi=softfp -mfpu=neon'
|
||||
DEVICE = ' -march=armv8-a -ftree-vectorize -ffast-math -funwind-tables -fno-strict-aliasing'
|
||||
|
||||
DEVICE = ' -g -DGUEST -ffreestanding -Wextra -g -mfpu=crypto-neon-fp-armv8 -mfloat-abi=softfp -march=armv8-a -fdiagnostics-color=always'
|
||||
|
||||
# CFLAGS = DEVICE + ' -Wall'
|
||||
CFLAGS = DEVICE
|
||||
AFLAGS = ' -c'+ DEVICE + ' -fsingle-precision-constant -fno-builtin -x assembler-with-cpp -D__ASSEMBLY__'
|
||||
LINK_SCRIPT = 'link.lds'
|
||||
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread_a32.map,-cref,-u,system_vectors'+\
|
||||
' -T %s' % LINK_SCRIPT
|
||||
|
||||
CPATH = ''
|
||||
LPATH = LIBPATH
|
||||
|
||||
# generate debug info in all cases
|
||||
AFLAGS += ' -gdwarf-2'
|
||||
CFLAGS += ' -g -gdwarf-2'
|
||||
CXXFLAGS= DEVICE + CFPFLAGS + ' -Wall -fdiagnostics-color=always'
|
||||
CFLAGS = DEVICE + CFPFLAGS + ' -Wall -Wno-cpp -std=gnu99 -D_POSIX_SOURCE -fdiagnostics-color=always'
|
||||
AFLAGS = DEVICE + ' -c' + AFPFLAGS + ' -x assembler-with-cpp'
|
||||
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread_a32.map,-cref,-u,system_vectors -T '+ LINK_SCRIPT + ' -lsupc++ -lgcc -static'
|
||||
CPATH = ''
|
||||
LPATH = ''
|
||||
|
||||
if BUILD == 'debug':
|
||||
CFLAGS += ' -O0'
|
||||
CFLAGS += ' -O0 -gdwarf-2'
|
||||
CXXFLAGS += ' -O0 -gdwarf-2'
|
||||
AFLAGS += ' -gdwarf-2'
|
||||
else:
|
||||
CFLAGS += ' -O2'
|
||||
CFLAGS += ' -Os'
|
||||
CXXFLAGS += ' -Os'
|
||||
CXXFLAGS += ' -Woverloaded-virtual -fno-rtti'
|
||||
|
||||
CXXFLAGS = CFLAGS
|
||||
M_CFLAGS = CFLAGS + ' -mlong-calls -fPIC '
|
||||
M_CXXFLAGS = CXXFLAGS + ' -mlong-calls -fPIC'
|
||||
M_LFLAGS = DEVICE + CXXFLAGS + ' -Wl,--gc-sections,-z,max-page-size=0x4' +\
|
||||
' -shared -fPIC -nostartfiles -nostdlib -static-libgcc'
|
||||
M_POST_ACTION = STRIP + ' -R .hash $TARGET\n' + SIZE + ' $TARGET \n'
|
||||
|
||||
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread_a32.bin\n' +\
|
||||
SIZE + ' $TARGET \n'
|
||||
DUMP_ACTION = OBJDUMP + ' -D -S $TARGET > rtthread_a32.asm\n'
|
||||
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread_a32.bin\n' + SIZE + ' $TARGET \n'
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* Copyright : (C) 2022 Phytium Information Technology, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This program is OPEN SOURCE software: you can redistribute it and/or modify it
|
||||
* under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd,
|
||||
* either version 1.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the Phytium Public License for more details.
|
||||
*
|
||||
*
|
||||
* FilePath: sdkconfig.h
|
||||
* Date: 2022-10-13 15:53:46
|
||||
* LastEditTime: 2022-10-13 15:53:46
|
||||
* Description: This file is for
|
||||
*
|
||||
* Modify History:
|
||||
* Ver Who Date Changes
|
||||
* ----- ------ -------- --------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef SDK_CONFIG_H__
|
||||
#define SDK_CONFIG_H__
|
||||
|
||||
#include "rtconfig.h"
|
||||
|
||||
|
||||
/* arch */
|
||||
|
||||
#if defined(TARGET_ARMV8_AARCH32)
|
||||
#define CONFIG_TARGET_ARMV8_AARCH32
|
||||
#endif
|
||||
|
||||
#if defined(USE_AARCH64_L1_TO_AARCH32)
|
||||
#define CONFIG_USE_AARCH64_L1_TO_AARCH32
|
||||
#endif
|
||||
|
||||
/* board */
|
||||
|
||||
/* E2000 */
|
||||
|
||||
#if defined(TARGET_E2000)
|
||||
#define CONFIG_TARGET_E2000
|
||||
#endif
|
||||
|
||||
|
||||
/* debug */
|
||||
|
||||
#ifdef LOG_VERBOS
|
||||
#define CONFIG_LOG_VERBOS
|
||||
#endif
|
||||
|
||||
#ifdef LOG_ERROR
|
||||
#define CONFIG_LOG_ERROR
|
||||
#endif
|
||||
|
||||
#ifdef LOG_WARN
|
||||
#define CONFIG_LOG_WARN
|
||||
#endif
|
||||
|
||||
#ifdef LOG_INFO
|
||||
#define CONFIG_LOG_INFO
|
||||
#endif
|
||||
|
||||
#ifdef LOG_DEBUG
|
||||
#define CONFIG_LOG_DEBUG
|
||||
#endif
|
||||
|
||||
#ifdef BOOTUP_DEBUG_PRINTS
|
||||
#define CONFIG_BOOTUP_DEBUG_PRINTS
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+86
-30
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -38,7 +38,21 @@ config PHYTIUM_ARCH_AARCH64
|
||||
select RT_USING_USER_MAIN
|
||||
select ARCH_CPU_64BIT
|
||||
select TARGET_ARMV8_AARCH64
|
||||
select ARCH_ARM_BOOTWITH_FLUSH_CACHE
|
||||
default y
|
||||
|
||||
|
||||
if TARGET_E2000Q
|
||||
config ARM_SPI_BIND_CPU_ID
|
||||
int
|
||||
default 2
|
||||
endif
|
||||
|
||||
if TARGET_E2000D
|
||||
config ARM_SPI_BIND_CPU_ID
|
||||
int
|
||||
default 0
|
||||
endif
|
||||
|
||||
menu "Standalone Setting"
|
||||
config TARGET_ARMV8_AARCH64
|
||||
|
||||
@@ -1,31 +1,52 @@
|
||||
<!--
|
||||
* Copyright : (C) 2022 Phytium Information Technology, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This program is OPEN SOURCE software: you can redistribute it and/or modify it
|
||||
* under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd,
|
||||
* either version 1.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the Phytium Public License for more details.
|
||||
*
|
||||
*
|
||||
* FilePath: README.md
|
||||
* Date: 2022-10-17 15:16:12
|
||||
* LastEditTime: 2022-10-17 15:16:12
|
||||
* Description: This file is for
|
||||
*
|
||||
* Modify History:
|
||||
* Ver Who Date Changes
|
||||
* ----- ------ -------- --------------------------------------
|
||||
-->
|
||||
|
||||
# AARCH64 工作模式使用
|
||||
|
||||
- 当开发者需要基于 Phytium 系列芯片进行开发时,可以从以下几个步骤出发配置芯片
|
||||
|
||||
## 1. 如何选择芯片
|
||||
## 1. 准备编译环境
|
||||
|
||||
- 在 aarch64 目录下创建 tools 目录,后续用于存放 RT-Thread 编译工具链
|
||||
|
||||
```sh
|
||||
cd ./aarch64
|
||||
mkdir tools
|
||||
```
|
||||
|
||||
- 在 tools 目录下下载两个 python 脚本,get_toolchain.py 和 ci.py,下载完后给两个脚本添加执行权限
|
||||
|
||||
```shell
|
||||
cd ./tools
|
||||
wget https://gitee.com/rtthread/ART-Pi-smart/raw/master/tools/get_toolchain.py
|
||||
wget https://gitee.com/rtthread/ART-Pi-smart/raw/master/tools/ci.py
|
||||
chmod +x get_toolchain.py ci.py
|
||||
```
|
||||
|
||||
- 然后运行 get_toolchain.py 脚本,拉取 aarch64 交叉编译链`aarch64-linux-musleabi_for_x86_64-pc-linux-gnu`
|
||||
|
||||
```shell
|
||||
python3 ./get_toolchain.py aarch64
|
||||
```
|
||||
|
||||
> RT-Thread 5.0 后必须使用这个带 musl-libc 的编译链,不能使用`aarch64-none-elf`
|
||||
|
||||
- 在 aarch64 目录下下载脚本 smart_env.sh ,然后运行脚本生效环境变量
|
||||
|
||||
```shell
|
||||
cd ./aarch64
|
||||
wget https://gitee.com/rtthread/ART-Pi-smart/raw/master/smart-env.sh
|
||||
source ./smart-env.sh aarch64
|
||||
```
|
||||
|
||||
- 如下所示是 aarch64 编译相关的环境变量,运行 scons 前要确保环境变量设置正确
|
||||
|
||||

|
||||
|
||||
## NOTE
|
||||
|
||||
- 请使用ubuntu20.04 开发环境进行上述操作,其他开发环境没有进行测试
|
||||
|
||||
## 2. 如何选择芯片
|
||||
|
||||
- 以 E2000Q RT-Smart为例,Linux 环境下,运行 make load_e2000q_rtsmart 加载默认的 rtconfig, 然后输入下列命令,进入 menuconfig 进一步配置,
|
||||
|
||||
```shell
|
||||
scons --menuconfig
|
||||
@@ -40,8 +61,7 @@ Standalone Setting > Board Configuration > Chip
|
||||

|
||||

|
||||
|
||||
## 2. 如何选择驱动
|
||||
|
||||
## 3. 如何选择驱动
|
||||
|
||||
```shell
|
||||
scons --menuconfig
|
||||
@@ -55,9 +75,17 @@ Hardware Drivers Config > On-chip Peripheral Drivers
|
||||
|
||||

|
||||
|
||||
## 4. 如何切换至RT-Thread Smart 工作模式
|
||||
|
||||
## 3. 开启SDK中内部调试信息
|
||||
```shell
|
||||
scons --menuconfig
|
||||
```
|
||||
|
||||

|
||||
|
||||
开发者通过以上配置开启RT-Thread Smart 功能
|
||||
|
||||
## 5. 开启SDK中内部调试信息
|
||||
|
||||
```shell
|
||||
scons --menuconfig
|
||||
@@ -67,9 +95,7 @@ Hardware Drivers Config > On-chip Peripheral Drivers
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
## 4. 编译程序
|
||||
## 6. 编译程序
|
||||
|
||||
```shell
|
||||
scons -c
|
||||
@@ -84,18 +110,38 @@ rtthread_a64.elf
|
||||
rtthread_a64.map
|
||||
```
|
||||
|
||||
## 5. 打包导出工程源代码
|
||||
## 7. 启动镜像程序
|
||||
|
||||
- 可以用串口通过 XMODEM 协议将 bin/elf 文件上传到开发板,然后启动,
|
||||
|
||||
- 首先在 Phytium 开发板上输入,上传 bin 文件
|
||||
|
||||
```
|
||||
loadx 80080000
|
||||
```
|
||||
|
||||

|
||||
|
||||
- 加载 bin 文件完成后,输入下列命令启动
|
||||
|
||||
```
|
||||
go 80080000
|
||||
```
|
||||
|
||||
> RT-Smart 模式下,64 位不能用 bootelf 启动 elf 文件
|
||||
|
||||
## 8. 打包导出工程源代码
|
||||
|
||||
- 指定工程名和路径,打包RT-Thread内核和Phytium BSP代码,可以导出一个工程工程
|
||||
|
||||
```
|
||||
python ./export_project.py -n=phytium-a64 -o=D:/proj/rt-thread-e2000/phytium-a64
|
||||
```
|
||||
|
||||

|
||||
|
||||
- 进入打包工程的目录,修改工程根目录 Kconfig 中的路径 BSP_DIR 和 STANDALONE_DIR
|
||||
|
||||
- 进入打包工程的目录,修改工程根目录 Kconfig 中的路径 BSP_DIR 和 STANDALONE_DIR
|
||||
> env 环境中的 menuconfig 不会调用 SConstruct 修改路径环境变量,因此需要手动修改路径
|
||||
|
||||
```
|
||||
@@ -112,10 +158,9 @@ config STANDALONE_DIR
|
||||
|
||||
- 输入 menuconfig 和 scons 完成编译
|
||||
|
||||
## 9. 将工程导入 RT-Studio
|
||||
|
||||
## 6. 将工程导入 RT-Studio
|
||||
|
||||
- 在 RT-Studio 使用功能`RT-Thread Bsp 到工作空间`,导入 5. 中导出的 BSP 工程
|
||||
- 在 RT-Studio 使用功能 `RT-Thread Bsp 到工作空间`,导入 5. 中导出的 BSP 工程
|
||||
- 设置 BSP 工程的交叉编译链后进行后续开发
|
||||
|
||||

|
||||

|
||||
|
||||
@@ -53,6 +53,10 @@ if not IS_EXPORTED: # if project is not exported, libraries and board need to ma
|
||||
# include board
|
||||
objs.extend(SConscript(os.path.join(BSP_ROOT + '/board', 'SConscript')))
|
||||
|
||||
if GetDepend('RT_USING_SMART'):
|
||||
# use smart link.lds
|
||||
env['LINKFLAGS'] = env['LINKFLAGS'].replace('link.lds', 'link_smart.lds')
|
||||
|
||||
# make a building
|
||||
DoBuilding(TARGET, objs)
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ Import('rtconfig')
|
||||
from building import *
|
||||
|
||||
cwd = os.path.join(str(Dir('#')), 'applications')
|
||||
src = Glob('*.c')
|
||||
src = Glob('*.c')
|
||||
CPPPATH = [cwd, str(Dir('#'))]
|
||||
|
||||
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
@@ -30,7 +30,7 @@ static char *core_thread_name[8] =
|
||||
"core6_test",
|
||||
"core7_test"
|
||||
};
|
||||
static rt_uint8_t core_stack[RT_CPUS_NR][1024];
|
||||
static rt_uint8_t core_stack[RT_CPUS_NR][4096];
|
||||
|
||||
static void demo_core_thread(void *parameter)
|
||||
{
|
||||
@@ -41,7 +41,7 @@ static void demo_core_thread(void *parameter)
|
||||
level = rt_cpus_lock();
|
||||
rt_kprintf("Hi, core%d \r\n", rt_hw_cpu_id());
|
||||
rt_cpus_unlock(level);
|
||||
rt_thread_mdelay(2000000);
|
||||
rt_thread_mdelay(200000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ void demo_core(void)
|
||||
demo_core_thread,
|
||||
RT_NULL,
|
||||
&core_stack[i],
|
||||
1024,
|
||||
4096,
|
||||
20,
|
||||
32);
|
||||
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Email: opensource_embedded@phytium.com.cn
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2023-04-27 huanghe first version
|
||||
*
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#ifdef RT_USING_DFS_RAMFS
|
||||
#include <dfs_fs.h>
|
||||
|
||||
extern struct dfs_ramfs *dfs_ramfs_create(rt_uint8_t *pool, rt_size_t size);
|
||||
|
||||
int mnt_init(void)
|
||||
{
|
||||
rt_uint8_t *pool = RT_NULL;
|
||||
rt_size_t size = 8*1024*1024;
|
||||
|
||||
pool = rt_malloc(size);
|
||||
if (pool == RT_NULL)
|
||||
return 0;
|
||||
|
||||
if (dfs_mount(RT_NULL, "/", "ram", 0, (const void *)dfs_ramfs_create(pool, size)) == 0)
|
||||
rt_kprintf("RAM file system initializated!\n");
|
||||
else
|
||||
rt_kprintf("RAM file system initializate failed!\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
INIT_ENV_EXPORT(mnt_init);
|
||||
#endif
|
||||
|
||||
#ifdef BSP_USING_SDCARD_FATFS
|
||||
#include <dfs_fs.h>
|
||||
#include <dfs_file.h>
|
||||
#define DBG_TAG "app.filesystem"
|
||||
#define DBG_LVL DBG_INFO
|
||||
#include <rtdbg.h>
|
||||
static int filesystem_mount(void)
|
||||
{
|
||||
while(rt_device_find("sd0") == RT_NULL)
|
||||
{
|
||||
rt_thread_mdelay(1);
|
||||
}
|
||||
|
||||
int ret = dfs_mount("sd0", "/", "elm", 0, 0);
|
||||
if (ret != 0)
|
||||
{
|
||||
rt_kprintf("ret: %d\n",ret);
|
||||
LOG_E("sd0 mount to '/' failed!");
|
||||
return ret;
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
INIT_ENV_EXPORT(filesystem_mount);
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,18 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (c) 2022, RT-Thread Development Team
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Email: opensource_embedded@phytium.com.cn
|
||||
#
|
||||
#
|
||||
# Change Logs:
|
||||
# Date Author Notes
|
||||
# 2022-11-15 zhugengyu The first version
|
||||
#
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import argparse
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x80100000;
|
||||
. = 0x80080000 ;
|
||||
. = ALIGN(4096);
|
||||
.text :
|
||||
{
|
||||
@@ -28,6 +28,12 @@ SECTIONS
|
||||
|
||||
*(COMMON)
|
||||
|
||||
/* section information for utest */
|
||||
. = ALIGN(8);
|
||||
__rt_utest_tc_tab_start = .;
|
||||
KEEP(*(UtestTcTab))
|
||||
__rt_utest_tc_tab_end = .;
|
||||
|
||||
/* section information for finsh shell */
|
||||
. = ALIGN(16);
|
||||
__fsymtab_start = .;
|
||||
@@ -102,14 +108,6 @@ SECTIONS
|
||||
PROVIDE(__bss_end = .);
|
||||
}
|
||||
|
||||
. = ALIGN(4);
|
||||
.heap :
|
||||
{
|
||||
PROVIDE(__heap_start = .);
|
||||
. = ALIGN(8);
|
||||
PROVIDE(end = .);
|
||||
}
|
||||
|
||||
_end = .;
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
@@ -147,4 +145,4 @@ SECTIONS
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
}
|
||||
|
||||
__bss_size = SIZEOF(.bss);
|
||||
__bss_size = SIZEOF(.bss);
|
||||
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* 2017-5-30 bernard first version
|
||||
*/
|
||||
|
||||
/* _EL1_STACK_SIZE = DEFINED(_EL1_STACK_SIZE) ? _EL1_STACK_SIZE : 0x20000; */
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
/* . = 0x80080000 ; */
|
||||
. = 0xffff000000080000 ;
|
||||
. = ALIGN(4096);
|
||||
.text :
|
||||
{
|
||||
KEEP(*(.text.entrypoint)) /* The entry point */
|
||||
*(.vectors)
|
||||
*(.text) /* remaining code */
|
||||
*(.text.*) /* remaining code */
|
||||
|
||||
*(.rodata) /* read-only data (constants) */
|
||||
*(.rodata*)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
*(.gnu.linkonce.t*)
|
||||
|
||||
*(COMMON)
|
||||
|
||||
/* section information for utest */
|
||||
. = ALIGN(8);
|
||||
__rt_utest_tc_tab_start = .;
|
||||
KEEP(*(UtestTcTab))
|
||||
__rt_utest_tc_tab_end = .;
|
||||
|
||||
/* section information for finsh shell */
|
||||
. = ALIGN(16);
|
||||
__fsymtab_start = .;
|
||||
KEEP(*(FSymTab))
|
||||
__fsymtab_end = .;
|
||||
. = ALIGN(16);
|
||||
__vsymtab_start = .;
|
||||
KEEP(*(VSymTab))
|
||||
__vsymtab_end = .;
|
||||
. = ALIGN(16);
|
||||
|
||||
/* section information for initial. */
|
||||
. = ALIGN(16);
|
||||
__rt_init_start = .;
|
||||
KEEP(*(SORT(.rti_fn*)))
|
||||
__rt_init_end = .;
|
||||
. = ALIGN(16);
|
||||
|
||||
. = ALIGN(16);
|
||||
_etext = .;
|
||||
}
|
||||
. = ALIGN(4);
|
||||
.eh_frame_hdr :
|
||||
{
|
||||
*(.eh_frame_hdr)
|
||||
*(.eh_frame_entry)
|
||||
}
|
||||
.eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
|
||||
|
||||
. = ALIGN(16);
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
|
||||
*(.data1)
|
||||
*(.data1.*)
|
||||
|
||||
. = ALIGN(16);
|
||||
_gp = ABSOLUTE(.); /* Base of small data */
|
||||
|
||||
*(.sdata)
|
||||
*(.sdata.*)
|
||||
}
|
||||
|
||||
. = ALIGN(16);
|
||||
.ctors :
|
||||
{
|
||||
PROVIDE(__ctors_start__ = .);
|
||||
/* new GCC version uses .init_array */
|
||||
KEEP(*(SORT(.init_array.*)))
|
||||
KEEP(*(.init_array))
|
||||
PROVIDE(__ctors_end__ = .);
|
||||
}
|
||||
. = ALIGN(4);
|
||||
.dtors :
|
||||
{
|
||||
PROVIDE(__dtors_start__ = .);
|
||||
KEEP(*(SORT(.dtors.*)))
|
||||
KEEP(*(.dtors))
|
||||
PROVIDE(__dtors_end__ = .);
|
||||
}
|
||||
|
||||
. = ALIGN(16);
|
||||
.bss :
|
||||
{
|
||||
PROVIDE(__bss_start = .);
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
*(.dynbss)
|
||||
. = ALIGN(32);
|
||||
PROVIDE(__bss_end = .);
|
||||
}
|
||||
|
||||
_end = .;
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
/* DWARF debug sections.
|
||||
* Symbols in the DWARF debugging sections are relative to the beginning
|
||||
* of the section so we begin them at 0. */
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
}
|
||||
|
||||
__bss_size = SIZEOF(.bss);
|
||||
@@ -0,0 +1,79 @@
|
||||
.PHONY: debug boot all clean menuconfig
|
||||
|
||||
CC = $(RTT_EXEC_PATH)/$(RTT_CC_PREFIX)gcc
|
||||
CXX = $(RTT_EXEC_PATH)/$(RTT_CC_PREFIX)g++
|
||||
CPP = $(RTT_EXEC_PATH)/$(RTT_CC_PREFIX)gcc -E -P -x c
|
||||
STRIP = $(RTT_EXEC_PATH)/$(RTT_CC_PREFIX)strip --strip-unneeded
|
||||
OBJCOPY = $(RTT_EXEC_PATH)/$(RTT_CC_PREFIX)objcopy
|
||||
OBJDUMP = $(RTT_EXEC_PATH)/$(RTT_CC_PREFIX)objdump
|
||||
LD = $(RTT_EXEC_PATH)/$(RTT_CC_PREFIX)ld
|
||||
AR = $(RTT_EXEC_PATH)/$(RTT_CC_PREFIX)ar rcs
|
||||
NM = $(RTT_EXEC_PATH)/$(RTT_CC_PREFIX)nm
|
||||
OD = $(RTT_EXEC_PATH)/$(RTT_CC_PREFIX)objdump
|
||||
RTCONFIG =
|
||||
|
||||
include .config
|
||||
|
||||
ifdef CONFIG_TARGET_E2000Q
|
||||
RTCONFIG := e2000q
|
||||
endif
|
||||
|
||||
ifdef CONFIG_TARGET_E2000D
|
||||
RTCONFIG := e2000d
|
||||
endif
|
||||
|
||||
ifdef CONFIG_RT_USING_SMART
|
||||
RTCONFIG := $(RTCONFIG)_rtsmart
|
||||
else
|
||||
RTCONFIG := $(RTCONFIG)_rtthread
|
||||
endif
|
||||
|
||||
boot:
|
||||
make all
|
||||
cp rtthread_a64.elf /mnt/d/tftboot
|
||||
cp rtthread_a64.bin /mnt/d/tftboot
|
||||
|
||||
debug:
|
||||
@$(OD) -D rtthread_a64.elf > rtthread_a64.asm
|
||||
@$(OD) -S rtthread_a64.elf > rtthread_a64.dis
|
||||
|
||||
all:
|
||||
@echo "Build started..."
|
||||
scons -j1024
|
||||
|
||||
clean:
|
||||
@echo "Cleaning..."
|
||||
scons -c
|
||||
|
||||
menuconfig:
|
||||
@echo "Running menuconfig..."
|
||||
scons --menuconfig
|
||||
|
||||
saveconfig:
|
||||
@echo "Save configs to" ./configs/$(RTCONFIG)
|
||||
@cp ./.config ./configs/$(RTCONFIG) -f
|
||||
@cp ./rtconfig.h ./configs/$(RTCONFIG).h -f
|
||||
|
||||
load_e2000q_rtsmart:
|
||||
@echo "Load configs from ./configs/e2000q_rtsmart"
|
||||
@cp ./configs/e2000q_rtsmart ./.config -f
|
||||
@cp ./configs/e2000q_rtsmart.h ./rtconfig.h -f
|
||||
@scons -c
|
||||
|
||||
load_e2000q_rtthread:
|
||||
@echo "Load configs from ./configs/e2000q_rtthread"
|
||||
@cp ./configs/e2000q_rtthread ./.config -f
|
||||
@cp ./configs/e2000q_rtthread.h ./rtconfig.h -f
|
||||
@scons -c
|
||||
|
||||
load_e2000d_rtsmart:
|
||||
@echo "Load configs from ./configs/e2000d_rtsmart"
|
||||
@cp ./configs/e2000d_rtsmart ./.config -f
|
||||
@cp ./configs/e2000d_rtsmart.h ./rtconfig.h -f
|
||||
@scons -c
|
||||
|
||||
load_e2000d_rtthread:
|
||||
@echo "Load configs from ./configs/e2000d_rtthread"
|
||||
@cp ./configs/e2000d_rtthread ./.config -f
|
||||
@cp ./configs/e2000d_rtthread.h ./rtconfig.h -f
|
||||
@scons -c
|
||||
@@ -8,18 +8,18 @@
|
||||
|
||||
#define RT_NAME_MAX 16
|
||||
#define RT_USING_SMP
|
||||
#define RT_CPUS_NR 4
|
||||
#define RT_ALIGN_SIZE 8
|
||||
#define RT_CPUS_NR 2
|
||||
#define RT_ALIGN_SIZE 4
|
||||
#define RT_THREAD_PRIORITY_32
|
||||
#define RT_THREAD_PRIORITY_MAX 32
|
||||
#define RT_TICK_PER_SECOND 100
|
||||
#define RT_TICK_PER_SECOND 1000
|
||||
#define RT_USING_OVERFLOW_CHECK
|
||||
#define RT_USING_HOOK
|
||||
#define RT_HOOK_USING_FUNC_PTR
|
||||
#define RT_USING_IDLE_HOOK
|
||||
#define RT_IDLE_HOOK_LIST_SIZE 4
|
||||
#define IDLE_THREAD_STACK_SIZE 4096
|
||||
#define SYSTEM_THREAD_STACK_SIZE 4096
|
||||
#define IDLE_THREAD_STACK_SIZE 40960
|
||||
#define SYSTEM_THREAD_STACK_SIZE 40960
|
||||
#define RT_USING_TIMER_SOFT
|
||||
#define RT_TIMER_THREAD_PRIO 4
|
||||
#define RT_TIMER_THREAD_STACK_SIZE 4096
|
||||
@@ -43,6 +43,8 @@
|
||||
#define RT_PAGE_MAX_ORDER 11
|
||||
#define RT_USING_MEMPOOL
|
||||
#define RT_USING_SMALL_MEM
|
||||
#define RT_USING_MEMHEAP
|
||||
#define RT_MEMHEAP_FAST_MODE
|
||||
#define RT_USING_SMALL_MEM_AS_HEAP
|
||||
#define RT_USING_HEAP
|
||||
|
||||
@@ -52,10 +54,11 @@
|
||||
#define RT_USING_CONSOLE
|
||||
#define RT_CONSOLEBUF_SIZE 128
|
||||
#define RT_CONSOLE_DEVICE_NAME "uart1"
|
||||
#define RT_VER_NUM 0x50000
|
||||
#define RT_VER_NUM 0x50001
|
||||
#define ARCH_CPU_64BIT
|
||||
#define RT_USING_CACHE
|
||||
#define RT_USING_HW_ATOMIC
|
||||
#define ARCH_ARM_BOOTWITH_FLUSH_CACHE
|
||||
#define ARCH_MM_MMU
|
||||
#define ARCH_ARM
|
||||
#define ARCH_ARM_MMU
|
||||
@@ -65,7 +68,7 @@
|
||||
|
||||
#define RT_USING_COMPONENTS_INIT
|
||||
#define RT_USING_USER_MAIN
|
||||
#define RT_MAIN_THREAD_STACK_SIZE 4096
|
||||
#define RT_MAIN_THREAD_STACK_SIZE 8192
|
||||
#define RT_MAIN_THREAD_PRIORITY 10
|
||||
#define RT_USING_MSH
|
||||
#define RT_USING_FINSH
|
||||
@@ -80,12 +83,18 @@
|
||||
#define MSH_USING_BUILT_IN_COMMANDS
|
||||
#define FINSH_USING_DESCRIPTION
|
||||
#define FINSH_ARG_MAX 10
|
||||
|
||||
/* DFS: device virtual file system */
|
||||
|
||||
#define RT_USING_DFS
|
||||
#define DFS_USING_POSIX
|
||||
#define DFS_USING_WORKDIR
|
||||
#define DFS_FD_MAX 16
|
||||
#define RT_USING_DFS_V1
|
||||
#define DFS_FILESYSTEMS_MAX 4
|
||||
#define DFS_FILESYSTEM_TYPES_MAX 4
|
||||
#define DFS_FD_MAX 16
|
||||
#define RT_USING_DFS_DEVFS
|
||||
#define RT_USING_DFS_RAMFS
|
||||
|
||||
/* Device Drivers */
|
||||
|
||||
@@ -98,7 +107,10 @@
|
||||
#define RT_USING_SERIAL_V1
|
||||
#define RT_SERIAL_USING_DMA
|
||||
#define RT_SERIAL_RB_BUFSZ 64
|
||||
#define RT_USING_PIN
|
||||
#define RT_USING_NULL
|
||||
#define RT_USING_ZERO
|
||||
#define RT_USING_RANDOM
|
||||
#define RT_USING_RTC
|
||||
|
||||
/* Using USB */
|
||||
|
||||
@@ -109,6 +121,13 @@
|
||||
|
||||
/* POSIX (Portable Operating System Interface) layer */
|
||||
|
||||
#define RT_USING_POSIX_FS
|
||||
#define RT_USING_POSIX_DEVIO
|
||||
#define RT_USING_POSIX_STDIO
|
||||
#define RT_USING_POSIX_TERMIOS
|
||||
#define RT_USING_POSIX_DELAY
|
||||
#define RT_USING_POSIX_CLOCK
|
||||
#define RT_USING_POSIX_TIMER
|
||||
|
||||
/* Interprocess Communication (IPC) */
|
||||
|
||||
@@ -121,6 +140,8 @@
|
||||
|
||||
/* Utilities */
|
||||
|
||||
#define RT_USING_RYM
|
||||
#define YMODEM_USING_FILE_TRANSFER
|
||||
#define RT_USING_ADT
|
||||
|
||||
/* RT-Thread Utestcases */
|
||||
@@ -201,6 +222,9 @@
|
||||
|
||||
/* samples: kernel and components samples */
|
||||
|
||||
#define PKG_USING_KERNEL_SAMPLES
|
||||
#define PKG_USING_KERNEL_SAMPLES_LATEST_VERSION
|
||||
#define PKG_USING_KERNEL_SAMPLES_EN
|
||||
|
||||
/* entertainment: terminal games and other interesting software packages */
|
||||
|
||||
@@ -251,6 +275,7 @@
|
||||
#define BSP_USING_GIC
|
||||
#define BSP_USING_GICV3
|
||||
#define PHYTIUM_ARCH_AARCH64
|
||||
#define ARM_SPI_BIND_CPU_ID 0
|
||||
|
||||
/* Standalone Setting */
|
||||
|
||||
@@ -258,12 +283,19 @@
|
||||
|
||||
/* Board Configuration */
|
||||
|
||||
#define TARGET_E2000Q
|
||||
#define TARGET_E2000D
|
||||
#define TARGET_E2000
|
||||
#define DEFAULT_DEBUG_PRINT_UART1
|
||||
|
||||
/* Components Configuration */
|
||||
|
||||
#define USE_SPI
|
||||
#define USE_FSPIM
|
||||
#define USE_QSPI
|
||||
|
||||
/* Qspi Configuration */
|
||||
|
||||
#define USE_FQSPI
|
||||
#define USE_SERIAL
|
||||
|
||||
/* Usart Configuration */
|
||||
|
||||
@@ -3,26 +3,14 @@ import os
|
||||
# toolchains options
|
||||
ARCH ='aarch64'
|
||||
CPU ='cortex-a'
|
||||
CROSS_TOOL ='gcc'
|
||||
|
||||
if os.getenv('RTT_ROOT'):
|
||||
RTT_ROOT = os.getenv('RTT_ROOT')
|
||||
else:
|
||||
RTT_ROOT = r'../../..'
|
||||
|
||||
CROSS_TOOL = 'gcc'
|
||||
PLATFORM = 'gcc'
|
||||
EXEC_PATH = r'/opt/gcc-arm-8.3-2019.03-x86_64-aarch64-elf/bin/'
|
||||
if os.getenv('AARCH64_CROSS_PATH'):
|
||||
EXEC_PATH = os.getenv('AARCH64_CROSS_PATH')
|
||||
print('EXEC_PATH = {}'.format(EXEC_PATH))
|
||||
else:
|
||||
print('AARCH64_CROSS_PATH not found')
|
||||
|
||||
BUILD = 'debug'
|
||||
EXEC_PATH = os.getenv('RTT_EXEC_PATH') or '/usr/bin'
|
||||
BUILD = 'debug'
|
||||
|
||||
if PLATFORM == 'gcc':
|
||||
# toolchains
|
||||
PREFIX = 'aarch64-none-elf-'
|
||||
PREFIX = os.getenv('RTT_CC_PREFIX') or 'aarch64-none-elf-'
|
||||
CC = PREFIX + 'gcc'
|
||||
CXX = PREFIX + 'g++'
|
||||
AS = PREFIX + 'gcc'
|
||||
@@ -32,21 +20,26 @@ if PLATFORM == 'gcc':
|
||||
SIZE = PREFIX + 'size'
|
||||
OBJDUMP = PREFIX + 'objdump'
|
||||
OBJCPY = PREFIX + 'objcopy'
|
||||
STRIP = PREFIX + 'strip'
|
||||
CFPFLAGS = ' '
|
||||
AFPFLAGS = ' '
|
||||
DEVICE = ' -march=armv8-a -ftree-vectorize -ffast-math -funwind-tables -fno-strict-aliasing'
|
||||
|
||||
DEVICE = ' -march=armv8-a -mtune=cortex-a72'
|
||||
CFLAGS = DEVICE + ' -Wall'
|
||||
AFLAGS = ' -c' + ' -x assembler-with-cpp -D__ASSEMBLY__'
|
||||
LFLAGS = DEVICE + ' -nostartfiles -Wl,--gc-sections,-Map=rtthread_a64.map,-cref,-u,system_vectors -T link.lds -fdiagnostics-color=always'
|
||||
CXXFLAGS= DEVICE + CFPFLAGS + ' -Wall -fdiagnostics-color=always'
|
||||
CFLAGS = DEVICE + CFPFLAGS + ' -Wall -Wno-cpp -std=gnu99 -fdiagnostics-color=always'
|
||||
AFLAGS = ' -c' + AFPFLAGS + ' -x assembler-with-cpp'
|
||||
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread_a64.map,-cref,-u,system_vectors -T link.lds' + ' -lsupc++ -lgcc -static'
|
||||
CPATH = ''
|
||||
LPATH = ''
|
||||
|
||||
if BUILD == 'debug':
|
||||
CFLAGS += ' -O0 -gdwarf-2'
|
||||
AFLAGS += ' -gdwarf-2'
|
||||
CFLAGS += ' -O0 -gdwarf-2'
|
||||
CXXFLAGS += ' -O0 -gdwarf-2'
|
||||
AFLAGS += ' -gdwarf-2'
|
||||
else:
|
||||
CFLAGS += ' -O2'
|
||||
CFLAGS += ' -Os'
|
||||
CXXFLAGS += ' -Os'
|
||||
CXXFLAGS += ' -Woverloaded-virtual -fno-exceptions -fno-rtti'
|
||||
|
||||
CXXFLAGS = CFLAGS
|
||||
|
||||
DUMP_ACTION = OBJDUMP + ' -D -S $TARGET > rtthread_a64.dis\n'
|
||||
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread_a64.bin\n' + SIZE + ' $TARGET \n'
|
||||
DUMP_ACTION = OBJDUMP + ' -D -S $TARGET > rtthread_a64.asm\n'
|
||||
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread_a64.bin\n' + SIZE + ' $TARGET \n'
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* Copyright : (C) 2022 Phytium Information Technology, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This program is OPEN SOURCE software: you can redistribute it and/or modify it
|
||||
* under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd,
|
||||
* either version 1.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the Phytium Public License for more details.
|
||||
*
|
||||
*
|
||||
* FilePath: sdkconfig.h
|
||||
* Date: 2022-10-09 15:04:36
|
||||
* LastEditTime: 2022-10-09 15:04:37
|
||||
* Description: This file is for
|
||||
*
|
||||
* Modify History:
|
||||
* Ver Who Date Changes
|
||||
* ----- ------ -------- --------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef SDK_CONFIG_H__
|
||||
#define SDK_CONFIG_H__
|
||||
|
||||
#include "rtconfig.h"
|
||||
|
||||
/* board */
|
||||
|
||||
/* E2000 */
|
||||
|
||||
#if defined(TARGET_E2000)
|
||||
#define CONFIG_TARGET_E2000
|
||||
#endif
|
||||
|
||||
#if defined(TARGET_E2000Q)
|
||||
#define CONFIG_TARGET_E2000Q
|
||||
#endif
|
||||
|
||||
#if defined(TARGET_ARMV8_AARCH64)
|
||||
#define CONFIG_TARGET_ARMV8_AARCH64
|
||||
#endif
|
||||
|
||||
/* debug */
|
||||
|
||||
#ifdef LOG_VERBOS
|
||||
#define CONFIG_LOG_VERBOS
|
||||
#endif
|
||||
|
||||
#ifdef LOG_ERROR
|
||||
#define CONFIG_LOG_ERROR
|
||||
#endif
|
||||
|
||||
#ifdef LOG_WARN
|
||||
#define CONFIG_LOG_WARN
|
||||
#endif
|
||||
|
||||
#ifdef LOG_INFO
|
||||
#define CONFIG_LOG_INFO
|
||||
#endif
|
||||
|
||||
#ifdef LOG_DEBUG
|
||||
#define CONFIG_LOG_DEBUG
|
||||
#endif
|
||||
|
||||
#ifdef BOOTUP_DEBUG_PRINTS
|
||||
#define CONFIG_BOOTUP_DEBUG_PRINTS
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -2,21 +2,24 @@ from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = Glob('*.S')
|
||||
src += Glob('*.c')
|
||||
src += Glob('*.c')
|
||||
|
||||
if GetDepend(['TARGET_E2000']):
|
||||
src += Glob(cwd + '/e2000/memory_map.c')
|
||||
if GetDepend(['TARGET_E2000Q']):
|
||||
src += Glob(cwd + '/e2000/q/parameters.c')
|
||||
src += Glob(cwd + '/e2000/q/parameters.c')
|
||||
elif GetDepend(['TARGET_E2000D']):
|
||||
src += Glob(cwd + '/e2000/d/parameters.c')
|
||||
src += Glob(cwd + '/e2000/d/parameters.c')
|
||||
elif GetDepend(['TARGET_E2000S']):
|
||||
src += Glob(cwd + '/e2000/s/parameters.c')
|
||||
src += Glob(cwd + '/e2000/s/parameters.c')
|
||||
|
||||
if GetDepend(['TARGET_F2000_4']):
|
||||
src += Glob(cwd + '/d2000/parameters.c')
|
||||
src += Glob(cwd + '/ft2004/memory_map.c')
|
||||
src += Glob(cwd + '/d2000/parameters.c')
|
||||
|
||||
if GetDepend(['TARGET_D2000']):
|
||||
src += Glob(cwd + '/ft2004/parameters.c')
|
||||
src += Glob(cwd + '/d2000/memory_map.c')
|
||||
src += Glob(cwd + '/ft2004/parameters.c')
|
||||
|
||||
CPPPATH = [cwd]
|
||||
|
||||
|
||||
+183
-222
File diff suppressed because it is too large
Load Diff
@@ -8,6 +8,7 @@
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-10-26 huanghe first commit
|
||||
* 2022-04-13 zhugengyu support RT-Smart
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -17,6 +18,11 @@
|
||||
#include "fparameters.h"
|
||||
#include "phytium_cpu.h"
|
||||
|
||||
#include "mmu.h"
|
||||
#ifdef RT_USING_SMART
|
||||
#include "ioremap.h"
|
||||
#endif
|
||||
|
||||
#if defined(__CC_ARM)
|
||||
extern int Image$$RW_IRAM1$$ZI$$Limit;
|
||||
#define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit)
|
||||
@@ -25,7 +31,18 @@
|
||||
#define HEAP_BEGIN ((void *)&__bss_end)
|
||||
#endif
|
||||
|
||||
#define HEAP_END (void *)(0x80000000 + 1024 * 1024 * 1024)
|
||||
#ifdef RT_USING_SMART
|
||||
#define HEAP_END (rt_size_t)((rt_size_t)KERNEL_VADDR_START + 64 * 1024 * 1024)
|
||||
#define PAGE_START HEAP_END + 1 * 1024 * 1024
|
||||
#define PAGE_END (rt_size_t)((rt_size_t)KERNEL_VADDR_START + 128 * 1024 * 1024)
|
||||
#else
|
||||
#define HEAP_END (rt_size_t)(HEAP_BEGIN + 64*1024*1024)
|
||||
#define KERNEL_VADDR_START (rt_size_t)0x80000000
|
||||
#define DDR_END_ADDRESS (KERNEL_VADDR_START + 1024*1024*1024 - 1 )
|
||||
#define PAGE_POOL_SIZE (8ul << 20)
|
||||
#define PAGE_START (rt_size_t)(HEAP_END)
|
||||
#define PAGE_END (PAGE_START +PAGE_POOL_SIZE)
|
||||
#endif
|
||||
|
||||
void rt_hw_board_init(void);
|
||||
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Email: opensource_embedded@phytium.com.cn
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2023-04-27 huanghe first version
|
||||
*
|
||||
*/
|
||||
|
||||
#include "rtconfig.h"
|
||||
#include <board.h>
|
||||
#include <mmu.h>
|
||||
|
||||
|
||||
/* mmu config */
|
||||
#ifdef RT_USING_SMART
|
||||
#if defined(TARGET_ARMV8_AARCH64)
|
||||
struct mem_desc platform_mem_desc[] =
|
||||
{
|
||||
{ KERNEL_VADDR_START,
|
||||
KERNEL_VADDR_START + 0x0fffffff,
|
||||
(rt_size_t)ARCH_MAP_FAILED,
|
||||
NORMAL_MEM
|
||||
}
|
||||
};
|
||||
#else
|
||||
struct mem_desc platform_mem_desc[] =
|
||||
{
|
||||
{ KERNEL_VADDR_START,
|
||||
KERNEL_VADDR_START + 0x10000000,
|
||||
(rt_size_t)ARCH_MAP_FAILED,
|
||||
NORMAL_MEM
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
const rt_uint32_t platform_mem_desc_size = sizeof(platform_mem_desc) / sizeof(platform_mem_desc[0]);
|
||||
#else
|
||||
|
||||
/* mmu config */
|
||||
struct mem_desc platform_mem_desc[] =
|
||||
{
|
||||
{
|
||||
0x80000000,
|
||||
0xFFFFFFFF,
|
||||
0x80000000,
|
||||
DDR_MEM
|
||||
},
|
||||
{
|
||||
0, //< QSPI
|
||||
0x1FFFFFFF,
|
||||
0,
|
||||
DEVICE_MEM
|
||||
},
|
||||
{
|
||||
0x20000000, //<! LPC
|
||||
0x27FFFFFF,
|
||||
0x20000000,
|
||||
DEVICE_MEM
|
||||
},
|
||||
{
|
||||
FT_DEV_BASE_ADDR, //<! Device register
|
||||
FT_DEV_END_ADDR,
|
||||
FT_DEV_BASE_ADDR,
|
||||
DEVICE_MEM
|
||||
},
|
||||
{
|
||||
0x30000000, //<! debug
|
||||
0x39FFFFFF,
|
||||
0x30000000,
|
||||
DEVICE_MEM
|
||||
},
|
||||
{
|
||||
0x3A000000, //<! Internal register space in the on-chip network
|
||||
0x3AFFFFFF,
|
||||
0x3A000000,
|
||||
DEVICE_MEM
|
||||
},
|
||||
{
|
||||
FT_PCI_CONFIG_BASEADDR,
|
||||
FT_PCI_CONFIG_BASEADDR + FT_PCI_CONFIG_REG_LENGTH,
|
||||
FT_PCI_CONFIG_BASEADDR,
|
||||
DEVICE_MEM
|
||||
},
|
||||
{
|
||||
FT_PCI_IO_CONFIG_BASEADDR,
|
||||
FT_PCI_IO_CONFIG_BASEADDR + FT_PCI_IO_CONFIG_REG_LENGTH,
|
||||
FT_PCI_IO_CONFIG_BASEADDR,
|
||||
DEVICE_MEM
|
||||
},
|
||||
{
|
||||
FT_PCI_MEM32_BASEADDR,
|
||||
FT_PCI_MEM32_BASEADDR + FT_PCI_MEM32_REG_LENGTH,
|
||||
FT_PCI_MEM32_BASEADDR,
|
||||
DEVICE_MEM
|
||||
}
|
||||
#if defined(TARGET_ARMV8_AARCH64)
|
||||
{
|
||||
0x1000000000,
|
||||
0x1000000000 + 0x1000000000,
|
||||
0x1000000000,
|
||||
DEVICE_MEM
|
||||
},
|
||||
{
|
||||
0x2000000000,
|
||||
0x2000000000 + 0x2000000000,
|
||||
0x2000000000,
|
||||
NORMAL_MEM
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
const rt_uint32_t platform_mem_desc_size = sizeof(platform_mem_desc) / sizeof(platform_mem_desc[0]);
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
@@ -112,4 +112,4 @@ u32 GetCpuMaskToAffval(u32 *cpu_mask, u32 *cluster_id, u32 *target_list)
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Email: opensource_embedded@phytium.com.cn
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2023-04-27 huanghe first version
|
||||
*
|
||||
*/
|
||||
|
||||
#include "rtconfig.h"
|
||||
#include <board.h>
|
||||
#include <mmu.h>
|
||||
|
||||
/* mmu config */
|
||||
#ifdef RT_USING_SMART
|
||||
#if defined(TARGET_ARMV8_AARCH64)
|
||||
struct mem_desc platform_mem_desc[] =
|
||||
{
|
||||
{ KERNEL_VADDR_START,
|
||||
KERNEL_VADDR_START + 0x0fffffff,
|
||||
(rt_size_t)ARCH_MAP_FAILED,
|
||||
NORMAL_MEM
|
||||
}
|
||||
};
|
||||
#else
|
||||
struct mem_desc platform_mem_desc[] =
|
||||
{
|
||||
{ KERNEL_VADDR_START,
|
||||
KERNEL_VADDR_START + 0x10000000,
|
||||
(rt_size_t)ARCH_MAP_FAILED,
|
||||
NORMAL_MEM
|
||||
}
|
||||
};
|
||||
#endif
|
||||
#else
|
||||
|
||||
#if defined(TARGET_ARMV8_AARCH64)
|
||||
|
||||
struct mem_desc platform_mem_desc[] = {
|
||||
{KERNEL_VADDR_START, DDR_END_ADDRESS , KERNEL_VADDR_START, NORMAL_MEM},
|
||||
{
|
||||
0x28000000U,
|
||||
0x32B36FFFU,
|
||||
0x28000000U,
|
||||
DEVICE_MEM
|
||||
},
|
||||
};
|
||||
#else
|
||||
struct mem_desc platform_mem_desc[] =
|
||||
{
|
||||
{
|
||||
0x00U,
|
||||
0x00U + 0x40000000U,
|
||||
0x00U,
|
||||
DEVICE_MEM
|
||||
},
|
||||
{
|
||||
0x40000000U,
|
||||
0x40000000U + 0x10000000U,
|
||||
0x40000000U,
|
||||
DEVICE_MEM
|
||||
},
|
||||
{
|
||||
0x50000000U,
|
||||
0x50000000U + 0x30000000U,
|
||||
0x50000000U,
|
||||
DEVICE_MEM
|
||||
},
|
||||
{
|
||||
0x80000000U,
|
||||
0xffffffffU,
|
||||
0x80000000U,
|
||||
NORMAL_MEM
|
||||
},
|
||||
#if defined(TARGET_ARMV8_AARCH64)
|
||||
{
|
||||
0x1000000000,
|
||||
0x1000000000 + 0x1000000000,
|
||||
0x1000000000,
|
||||
DEVICE_MEM
|
||||
},
|
||||
{
|
||||
0x2000000000,
|
||||
0x2000000000 + 0x2000000000,
|
||||
0x2000000000,
|
||||
NORMAL_MEM
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
const rt_uint32_t platform_mem_desc_size = sizeof(platform_mem_desc) / sizeof(platform_mem_desc[0]);
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
@@ -72,4 +72,4 @@ u32 GetCpuMaskToAffval(u32 *cpu_mask, u32 *cluster_id, u32 *target_list)
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Email: opensource_embedded@phytium.com.cn
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2023-04-27 huanghe first version
|
||||
*
|
||||
*/
|
||||
|
||||
#include "rtconfig.h"
|
||||
#include <board.h>
|
||||
#include <mmu.h>
|
||||
|
||||
/* mmu config */
|
||||
struct mem_desc platform_mem_desc[] =
|
||||
{
|
||||
{
|
||||
0x80000000,
|
||||
0xFFFFFFFF,
|
||||
0x80000000,
|
||||
DDR_MEM
|
||||
},
|
||||
{
|
||||
0, //< QSPI
|
||||
0x1FFFFFFF,
|
||||
0,
|
||||
DEVICE_MEM
|
||||
},
|
||||
{
|
||||
0x20000000, //<! LPC
|
||||
0x27FFFFFF,
|
||||
0x20000000,
|
||||
DEVICE_MEM
|
||||
},
|
||||
{
|
||||
FT_DEV_BASE_ADDR, //<! Device register
|
||||
FT_DEV_END_ADDR,
|
||||
FT_DEV_BASE_ADDR,
|
||||
DEVICE_MEM
|
||||
},
|
||||
{
|
||||
0x30000000, //<! debug
|
||||
0x39FFFFFF,
|
||||
0x30000000,
|
||||
DEVICE_MEM
|
||||
},
|
||||
{
|
||||
0x3A000000, //<! Internal register space in the on-chip network
|
||||
0x3AFFFFFF,
|
||||
0x3A000000,
|
||||
DEVICE_MEM
|
||||
},
|
||||
{
|
||||
FT_PCI_CONFIG_BASEADDR,
|
||||
FT_PCI_CONFIG_BASEADDR + FT_PCI_CONFIG_REG_LENGTH,
|
||||
FT_PCI_CONFIG_BASEADDR,
|
||||
DEVICE_MEM
|
||||
},
|
||||
{
|
||||
FT_PCI_IO_CONFIG_BASEADDR,
|
||||
FT_PCI_IO_CONFIG_BASEADDR + FT_PCI_IO_CONFIG_REG_LENGTH,
|
||||
FT_PCI_IO_CONFIG_BASEADDR,
|
||||
DEVICE_MEM
|
||||
},
|
||||
{
|
||||
FT_PCI_MEM32_BASEADDR,
|
||||
FT_PCI_MEM32_BASEADDR + FT_PCI_MEM32_REG_LENGTH,
|
||||
FT_PCI_MEM32_BASEADDR,
|
||||
DEVICE_MEM
|
||||
}
|
||||
#if defined(TARGET_ARMV8_AARCH64)
|
||||
{
|
||||
0x1000000000,
|
||||
0x1000000000 + 0x1000000000,
|
||||
0x1000000000,
|
||||
DEVICE_MEM
|
||||
},
|
||||
{
|
||||
0x2000000000,
|
||||
0x2000000000 + 0x2000000000,
|
||||
0x2000000000,
|
||||
NORMAL_MEM
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
const rt_uint32_t platform_mem_desc_size = sizeof(platform_mem_desc) / sizeof(platform_mem_desc[0]);
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
@@ -68,4 +68,4 @@ u32 GetCpuMaskToAffval(u32 *cpu_mask, u32 *cluster_id, u32 *target_list)
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
@@ -20,6 +20,72 @@
|
||||
|
||||
#include "phytium_cpu.h"
|
||||
|
||||
|
||||
#if defined(TARGET_ARMV8_AARCH64)
|
||||
|
||||
/**
|
||||
@name: phytium_cpu_id_mapping
|
||||
@msg: Map Phytium CPU ID
|
||||
@brief: Map the input CPU ID to a new CPU ID based on the type and quantity of CPUs on the target board.
|
||||
@param {int} cpu_id Input CPU ID
|
||||
@return {int} Mapped CPU ID
|
||||
*/
|
||||
int phytium_cpu_id_mapping(int cpu_id)
|
||||
{
|
||||
#if defined(TARGET_E2000Q)
|
||||
#if RT_CPUS_NR <= 2
|
||||
switch (cpu_id)
|
||||
{
|
||||
case 0:
|
||||
return 2;
|
||||
case 1:
|
||||
return 3;
|
||||
case 2:
|
||||
return 0;
|
||||
case 3:
|
||||
return 1;
|
||||
default:
|
||||
RT_ASSERT(0);
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
return (int)cpu_id;
|
||||
#endif
|
||||
#else
|
||||
return (int)cpu_id;
|
||||
#endif
|
||||
}
|
||||
|
||||
int phytium_cpu_id(void)
|
||||
{
|
||||
FError ret;
|
||||
u32 cpu_id;
|
||||
ret = GetCpuId(&cpu_id);
|
||||
|
||||
if (ret != ERR_SUCCESS)
|
||||
{
|
||||
RT_ASSERT(0);
|
||||
}
|
||||
return phytium_cpu_id_mapping(cpu_id);
|
||||
}
|
||||
|
||||
int rt_hw_cpu_id(void)
|
||||
{
|
||||
FError ret;
|
||||
u32 cpu_id;
|
||||
ret = GetCpuId(&cpu_id);
|
||||
|
||||
if (ret != ERR_SUCCESS)
|
||||
{
|
||||
RT_ASSERT(0);
|
||||
}
|
||||
return phytium_cpu_id_mapping(cpu_id);
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
int phytium_cpu_id_mapping(int cpu_id)
|
||||
{
|
||||
#if defined(TARGET_E2000Q)
|
||||
@@ -43,23 +109,6 @@ int phytium_cpu_id_mapping(int cpu_id)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(TARGET_ARMV8_AARCH64)
|
||||
|
||||
int phytium_cpu_id(void)
|
||||
{
|
||||
FError ret;
|
||||
u32 cpu_id;
|
||||
ret = GetCpuId(&cpu_id);
|
||||
|
||||
if (ret != ERR_SUCCESS)
|
||||
{
|
||||
RT_ASSERT(0);
|
||||
}
|
||||
return phytium_cpu_id_mapping(cpu_id);
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
int rt_hw_cpu_id(void)
|
||||
{
|
||||
FError ret;
|
||||
@@ -72,7 +121,7 @@ int rt_hw_cpu_id(void)
|
||||
}
|
||||
|
||||
return phytium_cpu_id_mapping(cpu_id);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -110,4 +159,4 @@ MSH_CMD_EXPORT(send_core_isg, send_core_isg);
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
@@ -19,7 +19,16 @@
|
||||
#include "fparameters.h"
|
||||
|
||||
#define ARM_GIC_MAX_NR 1
|
||||
|
||||
#if defined(TARGET_FT2000_4) || defined(TARGET_D2000)
|
||||
#define MAX_HANDLERS 160
|
||||
#endif
|
||||
|
||||
#if defined(TARGET_E2000)
|
||||
#define MAX_HANDLERS 270
|
||||
#define ARM_GIC_CPU_NUM 4
|
||||
#endif
|
||||
|
||||
#define GIC_IRQ_START 0
|
||||
#define GIC_ACK_INTID_MASK 0x000003ff
|
||||
|
||||
@@ -28,7 +37,7 @@ rt_uint64_t get_main_cpu_affval(void);
|
||||
|
||||
rt_inline rt_uint32_t platform_get_gic_dist_base(void)
|
||||
{
|
||||
return GICV3_DISTRIBUTOR_BASEADDRESS;
|
||||
return GICV3_DISTRIBUTOR_BASE_ADDR;
|
||||
}
|
||||
|
||||
#if defined(TARGET_ARMV8_AARCH64)
|
||||
@@ -38,6 +47,7 @@ rt_inline rt_uint32_t platform_get_gic_redist_base(void)
|
||||
{
|
||||
extern int phytium_cpu_id(void);
|
||||
|
||||
#if RT_CPUS_NR <= 2
|
||||
s32 cpu_offset = 0;
|
||||
#if defined(FT_GIC_REDISTRUBUTIOR_OFFSET)
|
||||
cpu_offset = FT_GIC_REDISTRUBUTIOR_OFFSET ;
|
||||
@@ -59,10 +69,15 @@ rt_inline rt_uint32_t platform_get_gic_redist_base(void)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
rt_kprintf("offset is %x\n", cpu_offset);
|
||||
return (GICV3_RD_BASEADDRESS + (cpu_offset) * GICV3_RD_OFFSET);
|
||||
rt_kprintf("cpu_id is %d \r\n",cpu_id);
|
||||
#endif
|
||||
rt_kprintf("offset is %d\n", cpu_offset);
|
||||
|
||||
return (GICV3_RD_BASE_ADDR + (cpu_offset) * GICV3_RD_OFFSET);
|
||||
#else
|
||||
return (GICV3_RD_BASE_ADDR);
|
||||
#endif
|
||||
}
|
||||
|
||||
rt_inline rt_uint32_t platform_get_gic_cpu_base(void)
|
||||
@@ -77,4 +92,4 @@ int phytium_cpu_id_mapping(int cpu_id);
|
||||
|
||||
|
||||
|
||||
#endif // !
|
||||
#endif // !
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "cpuport.h"
|
||||
#include "gtimer.h"
|
||||
#include "mmu.h"
|
||||
#include "cp15.h"
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_SMP
|
||||
@@ -29,6 +30,9 @@
|
||||
|
||||
#if defined(TARGET_ARMV8_AARCH64)
|
||||
#include "psci.h"
|
||||
extern void _secondary_cpu_entry(void);
|
||||
#else
|
||||
extern void rt_secondary_cpu_entry(void);
|
||||
#endif
|
||||
|
||||
#include "fpsci.h"
|
||||
@@ -39,10 +43,10 @@ rt_uint64_t rt_cpu_mpidr_early[] =
|
||||
[0] = 0x80000200,
|
||||
[1] = 0x80000201,
|
||||
#elif defined(TARGET_E2000Q)
|
||||
[0] = 0x80000200,
|
||||
[1] = 0x80000201,
|
||||
[2] = 0x80000000,
|
||||
[3] = 0x80000100,
|
||||
[0] = 0x80000000,
|
||||
[1] = 0x80000100,
|
||||
[2] = 0x80000200,
|
||||
[3] = 0x80000201,
|
||||
#elif defined(TARGET_F2000_4) || defined(TARGET_D2000)
|
||||
[0] = 0x80000000,
|
||||
[1] = 0x80000001,
|
||||
@@ -59,53 +63,66 @@ rt_uint64_t rt_cpu_mpidr_early[] =
|
||||
};
|
||||
|
||||
extern int rt_hw_timer_init(void);
|
||||
extern void secondary_cpu_start(void);
|
||||
|
||||
#include "fcache.h"
|
||||
void rt_hw_secondary_cpu_up(void)
|
||||
{
|
||||
rt_uint32_t i;
|
||||
rt_uint32_t cpu_mask = 0;
|
||||
|
||||
int cpu_id;
|
||||
cpu_id = rt_hw_cpu_id();
|
||||
rt_kprintf("rt_hw_secondary_cpu_up is processing \r\n");
|
||||
for (i = 1; i < RT_CPUS_NR; i++)
|
||||
for (i = 0; i < RT_CPUS_NR;i++)
|
||||
{
|
||||
|
||||
if(i == cpu_id)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
cpu_mask = 1 << phytium_cpu_id_mapping(i);
|
||||
|
||||
/* code */
|
||||
PsciCpuOn(cpu_mask, (uintptr)secondary_cpu_start);
|
||||
|
||||
|
||||
#if defined(TARGET_ARMV8_AARCH64)
|
||||
/* code */
|
||||
char *entry = (char *)_secondary_cpu_entry;
|
||||
entry += PV_OFFSET;
|
||||
PsciCpuOn(cpu_mask, (uintptr)entry);
|
||||
__DSB();
|
||||
#else
|
||||
/* code */
|
||||
PsciCpuOn(cpu_mask, (uintptr)rt_secondary_cpu_entry);
|
||||
__asm__ volatile("dsb" ::: "memory");
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void secondary_cpu_c_start(void)
|
||||
void rt_hw_secondary_cpu_bsp_start(void)
|
||||
{
|
||||
/* mmu init */
|
||||
#if defined(TARGET_ARMV8_AARCH64)
|
||||
rt_hw_mmu_init();
|
||||
#endif
|
||||
/* spin lock init */
|
||||
rt_hw_spin_lock(&_cpus_lock);
|
||||
|
||||
/* mmu init */
|
||||
#if defined(TARGET_ARMV8_AARCH64)
|
||||
extern unsigned long MMUTable[];
|
||||
rt_hw_mmu_ktbl_set((unsigned long)MMUTable);
|
||||
#endif
|
||||
|
||||
/* vector init */
|
||||
rt_hw_vector_init();
|
||||
/* interrupt init */
|
||||
#if defined(TARGET_ARMV8_AARCH64)
|
||||
arm_gic_cpu_init(0, platform_get_gic_cpu_base());
|
||||
arm_gic_redist_init(0, platform_get_gic_redist_base());
|
||||
arm_gic_cpu_init(0, 0);
|
||||
|
||||
arm_gic_redist_init(0, 0);
|
||||
rt_kprintf("arm_gic_redist_init is over rt_hw_cpu_id() is %d \r\n", rt_hw_cpu_id());
|
||||
#else
|
||||
arm_gic_cpu_init(0);
|
||||
arm_gic_redist_init(0);
|
||||
#endif
|
||||
|
||||
/* vector init */
|
||||
rt_hw_vector_init();
|
||||
|
||||
/* gtimer init */
|
||||
#if defined(TARGET_ARMV8_AARCH64)
|
||||
rt_hw_gtimer_local_enable();
|
||||
rt_hw_gtimer_init();
|
||||
#else
|
||||
rt_hw_timer_init();
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
# files format check exclude path, please follow the instructions below to modify;
|
||||
# If you need to exclude an entire folder, add the folder path in dir_path;
|
||||
# If you need to exclude a file, add the path to the file in file_path.
|
||||
|
||||
dir_path:
|
||||
- standalone
|
||||
@@ -8,66 +8,83 @@ STANDALONE_DIR = cwd + '/standalone'
|
||||
|
||||
# common source
|
||||
src = Glob(STANDALONE_DIR+'/common/*.c')
|
||||
|
||||
path = [STANDALONE_DIR + '/common']
|
||||
|
||||
# arch
|
||||
path += [STANDALONE_DIR + '/arch/common']
|
||||
# port
|
||||
src += Glob(STANDALONE_DIR+'/port/*.c')
|
||||
path += [STANDALONE_DIR + '/port'] + [STANDALONE_DIR + '/port/arch']
|
||||
|
||||
if GetDepend(['TARGET_ARMV8_AARCH32']):
|
||||
src += Glob(STANDALONE_DIR+'/arch/armv8/aarch32/*.c') + Glob(STANDALONE_DIR+'/arch/armv8/aarch32/gcc/*.S')
|
||||
path += [STANDALONE_DIR + '/arch/armv8/aarch32']
|
||||
src += Glob(STANDALONE_DIR+'/port/arch/armv8/aarch32/*.c') + Glob(STANDALONE_DIR+'/port/arch/armv8/aarch32/*.S')
|
||||
path += [STANDALONE_DIR + '/port/arch/armv8/aarch32']
|
||||
elif GetDepend(['TARGET_ARMV8_AARCH64']):
|
||||
src += Glob(STANDALONE_DIR+'/arch/armv8/aarch64/*.c') + Glob(STANDALONE_DIR+'/arch/armv8/aarch64/gcc/*.S')
|
||||
path += [STANDALONE_DIR + '/arch/armv8/aarch64']
|
||||
src += Glob(STANDALONE_DIR+'/port/arch/armv8/aarch64/*.c') + Glob(STANDALONE_DIR+'/port/arch/armv8/aarch64/*.S')
|
||||
path += [STANDALONE_DIR + '/port/arch/armv8/aarch64']
|
||||
|
||||
# board
|
||||
src += Glob(STANDALONE_DIR+'/board/common/*.c') + Glob(STANDALONE_DIR+'/board/common/*.S')
|
||||
path += [STANDALONE_DIR + '/board/common']
|
||||
path += [STANDALONE_DIR + '/board/common']
|
||||
|
||||
if GetDepend(['TARGET_F2000_4']):
|
||||
src += Glob(STANDALONE_DIR+'/board/ft2004/*.c')
|
||||
path += [STANDALONE_DIR + '/board/ft2004']
|
||||
path += [STANDALONE_DIR + '/board/ft2004']
|
||||
|
||||
if GetDepend(['TARGET_E2000']):
|
||||
src += Glob(STANDALONE_DIR+'/board/e2000/*.c')
|
||||
path += [STANDALONE_DIR + '/board/e2000']
|
||||
path += [STANDALONE_DIR + '/board/e2000']
|
||||
|
||||
if GetDepend(['TARGET_E2000Q']):
|
||||
src += Glob(STANDALONE_DIR+'/board/e2000/q/*.c')
|
||||
path += [STANDALONE_DIR + '/board/e2000/q']
|
||||
path += [STANDALONE_DIR + '/board/e2000/q']
|
||||
|
||||
if GetDepend(['TARGET_E2000D']):
|
||||
src += Glob(STANDALONE_DIR+'/board/e2000/d/*.c')
|
||||
path += [STANDALONE_DIR + '/board/e2000/d']
|
||||
|
||||
path += [STANDALONE_DIR + '/board/e2000/d']
|
||||
|
||||
if GetDepend(['ARGET_E2000S']):
|
||||
src += Glob(STANDALONE_DIR+'/board/e2000/s/*.c')
|
||||
path += [STANDALONE_DIR + '/board/e2000/s']
|
||||
|
||||
path += [STANDALONE_DIR + '/board/e2000/s']
|
||||
|
||||
if GetDepend(['TARGET_D2000']):
|
||||
src += Glob(STANDALONE_DIR+'/board/d2000/*.c')
|
||||
path += [STANDALONE_DIR + '/board/d2000']
|
||||
path += [STANDALONE_DIR + '/board/d2000']
|
||||
|
||||
# driver
|
||||
|
||||
## spim
|
||||
if GetDepend(['BSP_USING_SPI']):
|
||||
src += Glob(STANDALONE_DIR+'/drivers/spi/fspim/*.c')
|
||||
path += [STANDALONE_DIR + '/drivers/spi/fspim']
|
||||
|
||||
## serial
|
||||
if GetDepend(['ENABLE_Pl011_UART']):
|
||||
if GetDepend(['BSP_USING_UART']):
|
||||
src += Glob(STANDALONE_DIR+'/drivers/serial/fpl011/*.c')
|
||||
path += [STANDALONE_DIR + '/drivers/serial/fpl011']
|
||||
path += [STANDALONE_DIR + '/drivers/serial/fpl011']
|
||||
|
||||
## gicv3
|
||||
if GetDepend(['ENABLE_GICV3']):
|
||||
src += Glob(STANDALONE_DIR+'/drivers/gic/fgic/*.c') + Glob(STANDALONE_DIR+'/drivers/gic/fgic/*.S')
|
||||
path += [STANDALONE_DIR + '/drivers/gic/fgic']
|
||||
## can
|
||||
if GetDepend(['BSP_USING_CAN']):
|
||||
src += Glob(STANDALONE_DIR+'/drivers/can/fcan/*.c') + Glob(STANDALONE_DIR+'/drivers/can/fcan/*.S')
|
||||
path += [STANDALONE_DIR + '/drivers/can/fcan/']
|
||||
|
||||
## qspi
|
||||
if GetDepend(['BSP_USING_QSPI']):
|
||||
src += Glob(STANDALONE_DIR+'/drivers/qspi/fqspi/*.c') + Glob(STANDALONE_DIR+'/drivers/qspi/fqspi/*.S')
|
||||
path += [STANDALONE_DIR + '/drivers/qspi/fqspi/']
|
||||
|
||||
# phytium ports rt-thread drivers
|
||||
PORT_DRV_DIR = cwd + '/drivers'
|
||||
|
||||
src += Glob(PORT_DRV_DIR + '/*.S')
|
||||
src += Glob(PORT_DRV_DIR + '/*.c')
|
||||
src += Glob(PORT_DRV_DIR + '/*.c')
|
||||
|
||||
# phytium ports rt-thread examples
|
||||
PORT_DRV_DIR = cwd + '/examples'
|
||||
|
||||
src += Glob(PORT_DRV_DIR + '/*.c')
|
||||
|
||||
# sdkcomfig.h
|
||||
path += [cwd]
|
||||
|
||||
# add group
|
||||
ASFLAGS = ''
|
||||
group = DefineGroup('FT_DRIVER', src, depend=[
|
||||
''], CPPPATH=path, ASFLAGS = ASFLAGS)
|
||||
|
||||
@@ -5,20 +5,53 @@ menu "On-chip Peripheral Drivers"
|
||||
bool "Enable UART"
|
||||
default y
|
||||
select USE_SERIAL # sdk serial component
|
||||
select ENABLE_Pl011_UART # select sdk pl011 driver
|
||||
select RT_USING_SERIAL
|
||||
if BSP_USING_UART
|
||||
config RT_USING_UART1
|
||||
bool "Enable UART1"
|
||||
default y
|
||||
|
||||
|
||||
config RT_USING_UART0
|
||||
bool "Enable UART0"
|
||||
default n
|
||||
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SPI
|
||||
bool "Enable Spi"
|
||||
default y
|
||||
select USE_SPI # sdk spi component
|
||||
select RT_USING_SPI
|
||||
if BSP_USING_SPI
|
||||
config RT_USING_SPIM0
|
||||
bool "Enable spim0"
|
||||
default n
|
||||
|
||||
config RT_USING_SPIM1
|
||||
bool "Enable spim1"
|
||||
default n
|
||||
|
||||
config RT_USING_SPIM2
|
||||
bool "Enable spim2"
|
||||
default y
|
||||
|
||||
config RT_USING_SPIM3
|
||||
bool "Enable spim3"
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_CAN
|
||||
bool "Enable CAN"
|
||||
default y
|
||||
select RT_USING_CAN
|
||||
select RT_CAN_USING_HDR
|
||||
select RT_CAN_USING_CANFD
|
||||
|
||||
menuconfig BSP_USING_QSPI
|
||||
bool "Enable QSPI"
|
||||
default y
|
||||
select RT_USING_QSPI
|
||||
select RT_USING_SPI
|
||||
|
||||
endmenu
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Email: opensource_embedded@phytium.com.cn
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2023-03-20 zhangyan first version
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __DRV_CAN_H__
|
||||
#define __DRV_CAN_H__
|
||||
|
||||
#include <rtdevice.h>
|
||||
|
||||
#ifdef RT_USING_CAN
|
||||
|
||||
#include "fcan.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
int rt_hw_can_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /* __DRV_CAN_H__ */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Email: opensource_embedded@phytium.com.cn
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2023-03-20 zhangyan first version
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __DRT_QSPI_H__
|
||||
#define __DRT_QSPI_H__
|
||||
|
||||
#include <rtthread.h>
|
||||
#ifdef RT_USING_QSPI
|
||||
#define PHYTIUM_QSPI_NAME "qspi"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
rt_err_t phytium_qspi_bus_attach_device(const char *bus_name, const char *device_name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif // !DRT_QSPI_H
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Email: opensource_embedded@phytium.com.cn
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-11-10 liqiaozhong first commit
|
||||
* 2023-03-08 liqiaozhong support 4 spis and qspi working together
|
||||
*/
|
||||
#ifndef __DRV_SPI_H__
|
||||
#define __DRV_SPI_H__
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
struct drv_spi
|
||||
{
|
||||
u32 spi_id;
|
||||
FSpim spim_instance;
|
||||
struct rt_spi_device device;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -8,10 +8,13 @@
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-10-26 huanghe first commit
|
||||
*
|
||||
* 2023-04-27 huanghe support RT-Smart
|
||||
*/
|
||||
|
||||
#include "board.h"
|
||||
|
||||
#include <mmu.h>
|
||||
|
||||
#include "drv_usart.h"
|
||||
#include "interrupt.h"
|
||||
#include "fpl011.h"
|
||||
@@ -42,6 +45,10 @@ static rt_err_t uart_configure(struct rt_serial_device *serial, struct serial_co
|
||||
uart_hw = uart->handle;
|
||||
config = *(const FPl011Config *)FPl011LookupConfig(uart->config.uart_instance);
|
||||
|
||||
#ifdef RT_USING_SMART
|
||||
config.base_address = (uintptr)rt_ioremap((void*)config.base_address, 0x1000);
|
||||
#endif
|
||||
|
||||
RT_ASSERT(FPl011CfgInitialize(uart_hw, &config) == FT_SUCCESS);
|
||||
FPl011SetHandler(uart_hw, Ft_Os_Uart_Callback, serial);
|
||||
|
||||
@@ -129,13 +136,13 @@ static int uart_putc(struct rt_serial_device *serial, char c)
|
||||
return 1;
|
||||
}
|
||||
|
||||
u8 FPl011RecvByteNoBlocking(u32 addr)
|
||||
u32 FPl011RecvByteNoBlocking(uintptr addr)
|
||||
{
|
||||
u32 recieved_byte;
|
||||
|
||||
while (FUART_ISRECEIVEDATA(addr))
|
||||
while (FUART_RECEIVEDATAEMPTY(addr))
|
||||
{
|
||||
return 0xff;
|
||||
return 0xffff;
|
||||
}
|
||||
recieved_byte = FUART_READREG32(addr, FPL011DR_OFFSET);
|
||||
return recieved_byte;
|
||||
@@ -152,14 +159,13 @@ static int uart_getc(struct rt_serial_device *serial)
|
||||
uart_ptr = uart->handle;
|
||||
|
||||
ch = FPl011RecvByteNoBlocking(uart_ptr->config.base_address);
|
||||
if (ch == 0xff)
|
||||
if (ch == 0xffff)
|
||||
{
|
||||
ch = -1;
|
||||
rt_kprintf("") ;
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
ch &= 0xff;
|
||||
}
|
||||
|
||||
return ch;
|
||||
@@ -176,6 +182,7 @@ static const struct rt_uart_ops _uart_ops =
|
||||
|
||||
#define RT_USING_UART0
|
||||
#define RT_USING_UART1
|
||||
#define RT_USING_UART2
|
||||
|
||||
|
||||
#ifdef RT_USING_UART0
|
||||
@@ -188,6 +195,11 @@ static const struct rt_uart_ops _uart_ops =
|
||||
static struct drv_usart _RtUart1;
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_UART2
|
||||
static FPl011 Ft_Uart2;
|
||||
static struct drv_usart _RtUart2;
|
||||
#endif
|
||||
|
||||
int rt_hw_uart_init(void)
|
||||
{
|
||||
struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
|
||||
@@ -196,7 +208,6 @@ int rt_hw_uart_init(void)
|
||||
config.bufsz = RT_SERIAL_RB_BUFSZ;
|
||||
_RtUart0.serial.ops = &_uart_ops;
|
||||
_RtUart0.serial.config = config;
|
||||
// Ft_Uart0.config.instance_id = FUART0_ID;
|
||||
|
||||
_RtUart0.handle = &Ft_Uart0;
|
||||
_RtUart0.config.uart_instance = FUART0_ID;
|
||||
@@ -213,7 +224,6 @@ int rt_hw_uart_init(void)
|
||||
config.bufsz = RT_SERIAL_RB_BUFSZ;
|
||||
_RtUart1.serial.ops = &_uart_ops;
|
||||
_RtUart1.serial.config = config;
|
||||
// Ft_Uart1.config.instance_id = FUART1_ID;
|
||||
_RtUart1.handle = &Ft_Uart1;
|
||||
|
||||
_RtUart1.config.uart_instance = FUART1_ID;
|
||||
@@ -226,6 +236,24 @@ int rt_hw_uart_init(void)
|
||||
&_RtUart1);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef RT_USING_UART2
|
||||
config.bufsz = RT_SERIAL_RB_BUFSZ;
|
||||
_RtUart2.serial.ops = &_uart_ops;
|
||||
_RtUart2.serial.config = config;
|
||||
_RtUart2.handle = &Ft_Uart2;
|
||||
|
||||
_RtUart2.config.uart_instance = FUART2_ID;
|
||||
_RtUart2.config.isr_priority = 0xd0;
|
||||
_RtUart2.config.isr_event_mask = (RTOS_UART_ISR_OEIM_MASK | RTOS_UART_ISR_BEIM_MASK | RTOS_UART_ISR_PEIM_MASK | RTOS_UART_ISR_FEIM_MASK | RTOS_UART_ISR_RTIM_MASK | RTOS_UART_ISR_RXIM_MASK);
|
||||
_RtUart2.config.uart_baudrate = 115200;
|
||||
|
||||
rt_hw_serial_register(&_RtUart2.serial, "uart2",
|
||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
|
||||
&_RtUart2);
|
||||
#endif
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
INIT_BOARD_EXPORT(rt_hw_uart_init);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-10-26 huanghe first commit
|
||||
*
|
||||
* 2023-04-27 huanghe support RT-Smart
|
||||
*/
|
||||
|
||||
#ifndef __DRV_USART_H__
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* @Copyright : (C) 2022 Phytium Information Technology, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This program is OPEN SOURCE software: you can redistribute it and/or modify it
|
||||
* under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd,
|
||||
* either version 1.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the Phytium Public License for more details.
|
||||
*
|
||||
*
|
||||
* @FilePath: drv_xmac.c
|
||||
* @Date: 2023-04-19 15:19:29
|
||||
* @LastEditTime: 2023-04-19 15:19:29
|
||||
* @Description: This file is for
|
||||
*
|
||||
* @Modify History:
|
||||
* Ver Who Date Changes
|
||||
* ----- ------ -------- --------------------------------------
|
||||
*/
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* @Copyright : (C) 2022 Phytium Information Technology, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This program is OPEN SOURCE software: you can redistribute it and/or modify it
|
||||
* under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd,
|
||||
* either version 1.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the Phytium Public License for more details.
|
||||
*
|
||||
*
|
||||
* @FilePath: drv_xmac.h
|
||||
* @Date: 2023-04-19 15:19:39
|
||||
* @LastEditTime: 2023-04-19 15:19:40
|
||||
* @Description: This file is for
|
||||
*
|
||||
* @Modify History:
|
||||
* Ver Who Date Changes
|
||||
* ----- ------ -------- --------------------------------------
|
||||
*/
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Email: opensource_embedded@phytium.com.cn
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-11-20 liqiaozhong first commit
|
||||
* 2022-03-08 liqiaozhong add format function and mount table
|
||||
*/
|
||||
#include <rtthread.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined (RT_USING_SFUD) && defined(RT_USING_DFS)
|
||||
|
||||
#include <dfs_fs.h>
|
||||
#include <dfs_file.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/statfs.h>
|
||||
#include "spi_flash.h"
|
||||
#include "spi_flash_sfud.h"
|
||||
|
||||
#include "fdebug.h"
|
||||
#include "fparameters_comm.h"
|
||||
|
||||
#include "fspim.h"
|
||||
/************************** Variable Definitions *****************************/
|
||||
sfud_flash_t spim_flash = RT_NULL;
|
||||
const struct dfs_mount_tbl mount_table[] =
|
||||
{
|
||||
{ "flash2", "/", "elm", 0, RT_NULL },
|
||||
{0},
|
||||
};
|
||||
/***************** Macros (Inline Fungoctions) Definitions *********************/
|
||||
#define FSPIM_DEBUG_TAG "SPIM"
|
||||
#define FSPIM_ERROR(format, ...) FT_DEBUG_PRINT_E(FSPIM_DEBUG_TAG, format, ##__VA_ARGS__)
|
||||
#define FSPIM_WARN(format, ...) FT_DEBUG_PRINT_W(FSPIM_DEBUG_TAG, format, ##__VA_ARGS__)
|
||||
#define FSPIM_INFO(format, ...) FT_DEBUG_PRINT_I(FSPIM_DEBUG_TAG, format, ##__VA_ARGS__)
|
||||
#define FSPIM_DEBUG(format, ...) FT_DEBUG_PRINT_D(FSPIM_DEBUG_TAG, format, ##__VA_ARGS__)
|
||||
|
||||
/*******************************Api Functions*********************************/
|
||||
static int spi_flash_sfud_init(void)
|
||||
{
|
||||
if (RT_NULL == rt_sfud_flash_probe("flash2", "spi02"))
|
||||
{
|
||||
rt_kprintf("rt_sfud_flash_probe failed\n");
|
||||
return RT_ERROR;
|
||||
}
|
||||
spim_flash = rt_sfud_flash_find_by_dev_name("flash2");
|
||||
if (RT_NULL == spim_flash)
|
||||
{
|
||||
rt_kprintf("Flash init failed -> can't find flash2 device!\n");
|
||||
return RT_ERROR;
|
||||
}
|
||||
rt_kprintf("Spi flash device flash2 init\n");
|
||||
rt_kprintf("Flash device: flash2 info\nmf_id: 0x%x\ntype_id: 0x%x\ncapacity_id: 0x%x\nerase granularity: %lu\n",
|
||||
spim_flash->chip.mf_id,
|
||||
spim_flash->chip.type_id,
|
||||
spim_flash->chip.capacity_id,
|
||||
spim_flash->chip.erase_gran);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
INIT_DEVICE_EXPORT(spi_flash_sfud_init);
|
||||
|
||||
/* format the flash with elm environment */
|
||||
static int flash_format_operation(void)
|
||||
{
|
||||
int result = RT_EOK;
|
||||
result = dfs_mkfs("elm", "flash2");
|
||||
return result;
|
||||
}
|
||||
INIT_ENV_EXPORT(flash_format_operation);
|
||||
|
||||
#endif /* RT_USING_SFUD || RT_USING_DFS */
|
||||
@@ -1,17 +1,23 @@
|
||||
# Phytium-Standalone-SDK
|
||||
|
||||
**v0.3.1** [ReleaseNote](./doc/ChangeLog.md)
|
||||
**v1.0.0** [ReleaseNote](./doc/ChangeLog.md)
|
||||
|
||||
## 1. 项目概要
|
||||
|
||||
### 1.1 基本介绍
|
||||
### 1.1 仓库介绍
|
||||
|
||||
本项目代码仓库整体共分为两个分支:
|
||||
master 分支:开发分支,用于保存最新的协作开发代码以及bug修复后的代码。其只要求保障新功能基本正确并且能够满足基本的使用需求,并没有经过系统性和复杂条件下的测试。
|
||||
release 分支:发布分支,包含核心启动代码、芯片外设驱动、用户使用例程和构建的脚本工具。用于保存经过系统性测试的代码并对外发布版本,默认下载此分支的代码。
|
||||
|
||||
### 1.2 基本介绍
|
||||
|
||||
本项目发布了 Phytium 系列 CPU 的 嵌入式软件开发工具包,包括板级支持包、第三方开源中间件、交叉编译构建工具、及其 Baremetal 参考例程,在支持多平台裸机应用开发的基础上,能够为多种RTOS提供外设驱动和配置构建工具。
|
||||
|
||||

|
||||
|
||||
|
||||
### 1.2 系统架构
|
||||
### 1.3 系统架构
|
||||
|
||||
|
||||
本项目的整体设计如下所示,自下而上可以分为平台层、组件层、框架层和应用层。
|
||||
@@ -26,7 +32,7 @@
|
||||
|
||||
- 应用层(Application)提供了应用开发模板和例程,帮助开发者迅速熟悉SDK的使用,进行不同类型的应用程序开发
|
||||
|
||||
### 1.3. 源代码结构
|
||||
### 1.4 源代码结构
|
||||
|
||||
```
|
||||
.
|
||||
@@ -105,9 +111,8 @@ FT-2000/4 是一款面向桌面应用的高性能通用 4 核处理器。每 2
|
||||
- 集成 34 Lane PCIE3.0 接口:2 个 X16(每个可拆分成 2 个 X8),2 个 X1
|
||||
- 集成 2 个 GMAC,RGMII 接口,支持 10/100/1000 自适应
|
||||
- 集成 1 个 SD 卡控制器,兼容 SD 2.0 规范
|
||||
- 集成 1 个 HDAudio,支持音频输出,可同时支持最多 4 个 Codec
|
||||
- 集成 SM2、SM3、SM4 模块
|
||||
- 集成 4 个 UART,1 个 LPC,32 个 GPIO,4 个 I2C,1 个 QSPI,2 个通 用 SPI,2 个 WDT,16 个外部中断(和 GPIO 共用 IO)
|
||||
- 集成 加密计算单元
|
||||
- 集成 4 个 UART,32 个 GPIO,4 个 I2C,1 个 QSPI,2 个通 用 SPI,2 个 WDT,16 个外部中断(和 GPIO 共用 IO)
|
||||
- 集成温度传感器
|
||||
|
||||
### 3.2 D2000
|
||||
@@ -123,39 +128,55 @@ D2000 是一款面向桌面应用的高性能通用 8 核处理器。每 2 个
|
||||
- 集成 1 个 SD 卡控制器,兼容 SD 2.0 规范
|
||||
- 集成 1 个 HDAudio,支持音频输出,可同时支持最多 4 个 Codec
|
||||
- 集成 SM2、SM3、SM4、SM9 模块
|
||||
- 集成 4 个 UART,1 个 LPC,32 个 GPIO,4 个 I2C,1 个 QSPI,2 个通用 SPI,2 个 WDT,16 个外部中断(和 GPIO 共用 IO)
|
||||
- 集成 4 个 UART,32 个 GPIO,4 个 I2C,1 个 QSPI,2 个通用 SPI,2 个 WDT,16 个外部中断(和 GPIO 共用 IO)
|
||||
- 集成 2 个温度传感器
|
||||
|
||||
### 3.3 E2000Q
|
||||
|
||||
### 3.3 E2000D
|
||||
|
||||
- E2000D 1个cluster有2个cpu,共两核。主要技术特征如下:
|
||||
- E2000Q 集成2个FTC664核和2个FTC310核。主要技术特征如下:
|
||||
|
||||
- 兼容ARM v8 64 位指令系统,兼容32 位指令
|
||||
- 集成 1 路 16 通道 General DMA 和 1 路 8 通道 Device DMA
|
||||
- 支持单精度、双精度浮点运算指令
|
||||
- L1有32KB,L2有256KB
|
||||
- 集成1个DDR4 通道,可对DDR 存储数据进行实时加密
|
||||
- 集成4 Lane PCIE3.0 接口(4X1)
|
||||
- 集成网络接口4x1000M SGMII,1路支持RGMII/RMII,支持1路TSN
|
||||
- 集成2个USB2.0(OTG)接口
|
||||
- 集成1个HDAudio,支持音频输出;2路DP显示接口
|
||||
- 两个 FTC664 核各包含 1MB 私有 L2 Cache,由两个 FTC310 核组成的Cluster 内含 256KB 共享的 L2 Cache
|
||||
- 集成1个DDR4 通道
|
||||
- 集成6Lane PCIE3.0 接口(X4+2*X1 、X2+4*X2、6*X1)
|
||||
- 集成4个1000M以太网控制器,支持2路SGMII接口和2路SGMII/RGMII接口
|
||||
- 集成3路USB2.0(OTG)和2路USB3.0(兼容 2.0)
|
||||
- 集成2路SATA3.0模块
|
||||
- 集成常用低速接口:WDT,DMAC,QSPI,PWM,Nand,SD/SDIO/eMMC ,SPI_M,UART,I2C,MIO,CAN, LPC_M_S,GPIO,LBC,Timer
|
||||
- 2路 DisplayPort1.4 接口
|
||||
- 集成常用低速接口:WDT、QSPI、PWM、Nand、SD/SDIO/eMMC 、SPI_M、UART、I2C、I2S、MIO、CAN-FD、GPIO、LocalBus、Timer
|
||||
|
||||
### 3.4 E2000S
|
||||
### 3.4 E2000D
|
||||
|
||||
- E2000S 1个cluster有1个cpu,单核结构。主要技术特征如下:
|
||||
- E2000D 集成 2 个 FTC310 核。主要技术特征如下:
|
||||
|
||||
- 兼容ARM v8 64 位指令系统,兼容32 位指令
|
||||
- 集成 1 路 16 通道 General DMA 和 1 路 8 通道 Device DMA
|
||||
- 支持单精度、双精度浮点运算指令
|
||||
- L1有32KB,L2有256KB
|
||||
- 集成1个DDR4 通道,可对DDR 存储数据进行实时加密
|
||||
- L2 Cache 有256KB
|
||||
- 集成1个DDR4 通道
|
||||
- 集成4 Lane PCIE3.0 接口(4X1)
|
||||
- 集成4个1000M以太网控制器,支持 2 路 SGMII 接口和 2 路 SGMII/RGMII 接口
|
||||
- 集成3路USB2.0(OTG)和2路USB3.0(兼容 2.0)
|
||||
- 集成2路SATA3.0模块
|
||||
- 2路 DisplayPort1.4 接口
|
||||
- 集成常用低速接口:WDT,QSPI,PWM,Nand,SD/SDIO/eMMC ,SPI_M,UART,I2C,MIO,CAN-FD,GPIO,LocalBus,Timer
|
||||
|
||||
### 3.5 E2000S
|
||||
|
||||
- E2000S 集成 1 个 FTC310 核,单核结构。主要技术特征如下:
|
||||
|
||||
- 兼容ARM v8 64 位指令系统,兼容32 位指令
|
||||
- 集成 1 路 16 通道 General DMA 和 1 路 8 通道 Device DMA
|
||||
- 支持单精度、双精度浮点运算指令
|
||||
- L2 Cache 有256KB
|
||||
- 集成1个DDR4 通道
|
||||
- 集成2 Lane PCIE3.0 接口(2X1)
|
||||
- 集成网络接口2x1000M SGMII/RGMII/RMII,支持2路NCSI
|
||||
- 集成2个USB2.0(OTG)接口
|
||||
- 集成1个HDAudio,支持音频输出;2路DP显示接口
|
||||
- 集成JPEG Encoder模块
|
||||
- 集成常用低速接口:WDT,DMAC,PWM,QSPI,SD/SDIO/eMMC,SPI_M,UART,I2C,MIO,I3C,PMBUS, LPC_M_S,GPIO,oneWire,Timer
|
||||
- 集成3个1000M以太网控制器,支持1路SGMII接口和2路RGMII/RMII接口
|
||||
- 集成1路USB2.0(Device)和2路USB2.0(OTG)
|
||||
- 2路 DisplayPort1.4 接口
|
||||
- 集成常用低速接口:WDT、DMAC、PWM、QSPI、SD/SDIO/eMMC、SPI Master、UART、I2C、MIO、I3C、PMBUS、GPIO、SGPIO、One-Wire、Timer、One-Wire
|
||||
|
||||
|
||||
## 4 外设驱动支持情况
|
||||
@@ -200,6 +221,7 @@ D2000 是一款面向桌面应用的高性能通用 8 核处理器。每 2 个
|
||||
| OpenAMP | FT2000/4<br>D2000<br>E2000 | | openamp |
|
||||
| LittleFS-2.4.2 | | FT2000/4<br>E2000<br>D2000 | littlefs-2.4.2 |
|
||||
| SPIFFS-0.3.7 | FT2000/4<br>D2000<br>E2000 | | spiffs-0.3.7 |
|
||||
| freemodbus-v1.6 | E2000 | | protocols/fmodbus_test |
|
||||
|
||||
---
|
||||
|
||||
@@ -241,6 +263,8 @@ D2000 是一款面向桌面应用的高性能通用 8 核处理器。每 2 个
|
||||
|
||||
#### 5.1.17 [FSDIO](./doc/reference/driver/fsdio.md)
|
||||
|
||||
#### 5.1.18 [FMEDIA](doc/reference/driver/fmedia.md)
|
||||
|
||||
### 5.2 MEMORY
|
||||
#### 5.2.1 [FMEMORY_POOL](./doc/reference/sdk/fmemory_pool.md)
|
||||
|
||||
@@ -266,6 +290,13 @@ wangxiaodong1030@phytium.com.cn
|
||||
|
||||
liushengming1118@phytium.com.cn
|
||||
|
||||
wangzongqiang1322@phytium.com.cn
|
||||
|
||||
liqiaozhong1404@phytium.com.cn
|
||||
|
||||
liuzhihong1235@phytium.com.cn
|
||||
|
||||
zhangyan1491@phytium.com.cn
|
||||
|
||||
---
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,154 +0,0 @@
|
||||
/*
|
||||
* Copyright : (C) 2022 Phytium Information Technology, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This program is OPEN SOURCE software: you can redistribute it and/or modify it
|
||||
* under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd,
|
||||
* either version 1.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the Phytium Public License for more details.
|
||||
*
|
||||
*
|
||||
* FilePath: generic_timer.c
|
||||
* Date: 2022-02-10 14:53:41
|
||||
* LastEditTime: 2022-02-17 17:30:07
|
||||
* Description: This files is for
|
||||
*
|
||||
* Modify History:
|
||||
* Ver Who Date Changes
|
||||
* ----- ------ -------- --------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#include "fparameters.h"
|
||||
#include "fgeneric_timer.h"
|
||||
#include "faarch32.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#ifndef SDK_CONFIG_H__
|
||||
#warning "Please include sdkconfig.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_SYS_TICK
|
||||
#include "fassert.h"
|
||||
#include "finterrupt.h"
|
||||
|
||||
static volatile u32 genericTick;
|
||||
static GenericTimerTickHandler usr_tick_handler = NULL;
|
||||
#endif
|
||||
|
||||
#define AARCH32_CNTP_CTL_ENABLE_MASK (1ul << 0)
|
||||
#define AARCH32_CNTP_CTL_INTERRUPT_MASK (1ul << 1)
|
||||
|
||||
void GenericTimerStart(void)
|
||||
{
|
||||
u32 ctrl = aarch32_cntp_ctl_get();
|
||||
|
||||
if (!(ctrl & AARCH32_CNTP_CTL_ENABLE_MASK))
|
||||
{
|
||||
ctrl |= AARCH32_CNTP_CTL_ENABLE_MASK;
|
||||
aarch32_cntp_ctl_set(ctrl);
|
||||
}
|
||||
}
|
||||
|
||||
void GenericTimerStop(void)
|
||||
{
|
||||
u32 ctrl = aarch32_cntp_ctl_get();
|
||||
if ((ctrl & AARCH32_CNTP_CTL_ENABLE_MASK))
|
||||
{
|
||||
ctrl &= ~AARCH32_CNTP_CTL_ENABLE_MASK;
|
||||
aarch32_cntp_ctl_set(ctrl);
|
||||
}
|
||||
}
|
||||
|
||||
void GenericTimerInterruptEnable(void)
|
||||
{
|
||||
u32 ctrl = aarch32_cntp_ctl_get();
|
||||
if (ctrl & AARCH32_CNTP_CTL_INTERRUPT_MASK)
|
||||
{
|
||||
ctrl &= ~AARCH32_CNTP_CTL_INTERRUPT_MASK;
|
||||
aarch32_cntp_ctl_set(ctrl);
|
||||
}
|
||||
}
|
||||
|
||||
void GenericTimerInterruptDisable(void)
|
||||
{
|
||||
u64 ctrl = aarch32_cntp_ctl_get();
|
||||
if (!(ctrl & AARCH32_CNTP_CTL_INTERRUPT_MASK))
|
||||
{
|
||||
ctrl |= AARCH32_CNTP_CTL_INTERRUPT_MASK;
|
||||
aarch32_cntp_ctl_set(ctrl);
|
||||
}
|
||||
}
|
||||
|
||||
u32 GenericTimerFrequecy(void)
|
||||
{
|
||||
u32 rate = aarch32_cntfrq_get();
|
||||
return (rate != 0) ? rate : 1000000;
|
||||
}
|
||||
|
||||
u64 GenericTimerRead(void)
|
||||
{
|
||||
return aarch32_cntpct_get();
|
||||
}
|
||||
|
||||
void GenericTimerCompare(u32 interval)
|
||||
{
|
||||
aarch32_cntp_tval_set(interval);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_USE_SYS_TICK
|
||||
static void GenericTimerClearTickIntr(u32 tickRateHz)
|
||||
{
|
||||
GenericTimerCompare(GenericTimerFrequecy() / tickRateHz);
|
||||
}
|
||||
|
||||
static void GenericTimerTickIntrHandler(s32 vector, void *param)
|
||||
{
|
||||
u32 tickRateHz = (u32)param;
|
||||
(void)vector;
|
||||
genericTick++; /* tick */
|
||||
GenericTimerClearTickIntr(tickRateHz); /* clear tick intrrupt */
|
||||
|
||||
if (usr_tick_handler) /* execute user handler */
|
||||
usr_tick_handler();
|
||||
}
|
||||
#endif
|
||||
|
||||
void GenericTimerSetupSystick(u32 tickRateHz, GenericTimerTickHandler tickHandler, u32 intrPrority)
|
||||
{
|
||||
#ifdef CONFIG_USE_SYS_TICK
|
||||
u32 cntFrq;
|
||||
|
||||
/* disable timer and get system frequency */
|
||||
GenericTimerStop();
|
||||
cntFrq = GenericTimerFrequecy();
|
||||
|
||||
/* set tick rate */
|
||||
GenericTimerCompare(cntFrq / tickRateHz);
|
||||
GenericTimerInterruptEnable();
|
||||
|
||||
/* set generic timer intrrupt */
|
||||
InterruptSetPriority(GENERIC_TIMER_NS_IRQ_NUM, intrPrority);
|
||||
|
||||
/* install tick handler */
|
||||
usr_tick_handler = tickHandler;
|
||||
InterruptInstall(GENERIC_TIMER_NS_IRQ_NUM, GenericTimerTickIntrHandler,
|
||||
(void *)tickRateHz, "GenericTimerTick");
|
||||
|
||||
/* enable intrrupt */
|
||||
InterruptUmask(GENERIC_TIMER_NS_IRQ_NUM);
|
||||
GenericTimerStart();
|
||||
#endif
|
||||
}
|
||||
|
||||
u32 GenericGetTick(void)
|
||||
{
|
||||
#ifdef CONFIG_USE_SYS_TICK
|
||||
return genericTick;
|
||||
#else
|
||||
return 0xffU;
|
||||
#endif
|
||||
}
|
||||
@@ -11,19 +11,22 @@ menu "Board Configuration"
|
||||
|
||||
config TARGET_D2000
|
||||
bool "D2000"
|
||||
|
||||
|
||||
config TARGET_E2000Q
|
||||
bool "E2000Q"
|
||||
select TARGET_E2000
|
||||
|
||||
|
||||
config TARGET_E2000D
|
||||
bool "E2000D"
|
||||
select TARGET_E2000
|
||||
|
||||
|
||||
config TARGET_E2000S
|
||||
bool "E2000S"
|
||||
select TARGET_E2000
|
||||
|
||||
# config TARGET_TARDIGRADE
|
||||
# bool "TARDIGRADE"
|
||||
|
||||
endchoice # BUILD_TARGET_CHIP_TYPE
|
||||
|
||||
# an invisible config to define common code of E2000 Q/D/S
|
||||
@@ -43,7 +46,7 @@ menu "Board Configuration"
|
||||
config DEFAULT_DEBUG_PRINT_UART2
|
||||
bool "Use uart2"
|
||||
endchoice # DEBUG_PRINT_UART
|
||||
|
||||
|
||||
|
||||
endmenu
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* FilePath: _cpu_asm.S
|
||||
* Date: 2022-02-10 14:53:42
|
||||
* LastEditTime: 2022-02-17 17:57:55
|
||||
* Description: This files is for
|
||||
* Description: This file is for
|
||||
*
|
||||
* Modify History:
|
||||
* Ver Who Date Changes
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -14,7 +14,7 @@
|
||||
* FilePath: early_uart.c
|
||||
* Date: 2022-02-11 13:33:28
|
||||
* LastEditTime: 2022-02-17 17:59:26
|
||||
* Description: This files is for
|
||||
* Description: This file is for
|
||||
*
|
||||
* Modify History:
|
||||
* Ver Who Date Changes
|
||||
+3
-3
@@ -14,15 +14,15 @@
|
||||
* FilePath: fearly_uart.h
|
||||
* Date: 2022-02-11 13:33:28
|
||||
* LastEditTime: 2022-02-17 18:00:16
|
||||
* Description: This files is for
|
||||
* Description: This file is for
|
||||
*
|
||||
* Modify History:
|
||||
* Ver Who Date Changes
|
||||
* ----- ------ -------- --------------------------------------
|
||||
* 1.0 rtos 2022/6/25 init commit
|
||||
*/
|
||||
#ifndef BOARD_E2000_EARLY_UART_H
|
||||
#define BOARD_E2000_EARLY_UART_H
|
||||
#ifndef BOARD_COMMON_EARLY_UART_H
|
||||
#define BOARD_COMMON_EARLY_UART_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright : (C) 2022 Phytium Information Technology, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This program is OPEN SOURCE software: you can redistribute it and/or modify it
|
||||
* under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd,
|
||||
* either version 1.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the Phytium Public License for more details.
|
||||
*
|
||||
*
|
||||
* FilePath: fioctrl.h
|
||||
* Date: 2022-02-10 14:53:42
|
||||
* LastEditTime: 2022-02-18 08:25:35
|
||||
* Description: This files is for io-ctrl function definition (io-mux/io-config/io-delay)
|
||||
*
|
||||
* Modify History:
|
||||
* Ver Who Date Changes
|
||||
* ----- ------ -------- --------------------------------------
|
||||
* 1.0 zhugengyu 2022/2/22 init commit
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BOARD_D2000_FIOCTRL_H
|
||||
#define BOARD_D2000_FIOCTRL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
#include "ftypes.h"
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
|
||||
/**************************** Type Definitions *******************************/
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
#define FIOCTRL_INDEX(offset, func_beg) \
|
||||
{ \
|
||||
/* reg_off */ (offset), \
|
||||
/* reg_bit */ (func_beg) \
|
||||
}
|
||||
|
||||
/************************** Variable Definitions *****************************/
|
||||
#define FIOCTRL_CRU_CLK_OBV_PAD (FPinIndex)FIOCTRL_INDEX(0x200, 24)
|
||||
#define FIOCTRL_SPI0_CSN0_PAD (FPinIndex)FIOCTRL_INDEX(0x208, 16)
|
||||
#define FIOCTRL_SPI0_SCK_PAD (FPinIndex)FIOCTRL_INDEX(0x208, 12)
|
||||
#define FIOCTRL_SPI0_SO_PAD (FPinIndex)FIOCTRL_INDEX(0x208, 8)
|
||||
#define FIOCTRL_SPI0_SI_PAD (FPinIndex)FIOCTRL_INDEX(0x208, 4)
|
||||
|
||||
#define FIOCTRL_TJTAG_TDI_PAD (FPinIndex)FIOCTRL_INDEX(0x204, 24) /* can0-tx: func 1 */
|
||||
#define FIOCTRL_SWDITMS_SWJ_PAD (FPinIndex)FIOCTRL_INDEX(0x204, 12) /* can0-rx: func 1 */
|
||||
|
||||
#define FIOCTRL_NTRST_SWJ_PAD (FPinIndex)FIOCTRL_INDEX(0x204, 20) /* can1-tx: func 1 */
|
||||
#define FIOCTRL_SWDO_SWJ_PAD (FPinIndex)FIOCTRL_INDEX(0x204, 8) /* can1-rx: func 1 */
|
||||
|
||||
#define FIOCTRL_I2C0_SCL_PAD (FPinIndex)FIOCTRL_INDEX(0x208, 24) /* i2c0-scl: func 0 */
|
||||
#define FIOCTRL_I2C0_SDA_PAD (FPinIndex)FIOCTRL_INDEX(0x208, 20) /* i2c0-sda: func 0 */
|
||||
#define FIOCTRL_ALL_PLL_LOCK_PAD (FPinIndex)FIOCTRL_INDEX(0x200, 28) /* i2c1-scl: func 2 */
|
||||
#define FIOCTRL_CRU_CLK_OBV_PAD (FPinIndex)FIOCTRL_INDEX(0x200, 24) /* i2c1-sda: func 2 */
|
||||
#define FIOCTRL_SWDO_SWJ_PAD (FPinIndex)FIOCTRL_INDEX(0x204, 8) /* i2c2-scl: func 2 */
|
||||
#define FIOCTRL_TDO_SWJ_IN_PAD (FPinIndex)FIOCTRL_INDEX(0x204, 4) /* i2c2-sda: func 2 */
|
||||
#define FIOCTRL_HDT_MB_DONE_STATE_PAD (FPinIndex)FIOCTRL_INDEX(0x204, 0) /* i2c3-scl: func 2 */
|
||||
#define FIOCTRL_HDT_MB_FAIL_STATE_PAD (FPinIndex)FIOCTRL_INDEX(0x208, 28) /* i2c3-sda: func 2 */
|
||||
|
||||
#define FIOCTRL_UART_2_RXD_PAD (FPinIndex)FIOCTRL_INDEX(0x210, 0) /* spi1_csn0: func 1 */
|
||||
#define FIOCTRL_UART_2_TXD_PAD (FPinIndex)FIOCTRL_INDEX(0x214, 28) /* spi1_sck: func 1 */
|
||||
#define FIOCTRL_UART_3_RXD_PAD (FPinIndex)FIOCTRL_INDEX(0x214, 24) /* spi1_so: func 1 */
|
||||
#define FIOCTRL_UART_3_TXD_PAD (FPinIndex)FIOCTRL_INDEX(0x214, 20) /* spi1_si: func 1 */
|
||||
#define FIOCTRL_QSPI_CSN2_PAD (FPinIndex)FIOCTRL_INDEX(0x214, 8) /* spi1_csn1: func 1 */
|
||||
#define FIOCTRL_QSPI_CSN3_PAD (FPinIndex)FIOCTRL_INDEX(0x214, 4) /* spi1_csn2: func 1 */
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,7 @@
|
||||
* FilePath: fparameters.h
|
||||
* Date: 2022-02-11 13:33:28
|
||||
* LastEditTime: 2022-02-17 18:00:50
|
||||
* Description: This files is for
|
||||
* Description: This file is for
|
||||
*
|
||||
* Modify History:
|
||||
* Ver Who Date Changes
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* FilePath: fiopad_comm.c
|
||||
* Date: 2022-02-10 14:53:42
|
||||
* LastEditTime: 2022-02-18 08:25:29
|
||||
* Description: This files is for io-pad function definition
|
||||
* Description: This file is for io-pad function definition
|
||||
*
|
||||
* Modify History:
|
||||
* Ver Who Date Changes
|
||||
@@ -202,7 +202,7 @@ void FPinGetConfig(const FPinIndex pin, FPinFunc *func, FPinPull *pull, FPinDriv
|
||||
|
||||
if (drive)
|
||||
{
|
||||
*pull = FIOPAD_X_REG0_DRIVE_GET(reg_val);
|
||||
*drive = FIOPAD_X_REG0_DRIVE_GET(reg_val);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -331,16 +331,24 @@ boolean FPinGetDelayEn(const FPinIndex pin, FPinDelayDir dir)
|
||||
if (FPIN_OUTPUT_DELAY == dir)
|
||||
{
|
||||
if (FIOPAD_X_REG1_OUT_DELAY_EN & reg_val)
|
||||
{
|
||||
enabled = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
enabled = FALSE;
|
||||
}
|
||||
}
|
||||
else if (FPIN_INPUT_DELAY == dir)
|
||||
{
|
||||
if (FIOPAD_X_REG1_IN_DELAY_EN & reg_val)
|
||||
{
|
||||
enabled = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
enabled = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -424,16 +432,24 @@ void FPinSetDelayEn(const FPinIndex pin, FPinDelayDir dir, boolean enable)
|
||||
if (FPIN_OUTPUT_DELAY == dir)
|
||||
{
|
||||
if (enable)
|
||||
{
|
||||
reg_val |= FIOPAD_X_REG1_OUT_DELAY_EN;
|
||||
}
|
||||
else
|
||||
{
|
||||
reg_val &= ~FIOPAD_X_REG1_OUT_DELAY_EN;
|
||||
}
|
||||
}
|
||||
else if (FPIN_INPUT_DELAY == dir)
|
||||
{
|
||||
if (enable)
|
||||
{
|
||||
reg_val |= FIOPAD_X_REG1_IN_DELAY_EN;
|
||||
}
|
||||
else
|
||||
{
|
||||
reg_val &= ~FIOPAD_X_REG1_IN_DELAY_EN;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -17,10 +17,10 @@ extern "C"
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
#define FIOPAD_INDEX(offset) \
|
||||
{ \
|
||||
{ \
|
||||
/* reg_off */ (offset), \
|
||||
/* reg_bit */ (0) \
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* register offset of iopad function / pull / driver strength */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,7 @@
|
||||
* FilePath: fparameters.h
|
||||
* Date: 2022-02-11 13:33:28
|
||||
* LastEditTime: 2022-02-17 18:00:50
|
||||
* Description: This files is for
|
||||
* Description: This file is for
|
||||
*
|
||||
* Modify History:
|
||||
* Ver Who Date Changes
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,7 @@
|
||||
* FilePath: fparameters.h
|
||||
* Date: 2022-02-11 13:33:28
|
||||
* LastEditTime: 2022-02-17 18:00:50
|
||||
* Description: This files is for
|
||||
* Description: This file is for
|
||||
*
|
||||
* Modify History:
|
||||
* Ver Who Date Changes
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright : (C) 2022 Phytium Information Technology, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This program is OPEN SOURCE software: you can redistribute it and/or modify it
|
||||
* under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd,
|
||||
* either version 1.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the Phytium Public License for more details.
|
||||
*
|
||||
*
|
||||
* FilePath: fioctrl.h
|
||||
* Date: 2022-02-10 14:53:42
|
||||
* LastEditTime: 2022-02-18 08:25:35
|
||||
* Description: This files is for io-ctrl function definition (io-mux/io-config/io-delay)
|
||||
*
|
||||
* Modify History:
|
||||
* Ver Who Date Changes
|
||||
* ----- ------ -------- --------------------------------------
|
||||
* 1.0 zhugengyu 2022/2/22 init commit
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BOARD_D2000_FIOCTRL_H
|
||||
#define BOARD_D2000_FIOCTRL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
#include "ftypes.h"
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
|
||||
/**************************** Type Definitions *******************************/
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
#define FIOCTRL_INDEX(offset, func_beg) \
|
||||
{ \
|
||||
/* reg_off */ (offset), \
|
||||
/* reg_bit */ (func_beg) \
|
||||
}
|
||||
|
||||
/************************** Variable Definitions *****************************/
|
||||
#define FIOCTRL_CRU_CLK_OBV_PAD (FPinIndex)FIOCTRL_INDEX(0x200, 24)
|
||||
#define FIOCTRL_SPI0_CSN0_PAD (FPinIndex)FIOCTRL_INDEX(0x208, 16)
|
||||
#define FIOCTRL_SPI0_SCK_PAD (FPinIndex)FIOCTRL_INDEX(0x208, 12)
|
||||
#define FIOCTRL_SPI0_SO_PAD (FPinIndex)FIOCTRL_INDEX(0x208, 8)
|
||||
#define FIOCTRL_SPI0_SI_PAD (FPinIndex)FIOCTRL_INDEX(0x208, 4)
|
||||
|
||||
#define FIOCTRL_TJTAG_TDI_PAD (FPinIndex)FIOCTRL_INDEX(0x204, 24) /* can0-tx: func 1 */
|
||||
#define FIOCTRL_SWDITMS_SWJ_PAD (FPinIndex)FIOCTRL_INDEX(0x204, 12) /* can0-rx: func 1 */
|
||||
|
||||
#define FIOCTRL_NTRST_SWJ_PAD (FPinIndex)FIOCTRL_INDEX(0x204, 20) /* can1-tx: func 1 */
|
||||
#define FIOCTRL_SWDO_SWJ_PAD (FPinIndex)FIOCTRL_INDEX(0x204, 8) /* can1-rx: func 1 */
|
||||
|
||||
#define FIOCTRL_I2C0_SCL_PAD (FPinIndex)FIOCTRL_INDEX(0x208, 24) /* i2c0-scl: func 0 */
|
||||
#define FIOCTRL_I2C0_SDA_PAD (FPinIndex)FIOCTRL_INDEX(0x208, 20) /* i2c0-sda: func 0 */
|
||||
#define FIOCTRL_ALL_PLL_LOCK_PAD (FPinIndex)FIOCTRL_INDEX(0x200, 28) /* i2c1-scl: func 2 */
|
||||
#define FIOCTRL_CRU_CLK_OBV_PAD (FPinIndex)FIOCTRL_INDEX(0x200, 24) /* i2c1-sda: func 2 */
|
||||
#define FIOCTRL_SWDO_SWJ_PAD (FPinIndex)FIOCTRL_INDEX(0x204, 8) /* i2c2-scl: func 2 */
|
||||
#define FIOCTRL_TDO_SWJ_IN_PAD (FPinIndex)FIOCTRL_INDEX(0x204, 4) /* i2c2-sda: func 2 */
|
||||
#define FIOCTRL_HDT_MB_DONE_STATE_PAD (FPinIndex)FIOCTRL_INDEX(0x204, 0) /* i2c3-scl: func 2 */
|
||||
#define FIOCTRL_HDT_MB_FAIL_STATE_PAD (FPinIndex)FIOCTRL_INDEX(0x208, 28) /* i2c3-sda: func 2 */
|
||||
|
||||
#define FIOCTRL_UART_2_RXD_PAD (FPinIndex)FIOCTRL_INDEX(0x210, 0) /* spi1_csn0: func 1 */
|
||||
#define FIOCTRL_UART_2_TXD_PAD (FPinIndex)FIOCTRL_INDEX(0x214, 28) /* spi1_sck: func 1 */
|
||||
#define FIOCTRL_UART_3_RXD_PAD (FPinIndex)FIOCTRL_INDEX(0x214, 24) /* spi1_so: func 1 */
|
||||
#define FIOCTRL_UART_3_TXD_PAD (FPinIndex)FIOCTRL_INDEX(0x214, 20) /* spi1_si: func 1 */
|
||||
#define FIOCTRL_QSPI_CSN2_PAD (FPinIndex)FIOCTRL_INDEX(0x214, 8) /* spi1_csn1: func 1 */
|
||||
#define FIOCTRL_QSPI_CSN3_PAD (FPinIndex)FIOCTRL_INDEX(0x214, 4) /* spi1_csn2: func 1 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user