From 6aa24455221e7e3974affe8f43f7f5a9e65156fa Mon Sep 17 00:00:00 2001 From: Yaochenger <1516081466@qq.com> Date: Thu, 2 Mar 2023 18:05:22 +0800 Subject: [PATCH] =?UTF-8?q?[libcpu/risc-v]=E7=A7=BB=E9=99=A4bumblebee?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A4=B9=E4=B8=8Enuclei=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A4=B9=E4=B8=AD=E7=9A=84=E5=86=85=E5=AE=B9=E8=87=B3bsp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../risc-v/gd32vf103r-start/board/SConscript | 1 + .../risc-v/gd32vf103r-start/board}/trap_gcc.S | 0 .../risc-v/gd32vf103v-eval/board/SConscript | 1 + .../risc-v/gd32vf103v-eval/board}/trap_gcc.S | 0 bsp/gd32vf103v-eval/board/SConscript | 5 ++++- bsp/gd32vf103v-eval/board/trap_gcc.S | 18 ++++++++++++++++++ bsp/nuclei/gd32vf103_rvstar/board/SConscript | 5 ++++- bsp/nuclei/gd32vf103_rvstar/board/trap_gcc.S | 18 ++++++++++++++++++ bsp/nuclei/nuclei_fpga_eval/board/SConscript | 5 ++++- bsp/nuclei/nuclei_fpga_eval/board/trap_gcc.S | 18 ++++++++++++++++++ libcpu/risc-v/bumblebee/SConscript | 14 -------------- libcpu/risc-v/nuclei/SConscript | 14 -------------- 12 files changed, 68 insertions(+), 31 deletions(-) rename {libcpu/risc-v/bumblebee => bsp/gd32/risc-v/gd32vf103r-start/board}/trap_gcc.S (100%) rename {libcpu/risc-v/nuclei => bsp/gd32/risc-v/gd32vf103v-eval/board}/trap_gcc.S (100%) create mode 100644 bsp/gd32vf103v-eval/board/trap_gcc.S create mode 100644 bsp/nuclei/gd32vf103_rvstar/board/trap_gcc.S create mode 100644 bsp/nuclei/nuclei_fpga_eval/board/trap_gcc.S delete mode 100644 libcpu/risc-v/bumblebee/SConscript delete mode 100644 libcpu/risc-v/nuclei/SConscript diff --git a/bsp/gd32/risc-v/gd32vf103r-start/board/SConscript b/bsp/gd32/risc-v/gd32vf103r-start/board/SConscript index 3f96726e36..92999ebda7 100644 --- a/bsp/gd32/risc-v/gd32vf103r-start/board/SConscript +++ b/bsp/gd32/risc-v/gd32vf103r-start/board/SConscript @@ -9,6 +9,7 @@ cwd = GetCurrentDir() # add general drivers src = Split(''' board.c +trap_gcc.S ''') path = [cwd] diff --git a/libcpu/risc-v/bumblebee/trap_gcc.S b/bsp/gd32/risc-v/gd32vf103r-start/board/trap_gcc.S similarity index 100% rename from libcpu/risc-v/bumblebee/trap_gcc.S rename to bsp/gd32/risc-v/gd32vf103r-start/board/trap_gcc.S diff --git a/bsp/gd32/risc-v/gd32vf103v-eval/board/SConscript b/bsp/gd32/risc-v/gd32vf103v-eval/board/SConscript index cb6f98bca2..e9f40f8336 100644 --- a/bsp/gd32/risc-v/gd32vf103v-eval/board/SConscript +++ b/bsp/gd32/risc-v/gd32vf103v-eval/board/SConscript @@ -9,6 +9,7 @@ cwd = GetCurrentDir() # add general drivers src = Split(''' board.c +trap_gcc.S ''') path = [cwd] diff --git a/libcpu/risc-v/nuclei/trap_gcc.S b/bsp/gd32/risc-v/gd32vf103v-eval/board/trap_gcc.S similarity index 100% rename from libcpu/risc-v/nuclei/trap_gcc.S rename to bsp/gd32/risc-v/gd32vf103v-eval/board/trap_gcc.S diff --git a/bsp/gd32vf103v-eval/board/SConscript b/bsp/gd32vf103v-eval/board/SConscript index 148c99f42c..4e68c3dc89 100644 --- a/bsp/gd32vf103v-eval/board/SConscript +++ b/bsp/gd32vf103v-eval/board/SConscript @@ -3,7 +3,10 @@ from building import * cwd = GetCurrentDir() -src = Glob('*.c') +src = Split(''' +board.c +trap_gcc.S +''') CPPPATH = [cwd] group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH) diff --git a/bsp/gd32vf103v-eval/board/trap_gcc.S b/bsp/gd32vf103v-eval/board/trap_gcc.S new file mode 100644 index 0000000000..745e430dee --- /dev/null +++ b/bsp/gd32vf103v-eval/board/trap_gcc.S @@ -0,0 +1,18 @@ +#include "cpuport.h" + + .globl rt_hw_do_after_save_above + .type rt_hw_do_after_save_above,@function +rt_hw_do_after_save_above: + addi sp, sp, -4 + STORE ra, 0 * REGBYTES(sp) + csrr a0, mcause + csrr a1, mepc + mv a2, sp + csrrw ra, 0x07ED, ra + + li t0, 0x08 + csrc mstatus, t0 + + LOAD ra, 0 * REGBYTES(sp) + addi sp, sp, 4 + ret diff --git a/bsp/nuclei/gd32vf103_rvstar/board/SConscript b/bsp/nuclei/gd32vf103_rvstar/board/SConscript index 148c99f42c..4e68c3dc89 100644 --- a/bsp/nuclei/gd32vf103_rvstar/board/SConscript +++ b/bsp/nuclei/gd32vf103_rvstar/board/SConscript @@ -3,7 +3,10 @@ from building import * cwd = GetCurrentDir() -src = Glob('*.c') +src = Split(''' +board.c +trap_gcc.S +''') CPPPATH = [cwd] group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH) diff --git a/bsp/nuclei/gd32vf103_rvstar/board/trap_gcc.S b/bsp/nuclei/gd32vf103_rvstar/board/trap_gcc.S new file mode 100644 index 0000000000..745e430dee --- /dev/null +++ b/bsp/nuclei/gd32vf103_rvstar/board/trap_gcc.S @@ -0,0 +1,18 @@ +#include "cpuport.h" + + .globl rt_hw_do_after_save_above + .type rt_hw_do_after_save_above,@function +rt_hw_do_after_save_above: + addi sp, sp, -4 + STORE ra, 0 * REGBYTES(sp) + csrr a0, mcause + csrr a1, mepc + mv a2, sp + csrrw ra, 0x07ED, ra + + li t0, 0x08 + csrc mstatus, t0 + + LOAD ra, 0 * REGBYTES(sp) + addi sp, sp, 4 + ret diff --git a/bsp/nuclei/nuclei_fpga_eval/board/SConscript b/bsp/nuclei/nuclei_fpga_eval/board/SConscript index 148c99f42c..4e68c3dc89 100644 --- a/bsp/nuclei/nuclei_fpga_eval/board/SConscript +++ b/bsp/nuclei/nuclei_fpga_eval/board/SConscript @@ -3,7 +3,10 @@ from building import * cwd = GetCurrentDir() -src = Glob('*.c') +src = Split(''' +board.c +trap_gcc.S +''') CPPPATH = [cwd] group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH) diff --git a/bsp/nuclei/nuclei_fpga_eval/board/trap_gcc.S b/bsp/nuclei/nuclei_fpga_eval/board/trap_gcc.S new file mode 100644 index 0000000000..745e430dee --- /dev/null +++ b/bsp/nuclei/nuclei_fpga_eval/board/trap_gcc.S @@ -0,0 +1,18 @@ +#include "cpuport.h" + + .globl rt_hw_do_after_save_above + .type rt_hw_do_after_save_above,@function +rt_hw_do_after_save_above: + addi sp, sp, -4 + STORE ra, 0 * REGBYTES(sp) + csrr a0, mcause + csrr a1, mepc + mv a2, sp + csrrw ra, 0x07ED, ra + + li t0, 0x08 + csrc mstatus, t0 + + LOAD ra, 0 * REGBYTES(sp) + addi sp, sp, 4 + ret diff --git a/libcpu/risc-v/bumblebee/SConscript b/libcpu/risc-v/bumblebee/SConscript deleted file mode 100644 index 20f325b692..0000000000 --- a/libcpu/risc-v/bumblebee/SConscript +++ /dev/null @@ -1,14 +0,0 @@ -# RT-Thread building script for component - -from building import * - -Import('rtconfig') - -cwd = GetCurrentDir() -src = Glob('*.c') + Glob('*.cpp') + Glob('*_gcc.S') -CPPPATH = [cwd] -ASFLAGS = '' - -group = DefineGroup('CPU', src, depend = [''], CPPPATH = CPPPATH, ASFLAGS = ASFLAGS) - -Return('group') diff --git a/libcpu/risc-v/nuclei/SConscript b/libcpu/risc-v/nuclei/SConscript deleted file mode 100644 index 07d5b82373..0000000000 --- a/libcpu/risc-v/nuclei/SConscript +++ /dev/null @@ -1,14 +0,0 @@ -# RT-Thread building script for component - -from building import * - -Import('rtconfig') - -cwd = GetCurrentDir() -src = Glob('*.c') + Glob('*.cpp') + Glob('*_gcc.S') -CPPPATH = [cwd] -ASFLAGS = ' -I ' + cwd - -group = DefineGroup('CPU', src, depend = [''], CPPPATH = CPPPATH, ASFLAGS = ASFLAGS) - -Return('group')