• RT-Thread 7. RT-Thread Studio ENV修改MCU型号


    1. 修改MCU型号

    在这里插入图片描述
    在这里插入图片描述

    2.在ENV界面输入
    scons -c
    scons --dist
    
    • 1
    • 2
    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, %object
    
    g_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, =_sidata
        ldr r2, =_sdata
        ldr r3, =_edata
    
        subs r3, r2
        ble fill_bss_start
    
    loop_copy_data:
        subs r3, #4
        ldr r0, [r1,r3]
        str r0, [r2,r3]
        bgt loop_copy_data
    
    fill_bss_start:
        ldr r1, =__bss_start
        ldr r2, =__bss_end
        movs r0, 0
        subs r2, r1
        ble startup_enter
    
    loop_fill_bss:
        subs r2, #4
        str r0, [r1, r2]
        bgt loop_fill_bss
    
    startup_enter:
        bl SystemInit
        bl 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
        .endm
    
        IRQ WWDGT_IRQHandler
        IRQ LVD_IRQHandler
        IRQ RTC_IRQHandler
        IRQ FMC_IRQHandler
        IRQ RCU_CTC_IRQHandler
        IRQ  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                  
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213
    • 214
    • 215
    • 216
    • 217
    • 218
    • 219
    • 220
    • 221
    • 222
    • 223
    • 224
    • 225
    • 226
    • 227
    • 228
    • 229
    • 230
    • 231
    • 232
    • 233
    • 234
    • 235
    • 236
    • 237
    • 238
    • 239
  • 相关阅读:
    5G在油气田智慧勘探井场建设中的应用探讨
    Go使用Gin+mysql实现增删改查
    猿创征文|DEM分析分层重分类
    JAVA 身份证号码的验证
    地平线 自动化测试|测试开发 面试真题|面经 汇总
    工控上位机程序为什么只能用C语言?
    【终端】记录mbedtls库的重新安装
    31.Java中的字符流【20220806】
    java毕业设计在线课程教学大纲系统Mybatis+系统+数据库+调试部署
    C++STL详解(一)string类的使用及其模拟实现
  • 原文地址:https://blog.csdn.net/lljss1980/article/details/134065750