
|
Figure 1 - Reset sequence diagram with Processor Expert |
_EntryPoint function
The _EntryPoint() function is called as the first function after the reset. This function is defined in the cpu module, usually Cpu.c, and provides necessary system initialization such as PLL and external bus.
Sometimes it is necessary to do some special user initialization immediately after the cpu reset. Processor Expert provides a possibility to insert user code into the _EntryPoint() function. There is a User Initialization property in the build options tab of a CPU component inspector defined for this purpose.
The first level of PE initialization in _EntryPoint contains
- Disabling of the watchdog if required in Common settings / Watchdog item in Cpu component.
- Initialization of the fast interrupt 0 and fast interrupt 1 if they are used.
- Initialization of the PLL interrupt priority.
- MCM Core fault settings including interrupt priority based on OnCoreFault event enabling and CPU interrupts / Interrupt Core Fault items in Cpu component.
- Initialization of the oscillators related pins based on settings of Clock properties in CPU component.
- Initialization of the oscillators based on settings of Clock properties in CPU component.
- If PLL is enabled, initialization and enabling of the PLL and PLL interrupt (based on Enabled speed modes / High speed mode properties in CPU component and PLL event setting).
- Initialization of the CPU clock sources based on Enabled speed modes / High speed mode / Input clock source property.
C startup function
The C startup function in the C startup module is called at the end of the _EntryPoint() function. It provides a necessary initialization of the stack pointer, runtime libraries, and so on. At the end of the C startup function the main() function is called.
PE_low_level_init()
There is a second level of Processor Expert initialization PE_low_level_init() called at the beginning of the main() function. PE_low_level_init() function provides initialization of all components in project and it is necessary for proper functionality of the Processor Expert project.
The second level of PE initialization contains
- Initialization of internal peripherals in the following order - based on settings of the Internal peripherals items in Cpu component
- Initialization of SIM module – except pin muxing. GPIOn clock gate is enabled if it's needed for pin muxing initialization - it's enabled even if it's disabled in Internal peripherals / System Integration Module / Clock gating control in CPU component (it will be disabled later).
- Initialization of MCM module.
- Initialization of PMC module if enabled.
- Initialization of FMC module if enabled.
- Initialization of GPIOn modules (pin functional properties drive strength, slew rate, etc. except pull resistor and open drain).
- Initialization of the two's complement rounding and enabling saturation according to value of the Common settings / Saturation mode property in the Cpu component
- Initialization of the shadow registers based on Initialize shadow registers settings in the CPU component.
- Common initialization
- Initialization of the pin/signal muxing collected from all components in the project – enabling/disabling of the GPIOn clock gate is ensured automatically.
- Initialization of the interrupt priorities collected from all components except some system interrupts like MCM Core fault PLL Error or PMC Low voltage.
- Initialization of the unused I/O pins based on Initialize unused I/O pins properties in CPU component.
- Other initialization originated from some components (e.g. Init_GPIO, BitIO,...)
- Disabling of the GPIOn clock gates if it's disabled in Internal peripherals / System Integration Module / Clock gating control in CPU component in case it was temporarily enabled (see the first step).
- Initialization of components in a project (typically calling their Init method (e.g. Init_ADC, ADC, Init_SPI, SynchroMaster,...).
- Required priority level setup based on Common settings / Initialization priority item in the CPU component.
OnReset event
The user can write the code that will be invoked from the PE_low_level_init() function after the Processor Expert internal initialization, but before the initialization of individual components. Thus, the user should expect that peripherals are not completely initialized yet. This event can be enabled/disabled in the CPU component inspector's events page.
Copyright 2013 Freescale Semiconductor, Inc.
PROCESSOR EXPERT is trademark of Freescale Semiconductor, Inc.