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上基于现有移植文件进行多线程复杂场景下的长时间测试,测试过程系统运行正常。
201 lines
4.5 KiB
Plaintext
201 lines
4.5 KiB
Plaintext
OUTPUT_ARCH( "riscv" )
|
|
|
|
ENTRY( _start )
|
|
|
|
MEMORY
|
|
{
|
|
/* Run in FLASH */
|
|
flash (rxai!w) : ORIGIN = 0x08000000, LENGTH = 128k
|
|
ram (wxa!ri) : ORIGIN = 0x20000000, LENGTH = 32K
|
|
|
|
/* Run in RAM */
|
|
/* flash (rxai!w) : ORIGIN = 0x20000000, LENGTH = 24k
|
|
ram (wxa!ri) : ORIGIN = 0x20006000, LENGTH = 8K
|
|
*/
|
|
}
|
|
|
|
|
|
SECTIONS
|
|
{
|
|
__stack_size = DEFINED(__stack_size) ? __stack_size : 2K;
|
|
|
|
|
|
.init :
|
|
{
|
|
KEEP (*(SORT_NONE(.init)))
|
|
} >flash AT>flash
|
|
|
|
.ilalign :
|
|
{
|
|
. = ALIGN(4);
|
|
PROVIDE( _ilm_lma = . );
|
|
} >flash AT>flash
|
|
|
|
.ialign :
|
|
{
|
|
PROVIDE( _ilm = . );
|
|
} >flash AT>flash
|
|
|
|
.text :
|
|
{
|
|
*(.rodata .rodata.*)
|
|
*(.text.unlikely .text.unlikely.*)
|
|
*(.text.startup .text.startup.*)
|
|
*(.text .text.*)
|
|
*(.gnu.linkonce.t.*)
|
|
|
|
/* 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 initial. */
|
|
. = ALIGN(4);
|
|
__rt_init_start = .;
|
|
KEEP(*(SORT(.rti_fn*)))
|
|
__rt_init_end = .;
|
|
. = ALIGN(4);
|
|
|
|
/* section information for modules */
|
|
. = ALIGN(4);
|
|
__rtmsymtab_start = .;
|
|
KEEP(*(RTMSymTab))
|
|
__rtmsymtab_end = .;
|
|
} >flash AT>flash
|
|
|
|
.fini :
|
|
{
|
|
KEEP (*(SORT_NONE(.fini)))
|
|
} >flash AT>flash
|
|
|
|
. = ALIGN(4);
|
|
|
|
PROVIDE (__etext = .);
|
|
PROVIDE (_etext = .);/*0x80022c8*/
|
|
PROVIDE (etext = .);/*0x80022c8*/
|
|
PROVIDE( _eilm = . );
|
|
|
|
.preinit_array :
|
|
{
|
|
PROVIDE_HIDDEN (__preinit_array_start = .);
|
|
KEEP (*(.preinit_array))
|
|
PROVIDE_HIDDEN (__preinit_array_end = .);
|
|
} >flash AT>flash
|
|
|
|
.init_array :
|
|
{
|
|
PROVIDE_HIDDEN (__init_array_start = .);
|
|
KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
|
|
KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
|
|
PROVIDE_HIDDEN (__init_array_end = .);
|
|
} >flash AT>flash
|
|
|
|
.fini_array :
|
|
{
|
|
PROVIDE_HIDDEN (__fini_array_start = .);
|
|
KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
|
|
KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
|
|
PROVIDE_HIDDEN (__fini_array_end = .);
|
|
} >flash AT>flash
|
|
|
|
.ctors :
|
|
{
|
|
/* gcc uses crtbegin.o to find the start of
|
|
the constructors, so we make sure it is
|
|
first. Because this is a wildcard, it
|
|
doesn't matter if the user does not
|
|
actually link against crtbegin.o; the
|
|
linker won't look for a file to match a
|
|
wildcard. The wildcard also means that it
|
|
doesn't matter which directory crtbegin.o
|
|
is in. */
|
|
KEEP (*crtbegin.o(.ctors))
|
|
KEEP (*crtbegin?.o(.ctors))
|
|
/* We don't want to include the .ctor section from
|
|
the crtend.o file until after the sorted ctors.
|
|
The .ctor section from the crtend file contains the
|
|
end of ctors marker and it must be last */
|
|
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
|
|
KEEP (*(SORT(.ctors.*)))
|
|
KEEP (*(.ctors))
|
|
} >flash AT>flash
|
|
|
|
.dtors :
|
|
{
|
|
KEEP (*crtbegin.o(.dtors))
|
|
KEEP (*crtbegin?.o(.dtors))
|
|
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
|
|
KEEP (*(SORT(.dtors.*)))
|
|
KEEP (*(.dtors))
|
|
} >flash AT>flash
|
|
|
|
. = ALIGN(4);
|
|
PROVIDE( _eilm = . );
|
|
|
|
.lalign :
|
|
{
|
|
. = ALIGN(4);
|
|
PROVIDE( _data_lma = . );
|
|
} >flash AT>flash
|
|
|
|
.dalign :
|
|
{
|
|
. = ALIGN(4);
|
|
PROVIDE( _data = . );
|
|
} >ram AT>flash
|
|
|
|
|
|
.data :
|
|
{
|
|
*(.rdata)
|
|
|
|
*(.gnu.linkonce.r.*)
|
|
*(.data .data.*)
|
|
*(.gnu.linkonce.d.*)
|
|
. = ALIGN(8);
|
|
PROVIDE( __global_pointer$ = . + 0x800);
|
|
*(.sdata .sdata.*)
|
|
*(.gnu.linkonce.s.*)
|
|
. = ALIGN(8);
|
|
*(.srodata.cst16)
|
|
*(.srodata.cst8)
|
|
*(.srodata.cst4)
|
|
*(.srodata.cst2)
|
|
*(.srodata .srodata.*)
|
|
} >ram AT>flash
|
|
|
|
. = ALIGN(4);
|
|
PROVIDE( _edata = . );
|
|
PROVIDE( edata = . );
|
|
|
|
PROVIDE( _fbss = . ); /*0X200052A0 0X200002A0*/
|
|
PROVIDE( __bss_start = . );
|
|
.bss :
|
|
{
|
|
*(.sbss*)
|
|
*(.gnu.linkonce.sb.*)
|
|
*(.bss .bss.*)
|
|
*(.gnu.linkonce.b.*)
|
|
*(COMMON)
|
|
. = ALIGN(4);
|
|
} >ram AT>ram
|
|
|
|
. = ALIGN(8);
|
|
PROVIDE( _end = . ); /*0X2000,0340*/
|
|
PROVIDE( end = . );
|
|
|
|
.stack ORIGIN(ram) + LENGTH(ram) - __stack_size :
|
|
{
|
|
PROVIDE( _heap_end = . );
|
|
. = __stack_size;
|
|
PROVIDE( _sp = . );
|
|
PROVIDE( __rt_rvstack = .);
|
|
} >ram AT>ram
|
|
}
|