diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2008-10-04 09:31:36 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2008-10-04 09:31:36 +0000 |
commit | 9415b92dde53fe5898be66a29ccf35bb25d2ebe5 (patch) | |
tree | fa02cd4b70eb9a7ba5ae6d742b8b8530403ce582 /demos/ARMCM3-STM32F103-GCC | |
parent | 102341ad5d0e39af783675233b888977ab4585db (diff) | |
download | ChibiOS-9415b92dde53fe5898be66a29ccf35bb25d2ebe5.tar.gz ChibiOS-9415b92dde53fe5898be66a29ccf35bb25d2ebe5.tar.bz2 ChibiOS-9415b92dde53fe5898be66a29ccf35bb25d2ebe5.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@450 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos/ARMCM3-STM32F103-GCC')
-rw-r--r-- | demos/ARMCM3-STM32F103-GCC/board.c | 20 | ||||
-rw-r--r-- | demos/ARMCM3-STM32F103-GCC/main.c | 9 |
2 files changed, 19 insertions, 10 deletions
diff --git a/demos/ARMCM3-STM32F103-GCC/board.c b/demos/ARMCM3-STM32F103-GCC/board.c index f10269aa6..7bfa42133 100644 --- a/demos/ARMCM3-STM32F103-GCC/board.c +++ b/demos/ARMCM3-STM32F103-GCC/board.c @@ -24,10 +24,11 @@ #include "stm32_serial.h"
/*
- * Hardware initialization goes here.
- * NOTE: Interrupts are still disabled.
+ * Early initialization code.
+ * This initialization is performed just after reset before BSS and DATA
+ * segments initialization.
*/
-void hwinit(void) {
+void hwinit0(void) {
/*
* Clocks and PLL initialization.
@@ -76,6 +77,14 @@ void hwinit(void) { GPIOD->CRL = VAL_GPIODCRL;
GPIOD->CRH = VAL_GPIODCRH;
GPIOD->ODR = VAL_GPIODODR;
+}
+
+/*
+ * Late initialization code.
+ * This initialization is performed after BSS and DATA segments initialization
+ * and before invoking the main() function.
+ */
+void hwinit1(void) {
/*
* NVIC/SCB initialization.
@@ -95,4 +104,9 @@ void hwinit(void) { * Other subsystems initialization.
*/
InitSerial(0x80, 0x80, 0x80);
+
+ /*
+ * ChibiOS/RT initialization.
+ */
+ chSysInit();
}
diff --git a/demos/ARMCM3-STM32F103-GCC/main.c b/demos/ARMCM3-STM32F103-GCC/main.c index 59e7b792a..0df4bc03d 100644 --- a/demos/ARMCM3-STM32F103-GCC/main.c +++ b/demos/ARMCM3-STM32F103-GCC/main.c @@ -39,17 +39,12 @@ static msg_t Thread1(void *arg) { }
/*
- * Entry point, the interrupts are disabled on entry.
+ * Entry point, note, the main() function is already a thread in the system
+ * on entry.
*/
int main(int argc, char **argv) {
/*
- * The main() function becomes a thread here then the interrupts are
- * enabled and ChibiOS/RT goes live.
- */
- chSysInit();
-
- /*
* Creates the blinker thread.
*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
|