Startup
The StartUp module is a fundamental component of the embedded system that ensures proper initialization of the microcontroller immediately after a reset or power-up. This module prepares the hardware and memory environment before handing control over to the user-defined main() function.
Purpose
The StartUp module is responsible for setting up the essential environment required for the application to run correctly. It is tightly coupled with the microcontroller’s architecture and typically executes directly after the reset vector is triggered.
Features
-
Stack Pointer and Vector Table Initialization
Sets the initial stack pointer and configures the interrupt vector table to ensure correct exception and interrupt handling. -
Memory Section Initialization
Copies initialized data from flash to RAM and clears the.bsssection to zero-initialize uninitialized variables. -
Constructor Execution
Automatically calls static constructors (e.g., C++ global objects) beforemain()is invoked, ensuring proper setup of runtime environments. -
RCC (Reset and Clock Control) Initialization
Configures system clocks (HSE, PLL, etc.) to ensure the microcontroller and peripherals operate at the desired frequencies. -
Main Application Launch
Transfers execution to theAppMain()function, which contains the user application logic.
Implementation Details
- The module typically includes a
startup_<device>.sassembly file and C source files for low-level initialization. - Standard memory sections handled:
.data– copied from flash to RAM.bss– zero-initialized in RAM
- Custom initialization functions may be provided for clock setup or peripheral preparation.
Dependencies
- CMSIS (ARM Cortex-M core support)
- MCAL (for RCC and NVIC configuration)
- Linker script (defines memory regions and startup symbols)
Usage
Include this module at the very beginning of your embedded application. Ensure the vector table and reset handler symbols are defined in the linker script, and that the startup assembly is the entry point in your project.
License
This project is licensed under the Creative Commons Attribution–NonCommercial 4.0 International (CC BY-NC 4.0).
You are free to use, modify, and share this work for non-commercial purposes, provided appropriate credit is given.
See LICENSE.md for full terms or visit creativecommons.org/licenses/by-nc/4.0.
Authors
- Mr.Nobody — embedbits.com
Contributions are welcome! Please open a pull request.