Thumb vs ARM Instructions for Cortex M3

The Cortex-M3 processor supports both Thumb and ARM instruction sets. Thumb instructions are 16-bit long while ARM instructions are 32-bit long. Using Thumb instructions reduces code size, but ARM instructions can provide better performance. This article provides a detailed comparison between Thumb and ARM instructions when programming the Cortex-M3 processor. Overview of Thumb and ARM…

How to Write a Bootloader for Microcontrollers?

A bootloader is a small program that loads the main application program into the microcontroller’s memory when the device first powers on. The bootloader typically initializes the microcontroller’s hardware, validates the integrity of the main firmware image, copies the main firmware from external flash storage into RAM, and then transfers execution to the main firmware….

Armv8 Boot Sequence

When an Arm v8-based system powers on, it goes through a complex boot process to load and initialize the operating system. This boot process involves multiple stages, from low-level firmware executing to load the kernel, to starting init processes that fully initialize userspace. Understanding the full Arm v8 boot flow provides insight into the boot…

Difference Between Pre-Indexed and Post-Indexed Addressing Modes in Arm Cortex M

The main difference between pre-indexed and post-indexed addressing modes in Arm Cortex M is that in pre-indexed addressing, the offset is added to the base register value first and then the result is used as the address for the memory access operation. In post-indexed addressing, the value in the base register is used directly as…

What is the clock speed of the Cortex-M3?

The Cortex-M3 is an ARM processor core designed for embedded and IoT applications. It is part of ARM’s Cortex-M series of cores, which are optimized for low-power consumption and high efficiency in resource-constrained devices. The Cortex-M3 operates at a maximum clock frequency of 100 MHz. Overview of the Cortex-M3 The Cortex-M3 CPU was first introduced…

Switching from MSP to PSP for Cortex-M Task Switching

Task switching on Cortex-M microcontrollers can be done using either the Main Stack Pointer (MSP) or Process Stack Pointer (PSP). The MSP is used by default for the main thread of execution, while the PSP is used for context switching to other threads. Switching from using MSP to PSP offers some advantages for multithreaded applications…