aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-12-19 09:13:54 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-12-19 09:13:54 +0000
commit7d7d9727f9a280d63157ac9997fe271610f05b1e (patch)
treefe51a6af796f2d0976025db4b68d553875bf0994 /os
parent3b378d2b9b86bc4242873982a9222e3abcbfaead (diff)
downloadChibiOS-7d7d9727f9a280d63157ac9997fe271610f05b1e.tar.gz
ChibiOS-7d7d9727f9a280d63157ac9997fe271610f05b1e.tar.bz2
ChibiOS-7d7d9727f9a280d63157ac9997fe271610f05b1e.zip
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
Diffstat (limited to 'os')
-rw-r--r--os/hal/src/hal.c6
-rw-r--r--os/ports/GCC/ARMCMx/crt0_v6m.s57
-rw-r--r--os/ports/GCC/ARMCMx/crt0_v7m.s57
-rw-r--r--os/ports/IAR/ARMCMx/STM32/vectors.s1
-rw-r--r--os/ports/IAR/ARMCMx/cstartup.s26
5 files changed, 55 insertions, 92 deletions
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