diff options
-rw-r--r-- | demos/ARM7-AT91SAM7X-GCC/main.c | 1 | ||||
-rw-r--r-- | demos/ARM7-AT91SAM7X-WEB-GCC/board.c | 17 | ||||
-rw-r--r-- | demos/ARM7-AT91SAM7X-WEB-GCC/main.c | 11 |
3 files changed, 19 insertions, 10 deletions
diff --git a/demos/ARM7-AT91SAM7X-GCC/main.c b/demos/ARM7-AT91SAM7X-GCC/main.c index c280e5489..1fc284cd3 100644 --- a/demos/ARM7-AT91SAM7X-GCC/main.c +++ b/demos/ARM7-AT91SAM7X-GCC/main.c @@ -41,7 +41,6 @@ static msg_t Thread1(void *arg) { */
int main(int argc, char **argv) {
-
/*
* Creates the blinker thread.
*/
diff --git a/demos/ARM7-AT91SAM7X-WEB-GCC/board.c b/demos/ARM7-AT91SAM7X-WEB-GCC/board.c index 2bc9c6395..8c483f1f0 100644 --- a/demos/ARM7-AT91SAM7X-WEB-GCC/board.c +++ b/demos/ARM7-AT91SAM7X-WEB-GCC/board.c @@ -55,11 +55,11 @@ static void SYSIrqHandler(void) { }
/*
- * Board initialization code.
+ * Early initialization code.
+ * This initialization is performed just after reset before BSS and DATA
+ * segments initialization.
*/
-void hwinit(void) {
- int i;
-
+void hwinit0(void) {
/*
* Flash Memory: 1 wait state, about 50 cycles in a microsecond.
*/
@@ -100,6 +100,15 @@ void hwinit(void) { AT91C_BASE_PMC->PMC_PCER = (1 << AT91C_ID_PIOA) | (1 << AT91C_ID_PIOB);
AT91C_BASE_PIOA->PIO_PER = 0xFFFFFFFF;
AT91C_BASE_PIOB->PIO_PER = 0xFFFFFFFF;
+}
+
+/*
+ * Late initialization code.
+ * This initialization is performed after BSS and DATA segments initialization
+ * and before invoking the main() function.
+ */
+void hwinit1(void) {
+ int i;
/*
* Default AIC setup, the device drivers will modify it as needed.
diff --git a/demos/ARM7-AT91SAM7X-WEB-GCC/main.c b/demos/ARM7-AT91SAM7X-WEB-GCC/main.c index 5887beedf..00dc9193e 100644 --- a/demos/ARM7-AT91SAM7X-WEB-GCC/main.c +++ b/demos/ARM7-AT91SAM7X-WEB-GCC/main.c @@ -41,19 +41,20 @@ 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.
+ * Creates the blinker and web server threads.
*/
- chSysInit();
-
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
chThdCreateStatic(waWebThread, sizeof(waWebThread), NORMALPRIO - 1, WebThread, NULL);
+ /*
+ * Normal main() thread activity.
+ */
while (TRUE) {
chThdSleep(500);
if (!(AT91C_BASE_PIOB->PIO_PDSR & PIOB_SW1))
|