Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bsp/gd32/risc-v/gd32vw553h-eval/SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ gd32_library = 'GD32VW55x_Firmware_Library'
rtconfig.BSP_LIBRARY_TYPE = gd32_library

# include drivers
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'gd32_drivers', 'SConscript')))
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'gd32_drivers', 'SConscript'), variant_dir='build/libraries', duplicate=0))

# make a building
DoBuilding(TARGET, objs)
102 changes: 67 additions & 35 deletions bsp/gd32/risc-v/gd32vw553h-eval/board/linker_scripts/link.lds
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,79 @@ OUTPUT_ARCH( "riscv" )
ENTRY( _start )

MEMORY
{
/* Run in FLASH */
{
/* Run in FLASH */
flash (rxai!w) : ORIGIN = 0x08000000, LENGTH = 4096k
ram (wxa!ri) : ORIGIN = 0x20000000, LENGTH = 288K
ram (wxa!ri) : ORIGIN = 0x20000000, LENGTH = 288K

/* Run in RAM */
/* flash (rxai!w) : ORIGIN = 0x20000000, LENGTH = 32k
ram (wxa!ri) : ORIGIN = 0x20008000, LENGTH = 256K
*/
/* Run in RAM */
/* flash (rxai!w) : ORIGIN = 0x20000000, LENGTH = 32k
ram (wxa!ri) : ORIGIN = 0x20008000, LENGTH = 256K */
}


SECTIONS
{
__stack_size = DEFINED(__stack_size) ? __stack_size : 4K;


.init :
{
KEEP (*(SORT_NONE(.init)))
} >flash AT>flash
} >flash AT>flash

.ilalign :
{
. = ALIGN(4);
PROVIDE( _ilm_lma = . );
} >flash AT>flash
} >flash AT>flash

.ialign :
{
PROVIDE( _ilm = . );
} >flash AT>flash
} >flash AT>flash

_sicode = LOADADDR(.code_to_sram);

.code_to_sram :
{
. = ALIGN(4);
_scode = .;

*trap_gcc.o* (.text*)
*port.o* (.text.eclic_mtip_handler)
*lib_a-memcpy.o* (.text*)
*wrapper_os.o* (.text.sys_memcpy*)
*inet_chksum.o* (.text.lwip_standard_chksum)
/**macsw/modules/ke/ke_event.o* (.rodata.ke_evt_hdlr*)
*rxl_cntrl.o* (.text.rxl_upload_evt)*/
*txl_agg.o* (.text.txl_agg_push_mpdu .text.txl_agg_finish)
*txl_he.o* (.text.txl_he_tb_prot_trigger .text.txl_he_trigger_push)
*rxl_hwdesc.o* (.text.rxl_immediate_frame_get .text.rxl_rxcntrl_frame)


*txl_agg.o* (.text.* .rodata.*)
*txl_he.o* (.text.* .rodata.*)
*rxl_hwdesc.o* (.text.* .rodata.*)

*drv_uart.o* (.text.USART0_IRQHandler .text.GD32_UART_IRQHandler) /* choose UART on condition */
*gd32vw55x_usart.o* (.text.usart_interrupt_flag_get .text.usart_interrupt_flag_clear .text.usart_flag_get .text.usart_flag_clear)
*gd32vw55x_usart.o* (.text.usart_data_receive .text.usart_data_transmit)
*gd32vw55x_usart.o* (.text.usart_interrupt_enable .text.usart_interrupt_disable)
*dev_serial.o* (.text.rt_hw_serial_isr)
*save-restore.o* (.text*)


. = ALIGN(4);
_ecode = .;
} >ram AT>flash

