From e27ef8f1c70751ab86340981d6f5d8337bf89d5c Mon Sep 17 00:00:00 2001 From: MuChenger Date: Wed, 25 Feb 2026 11:22:17 +0800 Subject: [PATCH] [bsp/gd32] fix gd32vw553 bsp --- bsp/gd32/risc-v/gd32vw553h-eval/SConstruct | 2 +- .../board/linker_scripts/link.lds | 102 ++++++++++++------ .../.ci/attachconfig/ci.attachconfig.yml | 1 - libcpu/risc-v/common/interrupt_gcc.S | 8 +- 4 files changed, 75 insertions(+), 38 deletions(-) diff --git a/bsp/gd32/risc-v/gd32vw553h-eval/SConstruct b/bsp/gd32/risc-v/gd32vw553h-eval/SConstruct index 0b74a2510a3..6cc366a4226 100644 --- a/bsp/gd32/risc-v/gd32vw553h-eval/SConstruct +++ b/bsp/gd32/risc-v/gd32vw553h-eval/SConstruct @@ -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) diff --git a/bsp/gd32/risc-v/gd32vw553h-eval/board/linker_scripts/link.lds b/bsp/gd32/risc-v/gd32vw553h-eval/board/linker_scripts/link.lds index 5667f71c978..55d855d3a35 100644 --- a/bsp/gd32/risc-v/gd32vw553h-eval/board/linker_scripts/link.lds +++ b/bsp/gd32/risc-v/gd32vw553h-eval/board/linker_scripts/link.lds @@ -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 = .; @@ -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 = .; @@ -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); @@ -92,7 +124,7 @@ SECTIONS PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >flash AT>flash + } >flash AT>flash .init_array : { @@ -100,7 +132,7 @@ SECTIONS 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 : { @@ -108,7 +140,7 @@ SECTIONS 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 : { @@ -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 : { @@ -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 = . ); @@ -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); @@ -174,7 +206,7 @@ SECTIONS *(.srodata.cst4) *(.srodata.cst2) *(.srodata .srodata.*) - } >ram AT>flash + } >ram AT>flash . = ALIGN(4); PROVIDE( _edata = . ); @@ -190,7 +222,7 @@ SECTIONS *(.gnu.linkonce.b.*) *(COMMON) . = ALIGN(4); - } >ram AT>ram + } >ram AT>ram . = ALIGN(8); PROVIDE( _end = . ); /*0X2000,0340*/ @@ -198,9 +230,9 @@ SECTIONS .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 } diff --git a/bsp/raspberry-pico/RP2040/.ci/attachconfig/ci.attachconfig.yml b/bsp/raspberry-pico/RP2040/.ci/attachconfig/ci.attachconfig.yml index afeff344002..e1aa367595c 100644 --- a/bsp/raspberry-pico/RP2040/.ci/attachconfig/ci.attachconfig.yml +++ b/bsp/raspberry-pico/RP2040/.ci/attachconfig/ci.attachconfig.yml @@ -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: diff --git a/libcpu/risc-v/common/interrupt_gcc.S b/libcpu/risc-v/common/interrupt_gcc.S index 6eb0ef371f6..dad8cac424c 100644 --- a/libcpu/risc-v/common/interrupt_gcc.S +++ b/libcpu/risc-v/common/interrupt_gcc.S @@ -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)