git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@450 35acf78f-673a-0410-8e92-d51de3d6d3f4

master
gdisirio 2008-10-04 09:31:36 +00:00
parent 102341ad5d
commit 9415b92dde
4 changed files with 53 additions and 12 deletions

View File

@ -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();
}

View File

@ -39,16 +39,11 @@ 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.
*/

View File

@ -47,6 +47,10 @@ ResetHandler:
msr PSP, r0
// ldr r1, =__process_stack_size__
// sub r0, r0, r1
/*
* Early initialization.
*/
bl hwinit0
/*
* Data initialization.
* NOTE: It assumes that the DATA size is a multiple of 4.
@ -82,9 +86,9 @@ bloop:
msr BASEPRI, r0
cpsie i
/*
* Application-provided HW initialization routine.
* Late initialization.
*/
bl hwinit
bl hwinit1
/*
* main(0, NULL).
*/
@ -92,3 +96,27 @@ bloop:
mov r1, r0
bl main
bl chSysHalt
/*
* 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.
*/
.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:
bx lr

View File

@ -75,6 +75,10 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process,
*****************************************************************************
*** 0.7.2 ***
- CHANGE: Modified the CM3 startup file in order to implement an early
initializaiton phase: hwinit0, the late initialization phase is now named
hwinit1. The demo now initializes the PLL before initializing the BSS and
DATA segments, this greatly optimizes the system start up time.
- Modified the STM32 demo makefile to use the latest YAGARTO toolchain as
default (arm-elf-gcc).