1. 修改MCU型号
2.在ENV界面输入
scons -c
scons --dist
3. dist下为更新后完整源代码
4.导入RT-Thread Studio
发现GD32F330已经生效了。
5. 自己编写startup_gd32f3x0.S,准确性待验证
;/*
; * Copyright (c) 2006-2021, RT-Thread Development Team
; *
; * SPDX-License-Identifier: Apache-2.0
; *
; * Change Logs:
; * Date Author Notes
; * 2018-05-22 tanek first implementation
; */.syntax unified
.cpu cortex-m4
.fpu softvfp
.thumb.global g_pfnVectors
.global Default_Handler.section .isr_vector,"a",%progbits.type g_pfnVectors, %objectg_pfnVectors:.word _estack // Top of Stack.word Reset_Handler // Reset Handler.word NMI_Handler // NMI Handler.word HardFault_Handler // Hard Fault Handler.word MemManage_Handler // MPU Fault Handler.word BusFault_Handler // Bus Fault Handler.word UsageFault_Handler // Usage Fault Handler.word 0 // Reserved.word 0 // Reserved.word 0 // Reserved.word 0 // Reserved.word SVC_Handler // SVCall Handler.word DebugMon_Handler // Debug Monitor Handler.word 0 // Reserved.word PendSV_Handler // PendSV Handler.word SysTick_Handler // SysTick Handler// external interrupts handler.word WWDGT_IRQHandler // 16:Window Watchdog Timer.word LVD_IRQHandler // 17:LVD through EXTI Line detect.word RTC_IRQHandler // 18:RTC Wakeup through EXTI Line.word FMC_IRQHandler // 19:FMC.word RCU_CTC_IRQHandler // 20:RCU and CTC.word EXTI0_1_IRQHandler // 21:EXTI Line 0 and EXTI Line 1.word EXTI2_3_IRQHandler // 22:EXTI Line 2 and EXTI Line 3.word EXTI4_15_IRQHandler // 23:EXTI Line 4 to EXTI Line 15.word TSI_IRQHandler // 24:TSI.word DMA_Channel0_IRQHandler // 25:DMA Channel 0 .word DMA_Channel1_2_IRQHandler // 26:DMA Channel 1 and DMA Channel 2.word DMA_Channel3_4_IRQHandler // 27:DMA Channel 3 and DMA Channel 4.word ADC_CMP_IRQHandler // 28:ADC and Comparator 0-1.word TIMER0_BRK_UP_TRG_COM_IRQHandler // 29:TIMER0 Break,Update,Trigger and Commutation.word TIMER0_Channel_IRQHandler // 30:TIMER0 Channel Capture Compare.word TIMER1_IRQHandler // 31:TIMER1.word TIMER2_IRQHandler // 32:TIMER2.word TIMER5_DAC_IRQHandler // 33:TIMER5 and DAC.word 0 // Reserved.word TIMER13_IRQHandler // 35:TIMER13.word TIMER14_IRQHandler // 36:TIMER14.word TIMER15_IRQHandler // 37:TIMER15.word TIMER16_IRQHandler // 38:TIMER16.word I2C0_EV_IRQHandler // 39:I2C0 Event.word I2C1_EV_IRQHandler // 40:I2C1 Event.word SPI0_IRQHandler // 41:SPI0.word SPI1_IRQHandler // 42:SPI1.word USART0_IRQHandler // 43:USART0.word USART1_IRQHandler // 44:USART1.word 0 // Reserved.word CEC_IRQHandler // 46:CEC.word 0 // Reserved.word I2C0_ER_IRQHandler // 48:I2C0 Error.word 0 // Reserved.word I2C1_ER_IRQHandler // 50:I2C1 Error.word 0 // Reserved.word 0 // Reserved.word 0 // Reserved.word 0 // Reserved.word 0 // Reserved.word 0 // Reserved.word 0 // Reserved.word USBFS_WKUP_IRQHandler // 58:USBFS Wakeup.word 0 // Reserved.word 0 // Reserved.word 0 // Reserved.word 0 // Reserved.word 0 // Reserved.word DMA_Channel5_6_IRQHandler // 64:DMA Channel5 and Channel6 .word 0 // Reserved.word 0 // Reserved.word 0 // Reserved.word 0 // Reserved.word 0 // Reserved.word 0 // Reserved.word 0 // Reserved.word 0 // Reserved.word 0 // Reserved.word 0 // Reserved.word 0 // Reserved.word 0 // Reserved.word 0 // Reserved.word 0 // Reserved.word 0 // Reserved.word 0 // Reserved.word 0 // Reserved.word 0 // Reserved.word USBFS_IRQHandler // 83:USBFS.size g_pfnVectors, .-g_pfnVectors.section .text.Reset_Handler.weak Reset_Handler.type Reset_Handler, %function
Reset_Handler:ldr r1, =_sidataldr r2, =_sdataldr r3, =_edatasubs r3, r2ble fill_bss_startloop_copy_data:subs r3, #4ldr r0, [r1,r3]str r0, [r2,r3]bgt loop_copy_datafill_bss_start:ldr r1, =__bss_startldr r2, =__bss_endmovs r0, 0subs r2, r1ble startup_enterloop_fill_bss:subs r2, #4str r0, [r1, r2]bgt loop_fill_bssstartup_enter:bl SystemInitbl entry/* Exception Handlers */.weak NMI_Handler.type NMI_Handler, %function
NMI_Handler:b ..size NMI_Handler, . - NMI_Handler.weak MemManage_Handler.type MemManage_Handler, %function
MemManage_Handler:b ..size MemManage_Handler, . - MemManage_Handler.weak BusFault_Handler.type BusFault_Handler, %function
BusFault_Handler:b ..size BusFault_Handler, . - BusFault_Handler.weak UsageFault_Handler.type UsageFault_Handler, %function
UsageFault_Handler:b ..size UsageFault_Handler, . - UsageFault_Handler.weak SVC_Handler.type SVC_Handler, %function
SVC_Handler:b ..size SVC_Handler, . - SVC_Handler.weak DebugMon_Handler.type DebugMon_Handler, %function
DebugMon_Handler:b ..size DebugMon_Handler, . - DebugMon_Handler.weak PendSV_Handler.type PendSV_Handler, %function
PendSV_Handler:b ..size PendSV_Handler, . - PendSV_Handler.weak SysTick_Handler.type SysTick_Handler, %function
SysTick_Handler:b ..size SysTick_Handler, . - SysTick_Handler/* IQR Handler */.section .text.Default_Handler,"ax",%progbits.type Default_Handler, %function
Default_Handler:b ..size Default_Handler, . - Default_Handler.macro IRQ handler.weak \handler.set \handler, Default_Handler.endmIRQ WWDGT_IRQHandlerIRQ LVD_IRQHandlerIRQ RTC_IRQHandlerIRQ FMC_IRQHandlerIRQ RCU_CTC_IRQHandlerIRQ EXTI0_1_IRQHandler IRQ EXTI2_3_IRQHandler IRQ EXTI4_15_IRQHandler IRQ TSI_IRQHandler IRQ DMA_Channel0_IRQHandler IRQ DMA_Channel1_2_IRQHandler IRQ DMA_Channel3_4_IRQHandler IRQ ADC_CMP_IRQHandler IRQ TIMER0_BRK_UP_TRG_COM_IRQHandler IRQ TIMER0_Channel_IRQHandler IRQ TIMER1_IRQHandler IRQ TIMER2_IRQHandler IRQ TIMER5_DAC_IRQHandler IRQ TIMER13_IRQHandler IRQ TIMER14_IRQHandler IRQ TIMER15_IRQHandler IRQ TIMER16_IRQHandler IRQ I2C0_EV_IRQHandler IRQ I2C1_EV_IRQHandler IRQ SPI0_IRQHandler IRQ SPI1_IRQHandler IRQ USART0_IRQHandler IRQ USART1_IRQHandler IRQ CEC_IRQHandler IRQ I2C0_ER_IRQHandler IRQ I2C1_ER_IRQHandler IRQ USBFS_WKUP_IRQHandler IRQ DMA_Channel5_6_IRQHandler IRQ USBFS_IRQHandler