We all know that the chip before running the application instructions, will first do some chip
Initializes the hardware and systems, such as the stack pointer, the RAM space, variable initialization, this code is referred to as boot code. Boot code is typically executed on the chip immediately after power on in is to be completed before the MCU initialization MCAL driver module architecture in terms of chip startup code required to complete special initialization function, these jobs do not belong to any MCAL driver modules are listed below MCAL specifications complete suggestions of startup code.
( 1) boot code should be completed by the interrupt vector table initialization.
( 2) start code should complete the initialization of the stack.
( 3) The chip supports Context Save operation, boot code memory space should be completed Context Save operation.
( 4) Make sure the boot code MCU internal watchdog in the closed state, the internal watchdog should MCAL Watchdog initialization complete drive member.
( 5) The MCU supports data / code cache, the initialization must be completed in the startup code.
( 6) should be completed by the MCU boot code memory initialization functionally related, such as memory protection.
( 7) use as an external memory, the memory should be initialized in the startup code.
( 8) boot code to be completed MCU initialization default clock configuration.
( 9) The chip support, the boot code of the protective mechanism will be special function registers.
(10) the boot code should initialize the necessary write-only register once (Write Once Register).
( 11) start code should initialize the RAM space, in order to ensure correct implementation of the MCU drives. These are the specifications for the function of the startup code MCAL recommendations should be noted that the startup code relies on ECU functions and MCU performance. Next, look at the specific S32K144 sample project used in this chapter in the startup code have done what to do.
1. Initialize the kernel general registers
mov r0,#0 mov r1,#0 mov r2,#0 mov r3,#0 mov r4,#0 mov r5,#0 mov r6,#0 mov r7,#0
2. Initialize the interrupt vector table base address
/* relocate vector table to RAM */ ldr r0,=VTOR_REG ldr r1,=VTABLE str r1,[r0]
3. Initialize the user stack
4. Close Watchdog
The system initialization
6.RAM initialization
7. Go to the Main function