Skip to content

Commit c2b3afc

Browse files
committed
[bsp/gd32] fix gd32vw553 bsp
1 parent d9c4424 commit c2b3afc

File tree

3 files changed

+75
-37
lines changed

3 files changed

+75
-37
lines changed

bsp/gd32/risc-v/gd32vw553h-eval/SConstruct

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ gd32_library = 'GD32VW55x_Firmware_Library'
6565
rtconfig.BSP_LIBRARY_TYPE = gd32_library
6666

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

7070
# make a building
7171
DoBuilding(TARGET, objs)

bsp/gd32/risc-v/gd32vw553h-eval/board/linker_scripts/link.lds

Lines changed: 67 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,79 @@ OUTPUT_ARCH( "riscv" )
33
ENTRY( _start )
44

55
MEMORY
6-
{
7-
/* Run in FLASH */
6+
{
7+
/* Run in FLASH */
88
flash (rxai!w) : ORIGIN = 0x08000000, LENGTH = 4096k
9-
ram (wxa!ri) : ORIGIN = 0x20000000, LENGTH = 288K
9+
ram (wxa!ri) : ORIGIN = 0x20000000, LENGTH = 288K
1010

11-
/* Run in RAM */
12-
/* flash (rxai!w) : ORIGIN = 0x20000000, LENGTH = 32k
13-
ram (wxa!ri) : ORIGIN = 0x20008000, LENGTH = 256K
14-
*/
11+
/* Run in RAM */
12+
/* flash (rxai!w) : ORIGIN = 0x20000000, LENGTH = 32k
13+
ram (wxa!ri) : ORIGIN = 0x20008000, LENGTH = 256K */
1514
}
1615

17-
1816
SECTIONS
1917
{
2018
__stack_size = DEFINED(__stack_size) ? __stack_size : 4K;
2119

22-
2320
.init :
2421
{
2522
KEEP (*(SORT_NONE(.init)))
26-
} >flash AT>flash
23+
} >flash AT>flash
2724

2825
.ilalign :
2926
{
3027
. = ALIGN(4);
3128
PROVIDE( _ilm_lma = . );
32-
} >flash AT>flash
29+
} >flash AT>flash
3330

3431
.ialign :
3532
{
3633
PROVIDE( _ilm = . );
37-
} >flash AT>flash
34+
} >flash AT>flash
35+
36+
_sicode = LOADADDR(.code_to_sram);
37+
38+
.code_to_sram :
39+
{
40+
. = ALIGN(4);
41+
_scode = .;
42+
43+
*trap_gcc.o* (.text*)
44+
*port.o* (.text.eclic_mtip_handler)
45+
*lib_a-memcpy.o* (.text*)
46+
*wrapper_os.o* (.text.sys_memcpy*)
47+
*inet_chksum.o* (.text.lwip_standard_chksum)
48+
/**macsw/modules/ke/ke_event.o* (.rodata.ke_evt_hdlr*)
49+
*rxl_cntrl.o* (.text.rxl_upload_evt)*/
50+
*txl_agg.o* (.text.txl_agg_push_mpdu .text.txl_agg_finish)
51+
*txl_he.o* (.text.txl_he_tb_prot_trigger .text.txl_he_trigger_push)
52+
*rxl_hwdesc.o* (.text.rxl_immediate_frame_get .text.rxl_rxcntrl_frame)
53+
54+
55+
*txl_agg.o* (.text.* .rodata.*)
56+
*txl_he.o* (.text.* .rodata.*)
57+
*rxl_hwdesc.o* (.text.* .rodata.*)
58+
59+
*drv_uart.o* (.text.USART0_IRQHandler .text.GD32_UART_IRQHandler) /* choose UART on condition */
60+
*gd32vw55x_usart.o* (.text.usart_interrupt_flag_get .text.usart_interrupt_flag_clear .text.usart_flag_get .text.usart_flag_clear)
61+
*gd32vw55x_usart.o* (.text.usart_data_receive .text.usart_data_transmit)
62+
*gd32vw55x_usart.o* (.text.usart_interrupt_enable .text.usart_interrupt_disable)
63+
*dev_serial.o* (.text.rt_hw_serial_isr)
64+
*save-restore.o* (.text*)
65+
66+
67+
. = ALIGN(4);
68+
_ecode = .;
69+
} >ram AT>flash
3870

3971
.text :
4072
{
41-
*(.rodata .rodata.*)
73+
*(.rodata .rodata.*)
4274
*(.text.unlikely .text.unlikely.*)
4375
*(.text.startup .text.startup.*)
4476
*(.text .text.*)
4577
*(.gnu.linkonce.t.*)
46-
78+
4779
/* section information for finsh shell */
4880
. = ALIGN(4);
4981
__fsymtab_start = .;
@@ -61,7 +93,7 @@ SECTIONS
6193
KEEP(*(SORT(.rti_fn*)))
6294
__rt_init_end = .;
6395
. = ALIGN(4);
64-
96+
6597
/* section information for utest */
6698
. = ALIGN(4);
6799
__rt_utest_tc_tab_start = .;
@@ -73,12 +105,12 @@ SECTIONS
73105
__rtmsymtab_start = .;
74106
KEEP(*(RTMSymTab))
75107
__rtmsymtab_end = .;
76-
} >flash AT>flash
108+
} >flash AT>flash
77109

