Meaning
Software programs written specifically to run on microcontrollers and other hardware chips control the low-level operations of electronic systems. This code is compiled for a specific processor architecture and is typically stored in non-volatile memory on the device itself. In many systems, embedded firmware operates without a full operating system, running a single control loop instead.
It manages the boot sequence and initializes system peripherals upon startup.
Execution Model
Running code directly on bare-metal hardware demands strict memory management and deterministic execution times. Programmers often avoid dynamic memory allocation to prevent memory fragmentation and runtime crashes. The application executes from flash memory or is copied into internal static random-access memory for faster execution.
Hardware Control
Low-level drivers within the code interact directly with the physical registers of the processor. These drivers configure input pins, read sensor values through serial interfaces, and write control values to actuators. Precise timing is maintained using hardware interrupts that trigger immediate execution of critical routines.
This design ensures that time-sensitive operations like motor control receive priority over background tasks.
Update Mechanism
Updating the stored code after product shipment requires a secure bootloader that can rewrite the non-volatile memory. This update process must include error checking, such as a cyclic redundancy check, to prevent the device from becoming inoperable if the update is interrupted. Many designs use a dual-image layout where the previous working image is preserved until the new version is verified.
This redundancy guarantees that the device can recover from a failed update attempt.