aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--boards/OLIMEX_STM32_H103/board.c22
-rw-r--r--boards/OLIMEX_STM32_H103/board.h10
-rw-r--r--boards/OLIMEX_STM32_P103/board.c22
-rw-r--r--boards/OLIMEX_STM32_P103/board.h10
-rw-r--r--boards/ST_STM3210C_EVAL/board.c25
-rw-r--r--boards/ST_STM3210C_EVAL/board.h10
-rw-r--r--boards/ST_STM32VL_DISCOVERY/board.c22
-rw-r--r--boards/ST_STM32VL_DISCOVERY/board.h10
-rw-r--r--demos/ARMCM3-STM32F100-DISCOVERY-GCC/main.c13
-rw-r--r--demos/ARMCM3-STM32F103-FATFS-GCC/main.c13
-rw-r--r--demos/ARMCM3-STM32F103-GCC/main.c15
-rw-r--r--demos/ARMCM3-STM32F103-IAR/main.c16
-rw-r--r--demos/ARMCM3-STM32F107-GCC/main.c15
-rw-r--r--docs/reports/STM32F100-24.txt2
-rw-r--r--docs/reports/STM32F103-72-IAR.txt22
-rw-r--r--docs/reports/STM32F103-72.txt2
-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
-rw-r--r--readme.txt5
22 files changed, 194 insertions, 187 deletions
diff --git a/boards/OLIMEX_STM32_H103/board.c b/boards/OLIMEX_STM32_H103/board.c
index 1f48eb629..e380b8b9a 100644
--- a/boards/OLIMEX_STM32_H103/board.c
+++ b/boards/OLIMEX_STM32_H103/board.c
@@ -36,28 +36,16 @@ const PALConfig pal_default_config =
/*
* Early initialization code.
- * This initialization is performed just after reset before BSS and DATA
- * segments initialization.
+ * This initialization must be performed just after stack setup and before
+ * any other initialization.
*/
-void hwinit0(void) {
+void __early_init(void) {
stm32_clock_init();
}
/*
- * Late initialization code.
- * This initialization is performed after BSS and DATA segments initialization
- * and before invoking the main() function.
+ * Board-specific initialization code.
*/
-void hwinit1(void) {
-
- /*
- * HAL initialization.
- */
- halInit();
-
- /*
- * ChibiOS/RT initialization.
- */
- chSysInit();
+void boardInit(void) {
}
diff --git a/boards/OLIMEX_STM32_H103/board.h b/boards/OLIMEX_STM32_H103/board.h
index b4ddace8b..0219d4fdd 100644
--- a/boards/OLIMEX_STM32_H103/board.h
+++ b/boards/OLIMEX_STM32_H103/board.h
@@ -122,4 +122,14 @@
#define VAL_GPIOECRH 0x88888888 /* PE15...PE8 */
#define VAL_GPIOEODR 0xFFFFFFFF
+#if !defined(_FROM_ASM_)
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void boardInit(void);
+#ifdef __cplusplus
+}
+#endif
+#endif /* _FROM_ASM_ */
+
#endif /* _BOARD_H_ */
diff --git a/boards/OLIMEX_STM32_P103/board.c b/boards/OLIMEX_STM32_P103/board.c
index 1f48eb629..e380b8b9a 100644
--- a/boards/OLIMEX_STM32_P103/board.c
+++ b/boards/OLIMEX_STM32_P103/board.c
@@ -36,28 +36,16 @@ const PALConfig pal_default_config =
/*
* Early initialization code.
- * This initialization is performed just after reset before BSS and DATA
- * segments initialization.
+ * This initialization must be performed just after stack setup and before
+ * any other initialization.
*/
-void hwinit0(void) {
+void __early_init(void) {
stm32_clock_init();
}
/*
- * Late initialization code.
- * This initialization is performed after BSS and DATA segments initialization
- * and before invoking the main() function.
+ * Board-specific initialization code.
*/
-void hwinit1(void) {
-
- /*
- * HAL initialization.
- */
- halInit();
-
- /*
- * ChibiOS/RT initialization.
- */
- chSysInit();
+void boardInit(void) {
}
diff --git a/boards/OLIMEX_STM32_P103/board.h b/boards/OLIMEX_STM32_P103/board.h
index b8baddb65..9ed8f5785 100644
--- a/boards/OLIMEX_STM32_P103/board.h
+++ b/boards/OLIMEX_STM32_P103/board.h
@@ -131,4 +131,14 @@
#define VAL_GPIOECRH 0x88888888 /* PE15...PE8 */
#define VAL_GPIOEODR 0xFFFFFFFF
+#if !defined(_FROM_ASM_)
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void boardInit(void);
+#ifdef __cplusplus
+}
+#endif
+#endif /* _FROM_ASM_ */
+
#endif /* _BOARD_H_ */
diff --git a/boards/ST_STM3210C_EVAL/board.c b/boards/ST_STM3210C_EVAL/board.c
index 0dfa60bfc..4b907f5ed 100644
--- a/boards/ST_STM3210C_EVAL/board.c
+++ b/boards/ST_STM3210C_EVAL/board.c
@@ -36,34 +36,21 @@ const PALConfig pal_default_config =
/*
* Early initialization code.
- * This initialization is performed just after reset before BSS and DATA
- * segments initialization.
+ * This initialization must be performed just after stack setup and before
+ * any other initialization.
*/
-void hwinit0(void) {
+void __early_init(void) {
stm32_clock_init();
}
/*
- * Late initialization code.
- * This initialization is performed after BSS and DATA segments initialization
- * and before invoking the main() function.
+ * Board-specific initialization code.
*/
-void hwinit1(void) {
+void boardInit(void) {
/*
- * HAL initialization.
- */
- halInit();
-
- /*
- * Remap USART2 to the PD5/PD6 pins, done after halInit since HAL resets
- * these.
+ * Remap USART2 to the PD5/PD6 pins.
*/
AFIO->MAPR |= AFIO_MAPR_USART2_REMAP;
-
- /*
- * ChibiOS/RT initialization.
- */
- chSysInit();
}
diff --git a/boards/ST_STM3210C_EVAL/board.h b/boards/ST_STM3210C_EVAL/board.h
index 30bb6cb94..b8833ac9f 100644
--- a/boards/ST_STM3210C_EVAL/board.h
+++ b/boards/ST_STM3210C_EVAL/board.h
@@ -113,4 +113,14 @@
#define VAL_GPIOECRH 0x44444444 /* PE15...PE8 */
#define VAL_GPIOEODR 0xFFFFFFFF
+#if !defined(_FROM_ASM_)
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void boardInit(void);
+#ifdef __cplusplus
+}
+#endif
+#endif /* _FROM_ASM_ */
+
#endif /* _BOARD_H_ */
diff --git a/boards/ST_STM32VL_DISCOVERY/board.c b/boards/ST_STM32VL_DISCOVERY/board.c
index 1f48eb629..e380b8b9a 100644
--- a/boards/ST_STM32VL_DISCOVERY/board.c
+++ b/boards/ST_STM32VL_DISCOVERY/board.c
@@ -36,28 +36,16 @@ const PALConfig pal_default_config =
/*
* Early initialization code.
- * This initialization is performed just after reset before BSS and DATA
- * segments initialization.
+ * This initialization must be performed just after stack setup and before
+ * any other initialization.
*/
-void hwinit0(void) {
+void __early_init(void) {
stm32_clock_init();
}
/*
- * Late initialization code.
- * This initialization is performed after BSS and DATA segments initialization
- * and before invoking the main() function.
+ * Board-specific initialization code.
*/
-void hwinit1(void) {
-
- /*
- * HAL initialization.
- */
- halInit();
-
- /*
- * ChibiOS/RT initialization.
- */
- chSysInit();
+void boardInit(void) {
}
diff --git a/boards/ST_STM32VL_DISCOVERY/board.h b/boards/ST_STM32VL_DISCOVERY/board.h
index 7dc2e77e2..4b16fc43a 100644
--- a/boards/ST_STM32VL_DISCOVERY/board.h
+++ b/boards/ST_STM32VL_DISCOVERY/board.h
@@ -133,4 +133,14 @@
#define VAL_GPIOECRH 0x88888888 /* PE15...PE8 */
#define VAL_GPIOEODR 0xFFFFFFFF
+#if !defined(_FROM_ASM_)
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void boardInit(void);
+#ifdef __cplusplus
+}
+#endif
+#endif /* _FROM_ASM_ */
+
#endif /* _BOARD_H_ */
diff --git a/demos/ARMCM3-STM32F100-DISCOVERY-GCC/main.c b/demos/ARMCM3-STM32F100-DISCOVERY-GCC/main.c
index 4d4df9297..a94600203 100644
--- a/demos/ARMCM3-STM32F100-DISCOVERY-GCC/main.c
+++ b/demos/ARMCM3-STM32F100-DISCOVERY-GCC/main.c
@@ -170,8 +170,7 @@ static msg_t Thread1(void *arg) {
}
/*
- * Entry point, note, the main() function is already a thread in the system
- * on entry.
+ * Application entry point.
*/
int main(int argc, char **argv) {
@@ -179,6 +178,16 @@ int main(int argc, char **argv) {
(void)argv;
/*
+ * System initializations.
+ * - HAL initialization, this also initializes the configured device drivers
+ * and performs the board-specific initializations.
+ * - Kernel initialization, the main() function becomes a thread and the
+ * RTOS is active.
+ */
+ halInit();
+ chSysInit();
+
+ /*
* Activates the serial driver 1 using the driver default configuration.
*/
sdStart(&SD1, NULL);
diff --git a/demos/ARMCM3-STM32F103-FATFS-GCC/main.c b/demos/ARMCM3-STM32F103-FATFS-GCC/main.c
index c9407731c..1d0018b9b 100644
--- a/demos/ARMCM3-STM32F103-FATFS-GCC/main.c
+++ b/demos/ARMCM3-STM32F103-FATFS-GCC/main.c
@@ -264,8 +264,7 @@ static void RemoveHandler(eventid_t id) {
}
/*
- * Entry point, note, the main() function is already a thread in the system
- * on entry.
+ * Application entry point.
*/
int main(int argc, char **argv) {
static const evhandler_t evhndl[] = {
@@ -279,6 +278,16 @@ int main(int argc, char **argv) {
(void)argv;
/*
+ * System initializations.
+ * - HAL initialization, this also initializes the configured device drivers
+ * and performs the board-specific initializations.
+ * - Kernel initialization, the main() function becomes a thread and the
+ * RTOS is active.
+ */
+ halInit();
+ chSysInit();
+
+ /*
* Activates the serial driver 2 using the driver default configuration.
*/
sdStart(&SD2, NULL);
diff --git a/demos/ARMCM3-STM32F103-GCC/main.c b/demos/ARMCM3-STM32F103-GCC/main.c
index 0072f0958..e133e6e3b 100644
--- a/demos/ARMCM3-STM32F103-GCC/main.c
+++ b/demos/ARMCM3-STM32F103-GCC/main.c
@@ -22,7 +22,7 @@
#include "test.h"
/*
- * Red LEDs blinker thread, times are in milliseconds.
+ * Red LED blinker thread, times are in milliseconds.
*/
static WORKING_AREA(waThread1, 128);
static msg_t Thread1(void *arg) {
@@ -38,8 +38,7 @@ static msg_t Thread1(void *arg) {
}
/*
- * Entry point, note, the main() function is already a thread in the system
- * on entry.
+ * Application entry point.
*/
int main(int argc, char **argv) {
@@ -47,6 +46,16 @@ int main(int argc, char **argv) {
(void)argv;
/*
+ * System initializations.
+ * - HAL initialization, this also initializes the configured device drivers
+ * and performs the board-specific initializations.
+ * - Kernel initialization, the main() function becomes a thread and the
+ * RTOS is active.
+ */
+ halInit();
+ chSysInit();
+
+ /*
* Activates the serial driver 2 using the driver default configuration.
*/
sdStart(&SD2, NULL);
diff --git a/demos/ARMCM3-STM32F103-IAR/main.c b/demos/ARMCM3-STM32F103-IAR/main.c
index a3a5c062e..e133e6e3b 100644
--- a/demos/ARMCM3-STM32F103-IAR/main.c
+++ b/demos/ARMCM3-STM32F103-IAR/main.c
@@ -22,7 +22,7 @@
#include "test.h"
/*
- * Red LEDs blinker thread, times are in milliseconds.
+ * Red LED blinker thread, times are in milliseconds.
*/
static WORKING_AREA(waThread1, 128);
static msg_t Thread1(void *arg) {
@@ -34,10 +34,11 @@ static msg_t Thread1(void *arg) {
palSetPad(IOPORT3, GPIOC_LED);
chThdSleepMilliseconds(500);
}
+ return 0;
}
/*
- * Entry point.
+ * Application entry point.
*/
int main(int argc, char **argv) {
@@ -45,6 +46,16 @@ int main(int argc, char **argv) {
(void)argv;
/*
+ * System initializations.
+ * - HAL initialization, this also initializes the configured device drivers
+ * and performs the board-specific initializations.
+ * - Kernel initialization, the main() function becomes a thread and the
+ * RTOS is active.
+ */
+ halInit();
+ chSysInit();
+
+ /*
* Activates the serial driver 2 using the driver default configuration.
*/
sdStart(&SD2, NULL);
@@ -63,4 +74,5 @@ int main(int argc, char **argv) {
TestThread(&SD2);
chThdSleepMilliseconds(500);
}
+ return 0;
}
diff --git a/demos/ARMCM3-STM32F107-GCC/main.c b/demos/ARMCM3-STM32F107-GCC/main.c
index bddf485c0..fe463af89 100644
--- a/demos/ARMCM3-STM32F107-GCC/main.c
+++ b/demos/ARMCM3-STM32F107-GCC/main.c
@@ -22,7 +22,7 @@
#include "test.h"
/*
- * Red LEDs blinker thread, times are in milliseconds.
+ * Red LED blinker thread, times are in milliseconds.
*/
static WORKING_AREA(waThread1, 128);
static msg_t Thread1(void *arg) {
@@ -38,8 +38,7 @@ static msg_t Thread1(void *arg) {
}
/*
- * Entry point, note, the main() function is already a thread in the system
- * on entry.
+ * Application entry point.
*/
int main(int argc, char **argv) {
@@ -47,6 +46,16 @@ int main(int argc, char **argv) {
(void)argv;
/*
+ * System initializations.
+ * - HAL initialization, this also initializes the configured device drivers
+ * and performs the board-specific initializations.
+ * - Kernel initialization, the main() function becomes a thread and the
+ * RTOS is active.
+ */
+ halInit();
+ chSysInit();
+
+ /*
* Activates the serial driver 2 using the driver default configuration.
*/
sdStart(&SD2, NULL);
diff --git a/docs/reports/STM32F100-24.txt b/docs/reports/STM32F100-24.txt
index f395437b0..5c87b1e52 100644
--- a/docs/reports/STM32F100-24.txt
+++ b/docs/reports/STM32F100-24.txt
@@ -5,7 +5,7 @@ Settings: SYSCLK=24, ACR=0x10 (no wait states)
*** ChibiOS/RT test suite
***
-*** Kernel: 2.1.5unstable
+*** Kernel: 2.1.6unstable
*** GCC Version: 4.5.1
*** Architecture: ARMv7-M
*** Core Variant: Cortex-M3
diff --git a/docs/reports/STM32F103-72-IAR.txt b/docs/reports/STM32F103-72-IAR.txt
index 274ccda44..d0444444b 100644
--- a/docs/reports/STM32F103-72-IAR.txt
+++ b/docs/reports/STM32F103-72-IAR.txt
@@ -98,43 +98,43 @@ Compiler: IAR C/C++ Compiler for ARM 6.10.1.32143
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.1 (Benchmark, messages #1)
---- Score : 237879 msgs/S, 475758 ctxswc/S
+--- Score : 237877 msgs/S, 475754 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.2 (Benchmark, messages #2)
---- Score : 206437 msgs/S, 412874 ctxswc/S
+--- Score : 206433 msgs/S, 412866 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.3 (Benchmark, messages #3)
---- Score : 204672 msgs/S, 409344 ctxswc/S
+--- Score : 204665 msgs/S, 409330 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.4 (Benchmark, context switch)
---- Score : 861664 ctxswc/S
+--- Score : 861656 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.5 (Benchmark, threads, full cycle)
---- Score : 149985 threads/S
+--- Score : 149983 threads/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.6 (Benchmark, threads, create only)
---- Score : 226634 threads/S
+--- Score : 226631 threads/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.7 (Benchmark, mass reschedule, 5 threads)
---- Score : 68159 reschedules/S, 408954 ctxswc/S
+--- Score : 68158 reschedules/S, 408948 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.8 (Benchmark, round robin context switching)
---- Score : 459048 ctxswc/S
+--- Score : 459040 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.9 (Benchmark, I/O Queues throughput)
---- Score : 535136 bytes/S
+--- Score : 535124 bytes/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.10 (Benchmark, virtual timers set/reset)
---- Score : 674558 timers/S
+--- Score : 674546 timers/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.11 (Benchmark, semaphores wait/signal)
@@ -142,7 +142,7 @@ Compiler: IAR C/C++ Compiler for ARM 6.10.1.32143
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.12 (Benchmark, mutexes lock/unlock)
---- Score : 627440 lock+unlock/S
+--- Score : 627424 lock+unlock/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.13 (Benchmark, RAM footprint)
diff --git a/docs/reports/STM32F103-72.txt b/docs/reports/STM32F103-72.txt
index d54aab66f..e1f06d20a 100644
--- a/docs/reports/STM32F103-72.txt
+++ b/docs/reports/STM32F103-72.txt
@@ -5,7 +5,7 @@ Settings: SYSCLK=72, ACR=0x12 (2 wait states)
*** ChibiOS/RT test suite
***
-*** Kernel: 2.1.5unstable
+*** Kernel: 2.1.6unstable
*** GCC Version: 4.5.1
*** Architecture: ARMv7-M
*** Core Variant: Cortex-M3
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
diff --git a/readme.txt b/readme.txt
index 76796f463..a3d58dc0b 100644
--- a/readme.txt
+++ b/readme.txt
@@ -66,9 +66,14 @@
*** 2.1.6 ***
- FIX: Fixed error in sdPutTimeout() macro (bug 3138763)(backported in 2.0.9).
+- NEW: New ARM Cortex-Mx port for IAR compiler.
- NEW: Now the STM32 CAN driver puts the lower half word of the ESR
register in the upper half word of the can status word for easier
debug.
+- CHANGE: Changes in the board files organization, now the board
+ initialization is invoked from within halInit() after all the device
+ drivers have been initialized. Now applications are required to
+ explicitely invoke halInit() and chSysInit() from within their main().
- CHANGE: Removed the CMSIS files from the ARMCMx port, added the headers
into the various HAL platforms requiring them. The change is required
because the port layer must not have vendor specific dependencies and