78110
.fini :
79111
{
80112
KEEP (*(SORT_NONE(.fini)))
81-
} >flash AT>flash
113+
} >flash AT>flash
82114

83115
. = ALIGN(4);
84116

@@ -92,23 +124,23 @@ SECTIONS
92124
PROVIDE_HIDDEN (__preinit_array_start = .);
93125
KEEP (*(.preinit_array))
94126
PROVIDE_HIDDEN (__preinit_array_end = .);
95-
} >flash AT>flash
127+
} >flash AT>flash
96128

97129
.init_array :
98130
{
99131
PROVIDE_HIDDEN (__init_array_start = .);
100132
KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
101133
KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
102134
PROVIDE_HIDDEN (__init_array_end = .);
103-
} >flash AT>flash
135+
} >flash AT>flash
104136

105137
.fini_array :
106138
{
107139
PROVIDE_HIDDEN (__fini_array_start = .);
108140
KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
109141
KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
110142
PROVIDE_HIDDEN (__fini_array_end = .);
111-
} >flash AT>flash
143+
} >flash AT>flash
112144

113145
.ctors :
114146
{
@@ -130,7 +162,7 @@ SECTIONS
130162
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
131163
KEEP (*(SORT(.ctors.*)))
132164
KEEP (*(.ctors))
133-
} >flash AT>flash
165+
} >flash AT>flash
134166

135167
.dtors :
136168
{
@@ -139,7 +171,7 @@ SECTIONS
139171
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
140172
KEEP (*(SORT(.dtors.*)))
141173
KEEP (*(.dtors))
142-
} >flash AT>flash
174+
} >flash AT>flash
143175

144176
. = ALIGN(4);
145177
PROVIDE( _eilm = . );
@@ -148,24 +180,24 @@ SECTIONS
148180
{
149181
. = ALIGN(4);
150182
PROVIDE( _data_lma = . );
151-
} >flash AT>flash
183+
} >flash AT>flash
152184

153185
.dalign :
154186
{
155187
. = ALIGN(4);
156-
PROVIDE( _data = . );
157-
} >ram AT>flash
158-
159-
188+
} >ram AT>flash
189+
190+
160191
.data :
161192
{
162-
*(.rdata)
163-
193+
PROVIDE( _data = . );
194+
*(.rdata)
195+
164196
*(.gnu.linkonce.r.*)
165197
*(.data .data.*)
166198
*(.gnu.linkonce.d.*)
167199
. = ALIGN(8);
168-
PROVIDE( __global_pointer$ = . + 0x800);
200+
PROVIDE( __global_pointer$ = . + 0x800);
169201
*(.sdata .sdata.*)
170202
*(.gnu.linkonce.s.*)
171203
. = ALIGN(8);
@@ -174,7 +206,7 @@ SECTIONS
174206
*(.srodata.cst4)
175207
*(.srodata.cst2)
176208
*(.srodata .srodata.*)
177-
} >ram AT>flash
209+
} >ram AT>flash
178210

179211
. = ALIGN(4);
180212
PROVIDE( _edata = . );
@@ -190,17 +222,17 @@ SECTIONS
190222
*(.gnu.linkonce.b.*)
191223
*(COMMON)
192224
. = ALIGN(4);
193-
} >ram AT>ram
225+
} >ram AT>ram
194226

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

199231
.stack ORIGIN(ram) + LENGTH(ram) - __stack_size :
200232
{
201-
PROVIDE( _heap_end = . );
202-
. = __stack_size;
233+
PROVIDE( _heap_end = . );
234+
. = __stack_size;
203235
PROVIDE( _sp = . );
204236
PROVIDE( __rt_rvstack = .);
205-
} >ram AT>ram
237+
} >ram AT>ram
206238
}

libcpu/risc-v/common/interrupt_gcc.S

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,18 @@ SW_handler:
102102
/* interrupt handle */
103103
call rt_interrupt_enter
104104
/* Do the work after saving the above */
105-
jal rt_hw_do_after_save_above
105+
call rt_hw_do_after_save_above
106106

107107
call rt_interrupt_leave
108108
/* switch to from thread stack */
109109
csrrw sp,mscratch,sp
110110

111+
/* Check if we are in interrupt nesting, if so, skip task switching */
112+
la t0, rt_interrupt_nest
113+
lw t1, 0(t0)
114+
li t2, 1
115+
bge t1, t2, 1f
116+
111117
/* Determine whether to trigger scheduling at the interrupt function */
112118
la t0, rt_thread_switch_interrupt_flag
113119
lw t2, 0(t0)

0 commit comments

Comments
 (0)