Skip to content

Commit fe226a3

Browse files
committed
[bsp/gd32] 1.补充链接脚本 2.完善libcpu\risc-v\common\interrupt_gcc.S 3.补充gd32vw553h-eval\SConstruct
1 parent d9c4424 commit fe226a3

3 files changed

Lines changed: 74 additions & 42 deletions

File tree

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: 66 additions & 40 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 = .;
@@ -62,23 +94,17 @@ SECTIONS
6294
__rt_init_end = .;
6395
. = ALIGN(4);
6496

65-
/* section information for utest */
66-
. = ALIGN(4);
67-
__rt_utest_tc_tab_start = .;
68-
KEEP(*(UtestTcTab))
69-
__rt_utest_tc_tab_end = .;
70-
7197
/* section information for modules */
7298
. = ALIGN(4);
7399
__rtmsymtab_start = .;
74100
KEEP(*(RTMSymTab))
75101
__rtmsymtab_end = .;
76-
} >flash AT>flash
102+
} >flash AT>flash
77103

78104
.fini :
79105
{
80106
KEEP (*(SORT_NONE(.fini)))
81-
} >flash AT>flash
107+
} >flash AT>flash
82108

83109
. = ALIGN(4);
84110

@@ -92,23 +118,23 @@ SECTIONS
92118
PROVIDE_HIDDEN (__preinit_array_start = .);
93119
KEEP (*(.preinit_array))
94120
PROVIDE_HIDDEN (__preinit_array_end = .);
95-
} >flash AT>flash
121+
} >flash AT>flash
96122

97123
.init_array :
98124
{
99125
PROVIDE_HIDDEN (__init_array_start = .);
100126
KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
101127
KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
102128
PROVIDE_HIDDEN (__init_array_end = .);
103-
} >flash AT>flash
129+
} >flash AT>flash
104130

105131
.fini_array :
106132
{
107133
PROVIDE_HIDDEN (__fini_array_start = .);
108134
KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
109135
KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
110136
PROVIDE_HIDDEN (__fini_array_end = .);
111-
} >flash AT>flash
137+
} >flash AT>flash
112138

113139
.ctors :
114140
{
@@ -130,7 +156,7 @@ SECTIONS
130156
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
131157
KEEP (*(SORT(.ctors.*)))
132158
KEEP (*(.ctors))
133-
} >flash AT>flash
159+
} >flash AT>flash
134160

135161
.dtors :
136162
{
@@ -139,7 +165,7 @@ SECTIONS
139165
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
140166
KEEP (*(SORT(.dtors.*)))
141167
KEEP (*(.dtors))
142-
} >flash AT>flash
168+
} >flash AT>flash
143169

144170
. = ALIGN(4);
145171
PROVIDE( _eilm = . );
@@ -148,24 +174,24 @@ SECTIONS
148174
{
149175
. = ALIGN(4);
150176
PROVIDE( _data_lma = . );
151-
} >flash AT>flash
177+
} >flash AT>flash
152178

153179
.dalign :
154180
{
155181
. = ALIGN(4);
156-
PROVIDE( _data = . );
157-
} >ram AT>flash
158-
159-
182+
} >ram AT>flash
183+
184+
160185
.data :
161186
{
162-
*(.rdata)
163-
187+
PROVIDE( _data = . );
188+
*(.rdata)
189+
164190
*(.gnu.linkonce.r.*)
165191
*(.data .data.*)
166192
*(.gnu.linkonce.d.*)
167193
. = ALIGN(8);
168-
PROVIDE( __global_pointer$ = . + 0x800);
194+
PROVIDE( __global_pointer$ = . + 0x800);
169195
*(.sdata .sdata.*)
170196
*(.gnu.linkonce.s.*)
171197
. = ALIGN(8);
@@ -174,7 +200,7 @@ SECTIONS
174200
*(.srodata.cst4)
175201
*(.srodata.cst2)
176202
*(.srodata .srodata.*)
177-
} >ram AT>flash
203+
} >ram AT>flash
178204

179205
. = ALIGN(4);
180206
PROVIDE( _edata = . );
@@ -190,17 +216,17 @@ SECTIONS
190216
*(.gnu.linkonce.b.*)
191217
*(COMMON)
192218
. = ALIGN(4);
193-
} >ram AT>ram
219+
} >ram AT>ram
194220

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

199225
.stack ORIGIN(ram) + LENGTH(ram) - __stack_size :
200226
{
201-
PROVIDE( _heap_end = . );
202-
. = __stack_size;
227+
PROVIDE( _heap_end = . );
228+
. = __stack_size;
203229
PROVIDE( _sp = . );
204230
PROVIDE( __rt_rvstack = .);
205-
} >ram AT>ram
231+
} >ram AT>ram
206232
}

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 t3, 1
115+
bge t1, t3, 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)