mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-01-19 05:53:31 +08:00
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上基于现有移植文件进行多线程复杂场景下的长时间测试,测试过程系统运行正常。
204 lines
4.6 KiB
Plaintext
204 lines
4.6 KiB
Plaintext
ENTRY( _start )
|
|
|
|
__stack_size = 2048;
|
|
|
|
PROVIDE( _stack_size = __stack_size );
|
|
|
|
|
|
MEMORY
|
|
{
|
|
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 128K
|
|
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K
|
|
}
|
|
|
|
|
|
SECTIONS
|
|
{
|
|
|
|
.init :
|
|
{
|
|
_sinit = .;
|
|
. = ALIGN(4);
|
|
KEEP(*(SORT_NONE(.init)))
|
|
. = ALIGN(4);
|
|
_einit = .;
|
|
} >FLASH AT>FLASH
|
|
|
|
.vector :
|
|
{
|
|
*(.vector);
|
|
. = ALIGN(64);
|
|
} >FLASH AT>FLASH
|
|
|
|
.text :
|
|
{
|
|
. = ALIGN(4);
|
|
*(.text)
|
|
*(.text.*)
|
|
*(.rodata)
|
|
*(.rodata*)
|
|
*(.glue_7)
|
|
*(.glue_7t)
|
|
*(.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 = .;
|
|
. = ALIGN(4);
|
|
|
|
PROVIDE(__ctors_start__ = .);
|
|
KEEP (*(SORT(.init_array.*)))
|
|
KEEP (*(.init_array))
|
|
PROVIDE(__ctors_end__ = .);
|
|
. = ALIGN(4);
|
|
|
|
_etext = .;
|
|
|
|
} >FLASH AT>FLASH
|
|
|
|
.fini :
|
|
{
|
|
KEEP(*(SORT_NONE(.fini)))
|
|
. = ALIGN(4);
|
|
} >FLASH AT>FLASH
|
|
|
|
PROVIDE( _etext = . );
|
|
PROVIDE( _eitcm = . );
|
|
|
|
.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
|
|
|
|
.dalign :
|
|
{
|
|
. = ALIGN(4);
|
|
PROVIDE(_data_vma = .);
|
|
} >RAM AT>FLASH
|
|
|
|
.dlalign :
|
|
{
|
|
. = ALIGN(4);
|
|
PROVIDE(_data_lma = .);
|
|
} >FLASH AT>FLASH
|
|
|
|
.data :
|
|
{
|
|
*(.gnu.linkonce.r.*)
|
|
*(.data .data.*)
|
|
*(.gnu.linkonce.d.*)
|
|
. = ALIGN(8);
|
|
PROVIDE( __global_pointer$ = . + 0x800 );
|
|
*(.sdata .sdata.*)
|
|
*(.sdata2.*)
|
|
*(.gnu.linkonce.s.*)
|
|
. = ALIGN(8);
|
|
*(.srodata.cst16)
|
|
*(.srodata.cst8)
|
|
*(.srodata.cst4)
|
|
*(.srodata.cst2)
|
|
*(.srodata .srodata.*)
|
|
. = ALIGN(4);
|
|
PROVIDE( _edata = .);
|
|
} >RAM AT>FLASH
|
|
|
|
.bss :
|
|
{
|
|
. = ALIGN(4);
|
|
PROVIDE( _sbss = .);
|
|
*(.sbss*)
|
|
*(.gnu.linkonce.sb.*)
|
|
*(.bss*)
|
|
*(.gnu.linkonce.b.*)
|
|
*(COMMON*)
|
|
. = ALIGN(4);
|
|
PROVIDE( _ebss = .);
|
|
} >RAM AT>FLASH
|
|
|
|
PROVIDE( _end = _ebss);
|
|
PROVIDE( end = . );
|
|
|
|
.stack ORIGIN(RAM) + LENGTH(RAM) - __stack_size :
|
|
{
|
|
PROVIDE( _heap_end = . );
|
|
. = ALIGN(4);
|
|
PROVIDE(_susrstack = . );
|
|
. = . + __stack_size;
|
|
PROVIDE( _eusrstack = .);
|
|
PROVIDE( __rt_rvstack = . );
|
|
} >RAM
|
|
|
|
}
|
|
|
|
|
|
|