b9e4fcfc68
整合libcpu/riscv中的移植文件 提供一份公共代码于common 在提交本pr时,除hpmicro的内核,rv32内核bsp已完成去除大部分的冗余,大部分代码采用common中的实现。本pr的作用是进一步统一common中的文件,从而提供一份公用代码,新移植的RV32内核的BSP可以全部使用common代码。 - 在common中提供一份公用文件:interrupt_gcc.S - 修改原有的文件,将原有的中断中上下文切换代码替换为interrupt_gcc.S - 基于上述修改,修改仓库中risc-v内核的BSP与移植相关的部分 (主要包含中断入口函数 中断栈等) - 在common中提供一份公用文件:trap_common.c;提供统一中断入口函数,中断入口函数初始化,中断入口注册等函数,并完善异常时的信息输出 - 在common中提供一份公用文件:rt_hw_stack_frame.h;将栈帧结构体剥离,供用户使用 - 在上述工作完成后,在上述工作的基础上测试仓库中risc-v内核的BSP - 完善函数中的命名,完善中断栈的获取 - 提供一份详细的基于现有common文件的移植指南 #### 在什么测试环境下测试通过 - 1.CH32V307V-R1-R0 - 2.CH32V208W-R0-1V4 - 3.HPM6750EVKMINI - 4.GD32VF103V-EVAL - 5.qemu(CORE-V-MCU ) > 与上述开发板使用同样芯片的BSP均测试通过 在CH32V307V-R1-R0与HPM6750EVKMINI上基于现有移植文件进行多线程复杂场景下的长时间测试,测试过程系统运行正常。
78 lines
2.3 KiB
Python
78 lines
2.3 KiB
Python
import os
|
|
import platform
|
|
|
|
# toolchains options
|
|
ARCH='risc-v'
|
|
CPU='nuclei'
|
|
CROSS_TOOL='gcc'
|
|
|
|
if os.getenv('RTT_CC'):
|
|
CROSS_TOOL = os.getenv('RTT_CC')
|
|
|
|
if CROSS_TOOL == 'gcc':
|
|
PLATFORM = 'gcc'
|
|
if platform.system().lower() == "windows":
|
|
EXEC_PATH = r'/NucleiStudio/toolchain/gcc/bin'
|
|
else:
|
|
EXEC_PATH = r'~/NucleiStudio/toolchain/gcc/bin'
|
|
if os.path.exists(EXEC_PATH) == False:
|
|
print("Warning: Toolchain path %s doesn't exist, assume it is already in PATH" % EXEC_PATH)
|
|
EXEC_PATH = '' # Don't set path if not exist
|
|
else:
|
|
print("CROSS_TOOL = %s not yet supported" % CROSS_TOOL)
|
|
|
|
if os.getenv('RTT_EXEC_PATH'):
|
|
EXEC_PATH = os.getenv('RTT_EXEC_PATH')
|
|
|
|
BUILD = 'debug'
|
|
# Fixed configurations below
|
|
NUCLEI_SDK_SOC = "demosoc"
|
|
NUCLEI_SDK_BOARD = "nuclei_fpga_eval"
|
|
# Configurable options below
|
|
# DOWNLOAD: https://doc.nucleisys.com/nuclei_sdk/develop/buildsystem.html#download
|
|
NUCLEI_SDK_DOWNLOAD = "ilm"
|
|
# CORE: See https://doc.nucleisys.com/nuclei_sdk/develop/buildsystem.html#core
|
|
NUCLEI_SDK_CORE = "nx600"
|
|
|
|
if PLATFORM == 'gcc':
|
|
# toolchains
|
|
PREFIX = 'riscv-nuclei-elf-'
|
|
CC = PREFIX + 'gcc'
|
|
CXX = PREFIX + 'g++'
|
|
AS = PREFIX + 'gcc'
|
|
AR = PREFIX + 'ar'
|
|
LINK = PREFIX + 'gcc'
|
|
GDB = PREFIX + 'gdb'
|
|
TARGET_EXT = 'elf'
|
|
SIZE = PREFIX + 'size'
|
|
OBJDUMP = PREFIX + 'objdump'
|
|
OBJCPY = PREFIX + 'objcopy'
|
|
|
|
CFLAGS = ' -ffunction-sections -fdata-sections -fno-common '
|
|
AFLAGS = CFLAGS
|
|
LFLAGS = ' --specs=nano.specs --specs=nosys.specs -nostartfiles -Wl,--gc-sections '
|
|
LFLAGS += ' -Wl,-cref,-Map=rtthread.map'
|
|
LFLAGS += ' -u _isatty -u _write -u _sbrk -u _read -u _close -u _fstat -u _lseek '
|
|
CPATH = ''
|
|
LPATH = ''
|
|
LIBS = ['stdc++']
|
|
AFLAGS += ' -D"irq_entry=SW_handler" '
|
|
|
|
if BUILD == 'debug':
|
|
CFLAGS += ' -O2 -ggdb'
|
|
AFLAGS += ' -ggdb'
|
|
else:
|
|
CFLAGS += ' -O2 -Os'
|
|
|
|
CXXFLAGS = CFLAGS
|
|
|
|
DUMP_ACTION = OBJDUMP + ' -D -S $TARGET > rtt.asm\n'
|
|
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
|
|
|
|
def dist_handle(BSP_ROOT, dist_dir):
|
|
import sys
|
|
cwd_path = os.getcwd()
|
|
sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools'))
|
|
from sdk_dist import dist_do_building
|
|
dist_do_building(BSP_ROOT, dist_dir)
|