aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--boards/GENERIC_SPC563/board.c22
-rw-r--r--boards/GENERIC_SPC563/board.h5
-rw-r--r--demos/PPC-SPC563-GCC/main.c13
-rw-r--r--os/ports/GCC/PPC/crt0.s14
4 files changed, 24 insertions, 30 deletions
diff --git a/boards/GENERIC_SPC563/board.c b/boards/GENERIC_SPC563/board.c
index 63e882851..8356f122d 100644
--- a/boards/GENERIC_SPC563/board.c
+++ b/boards/GENERIC_SPC563/board.c
@@ -22,20 +22,18 @@
/*
* 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) {
spc563_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) {
/*
* Various initialization (temporary code).
@@ -50,14 +48,4 @@ void hwinit1(void) {
SIU.PCR[GPIO_BUTTON4].R = 0x0100; /* IBE. */
SIU.PCR[GPIO_SCI_A_TX].R = 0x0500; /* Primary | IBE. */
SIU.PCR[GPIO_SCI_A_RX].R = 0x0500; /* Primary | IBE. */
-
- /*
- * HAL initialization.
- */
- halInit();
-
- /*
- * ChibiOS/RT initialization.
- */
- chSysInit();
}
diff --git a/boards/GENERIC_SPC563/board.h b/boards/GENERIC_SPC563/board.h
index 78213a1ae..53c1140ce 100644
--- a/boards/GENERIC_SPC563/board.h
+++ b/boards/GENERIC_SPC563/board.h
@@ -53,13 +53,14 @@
#define GPIO_LED3 190
#define GPIO_LED4 191
+#if !defined(_FROM_ASM_)
#ifdef __cplusplus
extern "C" {
#endif
- void hwinit0(void);
- void hwinit1(void);
+ void boardInit(void);
#ifdef __cplusplus
}
#endif
+#endif /* _FROM_ASM_ */
#endif /* _BOARD_H_ */
diff --git a/demos/PPC-SPC563-GCC/main.c b/demos/PPC-SPC563-GCC/main.c
index 6e65e2263..f5c6c9b40 100644
--- a/demos/PPC-SPC563-GCC/main.c
+++ b/demos/PPC-SPC563-GCC/main.c
@@ -145,8 +145,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) {
Thread *shelltp = NULL;
@@ -155,6 +154,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/os/ports/GCC/PPC/crt0.s b/os/ports/GCC/PPC/crt0.s
index e12a87843..c40f5efb2 100644
--- a/os/ports/GCC/PPC/crt0.s
+++ b/os/ports/GCC/PPC/crt0.s
@@ -52,7 +52,7 @@ _boot_address:
/*
* Early initialization.
*/
- bl hwinit0
+ bl __early_init
/*
* BSS clearing.
*/
@@ -87,9 +87,8 @@ _boot_address:
b .dataloop
.dataend:
/*
- * Late initialization.
+ * Main program invocation.
*/
- bl hwinit1
li %r3, 0
li %r4, 0
bl main
@@ -107,12 +106,9 @@ forever:
/*
* Default initialization code, none.
*/
- .weak hwinit0
- .globl hwinit0
-hwinit0:
- .weak hwinit1
- .globl hwinit1
-hwinit1:
+ .weak __early_init
+ .globl __early_init
+__early_init:
blr
/** @endcond */