From 7d7d9727f9a280d63157ac9997fe271610f05b1e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 19 Dec 2010 09:13:54 +0000 Subject: STM32 board files and demos now use the new organization. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2497 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/src/hal.c | 6 +++- os/ports/GCC/ARMCMx/crt0_v6m.s | 57 ++++++++++++++----------------------- os/ports/GCC/ARMCMx/crt0_v7m.s | 57 ++++++++++++++----------------------- os/ports/IAR/ARMCMx/STM32/vectors.s | 1 + os/ports/IAR/ARMCMx/cstartup.s | 26 ++++------------- 5 files changed, 55 insertions(+), 92 deletions(-) (limited to 'os') diff --git a/os/hal/src/hal.c b/os/hal/src/hal.c index beff1c8ad..0913ad7a4 100644 --- a/os/hal/src/hal.c +++ b/os/hal/src/hal.c @@ -47,7 +47,9 @@ /** * @brief HAL initialization. * @details This function invokes the low level initialization code then - * initializes all the drivers enabled in the HAL. + * initializes all the drivers enabled in the HAL. Finally the + * board-specific initialization is performed by invoking + * @p boardInit() (usually defined in @p board.c). * * @init */ @@ -85,6 +87,8 @@ void halInit(void) { #if HAL_USE_UART || defined(__DOXYGEN__) uartInit(); #endif + /* Board specific initialization.*/ + boardInit(); } /** @} */ diff --git a/os/ports/GCC/ARMCMx/crt0_v6m.s b/os/ports/GCC/ARMCMx/crt0_v6m.s index b597f6b34..8cfbb7977 100644 --- a/os/ports/GCC/ARMCMx/crt0_v6m.s +++ b/os/ports/GCC/ARMCMx/crt0_v6m.s @@ -27,22 +27,22 @@ #if !defined(__DOXYGEN__) -.set CONTROL_MODE_PRIVILEGED, 0 -.set CONTROL_MODE_UNPRIVILEGED, 1 -.set CONTROL_USE_MSP, 0 -.set CONTROL_USE_PSP, 2 + .set CONTROL_MODE_PRIVILEGED, 0 + .set CONTROL_MODE_UNPRIVILEGED, 1 + .set CONTROL_USE_MSP, 0 + .set CONTROL_USE_PSP, 2 -.text -.balign 2 -.syntax unified -.thumb + .text + .balign 2 + .syntax unified + .thumb /* * Reset handler. */ -.thumb_func -.global ResetHandler -.weak ResetHandler + .thumb_func + .global ResetHandler + .weak ResetHandler ResetHandler: /* * Interrupts are globally masked initially. @@ -62,7 +62,7 @@ ResetHandler: /* * Early initialization phase, it is empty by default. */ - bl hwinit0 + bl __early_init /* * Data initialization. * NOTE: It assumes that the DATA size is a multiple of 4. @@ -100,9 +100,8 @@ endbloop: msr CONTROL, r0 isb /* - * Late initialization phase, it is empty by default. + * Main program invokation. */ - bl hwinit1 movs r0, #0 mov r1, r0 bl main @@ -112,34 +111,22 @@ endbloop: * Default main exit code, just a loop. * It is a weak symbol, the application code can redefine the behavior. */ -.thumb_func -.global MainExitHandler -.weak MainExitHandler + .thumb_func + .global MainExitHandler + .weak MainExitHandler MainExitHandler: .loop: b .loop /* * Default early initialization code. It is declared weak in order to be * replaced by the real initialization code. - * Early initialization is performed just after reset before BSS and DATA - * segments initialization. + * The arly initialization is performed just after stacks setup and before BSS + * and DATA segments initialization. */ -.thumb_func -.global hwinit0 -.weak hwinit0 -hwinit0: - bx lr - -/* - * Default late initialization code. It is declared weak in order to be - * replaced by the real initialization code. - * Late initialization is performed after BSS and DATA segments initialization - * and before invoking the main() function. - */ -.thumb_func -.global hwinit1 -.weak hwinit1 -hwinit1: + .thumb_func + .global __early_init + .weak __early_init +__early_init: bx lr #endif diff --git a/os/ports/GCC/ARMCMx/crt0_v7m.s b/os/ports/GCC/ARMCMx/crt0_v7m.s index 0750c619f..25aacecc2 100644 --- a/os/ports/GCC/ARMCMx/crt0_v7m.s +++ b/os/ports/GCC/ARMCMx/crt0_v7m.s @@ -27,22 +27,22 @@ #if !defined(__DOXYGEN__) -.set CONTROL_MODE_PRIVILEGED, 0 -.set CONTROL_MODE_UNPRIVILEGED, 1 -.set CONTROL_USE_MSP, 0 -.set CONTROL_USE_PSP, 2 + .set CONTROL_MODE_PRIVILEGED, 0 + .set CONTROL_MODE_UNPRIVILEGED, 1 + .set CONTROL_USE_MSP, 0 + .set CONTROL_USE_PSP, 2 -.text -.balign 2 -.syntax unified -.thumb + .text + .balign 2 + .syntax unified + .thumb /* * Reset handler. */ -.thumb_func -.global ResetHandler -.weak ResetHandler + .thumb_func + .global ResetHandler + .weak ResetHandler ResetHandler: /* * Interrupts are globally masked initially. @@ -62,7 +62,7 @@ ResetHandler: /* * Early initialization phase, it is empty by default. */ - bl hwinit0 + bl __early_init /* * Data initialization. * NOTE: It assumes that the DATA size is a multiple of 4. @@ -95,9 +95,8 @@ bloop: msr CONTROL, r0 isb /* - * Late initialization phase, it is empty by default. + * Main program invokation. */ - bl hwinit1 movs r0, #0 mov r1, r0 bl main @@ -107,34 +106,22 @@ bloop: * Default main exit code, just a loop. * It is a weak symbol, the application code can redefine the behavior. */ -.thumb_func -.global MainExitHandler -.weak MainExitHandler + .thumb_func + .global MainExitHandler + .weak MainExitHandler MainExitHandler: .loop: b .loop /* * Default early initialization code. It is declared weak in order to be * replaced by the real initialization code. - * Early initialization is performed just after reset before BSS and DATA - * segments initialization. + * The arly initialization is performed just after stacks setup and before BSS + * and DATA segments initialization. */ -.thumb_func -.global hwinit0 -.weak hwinit0 -hwinit0: - bx lr - -/* - * Default late initialization code. It is declared weak in order to be - * replaced by the real initialization code. - * Late initialization is performed after BSS and DATA segments initialization - * and before invoking the main() function. - */ -.thumb_func -.global hwinit1 -.weak hwinit1 -hwinit1: + .thumb_func + .global __early_init + .weak __early_init +__early_init: bx lr #endif diff --git a/os/ports/IAR/ARMCMx/STM32/vectors.s b/os/ports/IAR/ARMCMx/STM32/vectors.s index 72ab6ecf6..28eab1943 100644 --- a/os/ports/IAR/ARMCMx/STM32/vectors.s +++ b/os/ports/IAR/ARMCMx/STM32/vectors.s @@ -21,6 +21,7 @@ !defined(STM32F10X_MD) && !defined(STM32F10X_MD_VL) && \ !defined(STM32F10X_HD) && !defined(STM32F10X_XL) && \ !defined(STM32F10X_CL) +#define _FROM_ASM_ #include "board.h" #endif diff --git a/os/ports/IAR/ARMCMx/cstartup.s b/os/ports/IAR/ARMCMx/cstartup.s index 2a65b13ba..94b11847d 100644 --- a/os/ports/IAR/ARMCMx/cstartup.s +++ b/os/ports/IAR/ARMCMx/cstartup.s @@ -34,6 +34,7 @@ CONTROL_USE_PSP SET 2 EXTERN __vector_table EXTWEAK __iar_init_core EXTWEAK __iar_init_vfp + EXTERN __cmain SECTION .text:CODE:REORDER(2) THUMB @@ -44,30 +45,13 @@ __iar_program_start: movs r0, #CONTROL_MODE_PRIVILEGED | CONTROL_USE_PSP msr CONTROL, r0 isb - bl hwinit0 + bl __early_init bl __iar_init_core bl __iar_init_vfp + b __cmain -; Replicated cmain.s here in order to insert the call to hwinit1. - EXTERN main - EXTERN _exit - EXTWEAK __low_level_init - EXTWEAK __iar_data_init3 - bl __low_level_init - cmp r0, #0 - beq.n _skipinit - bl __iar_data_init3 -_skipinit: - bl hwinit1 - bl main - bl _exit - - PUBWEAK hwinit0 -hwinit0: - bx lr - - PUBWEAK hwinit1 -hwinit1: + PUBWEAK __early_init +__early_init: bx lr REQUIRE __vector_table -- cgit v1.2.3