diff --git a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f100xb.s b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f100xb.s index 87d2d6d28a..5c2b0196c4 100644 --- a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f100xb.s +++ b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f100xb.s @@ -111,7 +111,7 @@ LoopFillZerobss: /* Call static constructors */ bl __libc_init_array /* Call the application's entry point.*/ - bl entry + bl main bx lr .size Reset_Handler, .-Reset_Handler diff --git a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f100xe.s b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f100xe.s index 3f27c3c89b..9f4351af59 100644 --- a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f100xe.s +++ b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f100xe.s @@ -111,7 +111,7 @@ LoopFillZerobss: /* Call static constructors */ bl __libc_init_array /* Call the application's entry point.*/ - bl entry + bl main bx lr .size Reset_Handler, .-Reset_Handler diff --git a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f101x6.s b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f101x6.s index 4a76fac80f..aa5222ea87 100644 --- a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f101x6.s +++ b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f101x6.s @@ -111,7 +111,7 @@ LoopFillZerobss: /* Call static constructors */ bl __libc_init_array /* Call the application's entry point.*/ - bl entry + bl main bx lr .size Reset_Handler, .-Reset_Handler diff --git a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f101xb.s b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f101xb.s index 019236ac9e..eff8b458ec 100644 --- a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f101xb.s +++ b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f101xb.s @@ -111,7 +111,7 @@ LoopFillZerobss: /* Call static constructors */ bl __libc_init_array /* Call the application's entry point.*/ - bl entry + bl main bx lr .size Reset_Handler, .-Reset_Handler diff --git a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f101xe.s b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f101xe.s index f7290ab278..4d8265b533 100644 --- a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f101xe.s +++ b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f101xe.s @@ -111,7 +111,7 @@ LoopFillZerobss: /* Call static constructors */ bl __libc_init_array /* Call the application's entry point.*/ - bl entry + bl main bx lr .size Reset_Handler, .-Reset_Handler diff --git a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f101xg.s b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f101xg.s index c73ee4ce1d..51dfe85e5c 100644 --- a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f101xg.s +++ b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f101xg.s @@ -111,7 +111,7 @@ LoopFillZerobss: /* Call static constructors */ bl __libc_init_array /* Call the application's entry point.*/ - bl entry + bl main bx lr .size Reset_Handler, .-Reset_Handler diff --git a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f102x6.s b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f102x6.s index 076e8aca2a..a156b24cc9 100644 --- a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f102x6.s +++ b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f102x6.s @@ -111,7 +111,7 @@ LoopFillZerobss: /* Call static constructors */ bl __libc_init_array /* Call the application's entry point.*/ - bl entry + bl main bx lr .size Reset_Handler, .-Reset_Handler diff --git a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f102xb.s b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f102xb.s index 0ca2a21e3b..fe3d21745e 100644 --- a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f102xb.s +++ b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f102xb.s @@ -111,7 +111,7 @@ LoopFillZerobss: /* Call static constructors */ bl __libc_init_array /* Call the application's entry point.*/ - bl entry + bl main bx lr .size Reset_Handler, .-Reset_Handler diff --git a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103x6.s b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103x6.s index 89771dc207..3b9a953155 100644 --- a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103x6.s +++ b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103x6.s @@ -111,7 +111,7 @@ LoopFillZerobss: /* Call static constructors */ bl __libc_init_array /* Call the application's entry point.*/ - bl entry + bl main bx lr .size Reset_Handler, .-Reset_Handler diff --git a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xb.s b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xb.s index d19565353d..3a0a3b9775 100644 --- a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xb.s +++ b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xb.s @@ -111,7 +111,7 @@ LoopFillZerobss: /* Call static constructors */ bl __libc_init_array /* Call the application's entry point.*/ - bl entry + bl main bx lr .size Reset_Handler, .-Reset_Handler diff --git a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xe.s b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xe.s index 4811ae6e5c..2491c488ef 100644 --- a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xe.s +++ b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xe.s @@ -113,7 +113,7 @@ LoopFillZerobss: /* Call static constructors */ bl __libc_init_array /* Call the application's entry point.*/ - bl entry + bl main bx lr .size Reset_Handler, .-Reset_Handler diff --git a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xg.s b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xg.s index cb848cff71..5c0b2d7556 100644 --- a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xg.s +++ b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xg.s @@ -112,7 +112,7 @@ LoopFillZerobss: /* Call static constructors */ bl __libc_init_array /* Call the application's entry point.*/ - bl entry + bl main bx lr .size Reset_Handler, .-Reset_Handler diff --git a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f105xc.s b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f105xc.s index b858438a46..d869206ade 100644 --- a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f105xc.s +++ b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f105xc.s @@ -109,7 +109,7 @@ LoopFillZerobss: /* Call the clock system intitialization function.*/ bl SystemInit /* Call the application's entry point.*/ - bl entry + bl main bx lr .size Reset_Handler, .-Reset_Handler diff --git a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f107xc.s b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f107xc.s index 7f6a1fc8ef..bf87f072a5 100644 --- a/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f107xc.s +++ b/bsp/stm32f10x-HAL/Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f107xc.s @@ -112,7 +112,7 @@ LoopFillZerobss: /* Call static constructors */ bl __libc_init_array /* Call the application's entry point.*/ - bl entry + bl main bx lr .size Reset_Handler, .-Reset_Handler diff --git a/bsp/stm32f10x-HAL/drivers/SConscript b/bsp/stm32f10x-HAL/drivers/SConscript index 586b566952..3568c9a89b 100644 --- a/bsp/stm32f10x-HAL/drivers/SConscript +++ b/bsp/stm32f10x-HAL/drivers/SConscript @@ -20,6 +20,9 @@ if GetDepend(['RT_USING_USB_DEVICE']): src += ['drv_usb.c'] if GetDepend(['RT_USING_SDCARD']): src += ['drv_sdcard.c'] + +if rtconfig.CROSS_TOOL == 'gcc': + src += ['gcc_startup.s'] CPPPATH = [cwd] diff --git a/bsp/stm32f10x-HAL/drivers/gcc_startup.s b/bsp/stm32f10x-HAL/drivers/gcc_startup.s new file mode 100644 index 0000000000..ee7a673f07 --- /dev/null +++ b/bsp/stm32f10x-HAL/drivers/gcc_startup.s @@ -0,0 +1,104 @@ +/** + *************** (C) COPYRIGHT 2017 STMicroelectronics ************************ + * @file gcc_startup.s + * @author MCD Application Team + * @version V4.2.0 + * @date 31-March-2017 + * @brief Based on STM32F103xE's startup file. + * This module performs: + * - Set the initial SP + * - Set the initial PC == Reset_Handler, + * - Set the vector table entries with the exceptions ISR address + * - Configure the clock system + * - Configure external SRAM mounted on STM3210E-EVAL board + * to be used as data memory (optional, to be enabled by user) + * - Branches to entry in the C library (which eventually + * calls main(), but entry() in RT-Thread). + * After Reset the Cortex-M3 processor is in Thread mode, + * priority is Privileged, and the Stack is set to Main. + ****************************************************************************** + * + *