.text :
{
*(.rodata .rodata.*)
*(.rodata .rodata.*)
*(.text.unlikely .text.unlikely.*)
*(.text.startup .text.startup.*)
*(.text .text.*)
*(.gnu.linkonce.t.*)

/* section information for finsh shell */
. = ALIGN(4);
__fsymtab_start = .;
Expand All @@ -61,7 +93,7 @@ SECTIONS
KEEP(*(SORT(.rti_fn*)))
__rt_init_end = .;
. = ALIGN(4);

/* section information for utest */
. = ALIGN(4);
__rt_utest_tc_tab_start = .;
Expand All @@ -73,12 +105,12 @@ SECTIONS
__rtmsymtab_start = .;
KEEP(*(RTMSymTab))
__rtmsymtab_end = .;
} >flash AT>flash
} >flash AT>flash

.fini :
{
KEEP (*(SORT_NONE(.fini)))
} >flash AT>flash
} >flash AT>flash

. = ALIGN(4);

Expand All @@ -92,23 +124,23 @@ SECTIONS
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array))
PROVIDE_HIDDEN (__preinit_array_end = .);
} >flash AT>flash
} >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
} >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
} >flash AT>flash

.ctors :
{
Expand All @@ -130,7 +162,7 @@ SECTIONS
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
} >flash AT>flash
} >flash AT>flash

.dtors :
{
Expand All @@ -139,7 +171,7 @@ SECTIONS
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
} >flash AT>flash
} >flash AT>flash

. = ALIGN(4);
PROVIDE( _eilm = . );
Expand All @@ -148,24 +180,24 @@ SECTIONS
{
. = ALIGN(4);
PROVIDE( _data_lma = . );
} >flash AT>flash
} >flash AT>flash

.dalign :
{
. = ALIGN(4);
PROVIDE( _data = . );
} >ram AT>flash


} >ram AT>flash


.data :
{
*(.rdata)

PROVIDE( _data = . );
*(.rdata)

*(.gnu.linkonce.r.*)
*(.data .data.*)
*(.gnu.linkonce.d.*)
. = ALIGN(8);
PROVIDE( __global_pointer$ = . + 0x800);
PROVIDE( __global_pointer$ = . + 0x800);
*(.sdata .sdata.*)
*(.gnu.linkonce.s.*)
. = ALIGN(8);
Expand All @@ -174,7 +206,7 @@ SECTIONS
*(.srodata.cst4)
*(.srodata.cst2)
*(.srodata .srodata.*)
} >ram AT>flash
} >ram AT>flash

. = ALIGN(4);
PROVIDE( _edata = . );
Expand All @@ -190,17 +222,17 @@ SECTIONS
*(.gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
} >ram AT>ram
} >ram AT>ram

. = ALIGN(8);
PROVIDE( _end = . ); /*0X2000,0340*/
PROVIDE( end = . );

.stack ORIGIN(ram) + LENGTH(ram) - __stack_size :
{
PROVIDE( _heap_end = . );
. = __stack_size;
PROVIDE( _heap_end = . );
. = __stack_size;
PROVIDE( _sp = . );
PROVIDE( __rt_rvstack = .);
} >ram AT>ram
} >ram AT>ram
}
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ online-packages.rtduino.other:
kconfig:
- CONFIG_BSP_USING_ARDUINO=y
- CONFIG_PKG_USING_ARDUINO_ADAFRUIT_MFRC630=y
- CONFIG_PKG_USING_ARDUINO_ADAFRUIT_SI5351=y
online-packages.rtduino.projects:
<<: *scons
kconfig:
Expand Down
8 changes: 7 additions & 1 deletion libcpu/risc-v/common/interrupt_gcc.S
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,18 @@ SW_handler:
/* interrupt handle */
call rt_interrupt_enter
/* Do the work after saving the above */
jal rt_hw_do_after_save_above
call rt_hw_do_after_save_above

call rt_interrupt_leave
/* switch to from thread stack */
csrrw sp,mscratch,sp

/* Check if we are in interrupt nesting, if so, skip task switching */
la t0, rt_interrupt_nest
lw t1, 0(t0)
li t2, 1
bge t1, t2, 1f

/* Determine whether to trigger scheduling at the interrupt function */
la t0, rt_thread_switch_interrupt_flag
lw t2, 0(t0)
Expand Down