ES: ARM Bare Metal Introduction

ARM bare-metal development means writing firmware that runs directly on an ARM processor without any operating system. This introduction covers the ARM ecosystem, development tools, the ARM Cortex processor families, and the path from a first LED blink to advanced RTOS-based applications.

ARM processors power the vast majority of microcontrollers used in embedded systems today. From a tiny IoT sensor to a complex automotive control unit, ARM Cortex-M processors deliver the combination of performance, power efficiency, and ecosystem maturity that makes them the dominant choice for bare-metal embedded development.

This guide provides an overview of the ARM ecosystem and outlines the full learning path from basics to advanced topics.


Module 1: Introduction to ARM

ARM stands for Advanced RISC Machines. It refers to both the company and the family of processor architectures it licenses.

Key points:

  • ARM is a RISC (Reduced Instruction Set Computing) architecture
  • ARM Ltd. licenses its designs to semiconductor manufacturers — they do not manufacture chips themselves
  • ARM processors are found in over 95% of the world's smartphones and in billions of embedded devices

For embedded systems, the ARM Cortex family provides three distinct lines:

md
+------------------+------------------------------------------+
| Cortex-M Series  | Microcontrollers, IoT, real-time, low power |
+------------------+------------------------------------------+
| Cortex-A Series  | Application processors, Linux, Android   |
+------------------+------------------------------------------+
| Cortex-R Series  | Real-time, safety-critical, automotive   |
+------------------+------------------------------------------+


Module 2: ARM Architecture Basics

ARM is built on RISC principles:

  • Simple, fixed-length instructions
  • Load/store memory model
  • Large register file
  • Pipeline execution for throughput

The instruction set families:

Instruction SetWidthDescription
ARM32-bitFull performance, Cortex-A
Thumb16-bitCompact code, reduced memory
Thumb-216/32-bit mixedBest of both — used in Cortex-M

The Cortex-M series uses the Thumb-2 instruction set, achieving high code density with 32-bit performance — ideal for microcontrollers with limited flash.

Big.LITTLE technology (found in mobile Cortex-A chips) combines high-performance cores with low-power cores, dynamically switching between them to balance performance and battery life.


Module 3: ARM Development Ecosystem

Development Tools

CategoryTools
IDEsKeil uVision, STM32CubeIDE, PlatformIO (VS Code)
DebuggersJTAG, SWD (Serial Wire Debug), J-Link, ST-Link
CompilersARM Compiler 6, GCC for ARM (arm-none-eabi-gcc)
Debugger frontendGDB, OpenOCD
BoardProcessorUse Case
STM32 NucleoSTM32 (Cortex-M)Bare-metal, RTOS development
Raspberry PiBCM (Cortex-A)Linux-based embedded applications
NXP FRDMLPC (Cortex-M)IoT and industrial prototyping
LM3S6965EVBCortex-M3QEMU emulation for testing

SDKs and Libraries

  • ARM CMSIS (Cortex Microcontroller Software Interface Standard) — defines standard APIs for Cortex-M core access, DSP, and RTOS interfaces
  • STM32 HAL — STMicroelectronics hardware abstraction layer
  • NXP MCUXpresso SDK — NXP vendor SDK

Module 4: Getting Started with ARM Development

Setting Up the Environment

  1. Install IDE (Keil uVision, STM32CubeIDE, or VS Code with PlatformIO)
  2. Install GCC ARM toolchain: arm-none-eabi-gcc
  3. Install OpenOCD or J-Link for programming and debugging
  4. Connect the target board via USB with an SWD/JTAG programmer

Understanding ARM Assembly

ARM assembly basics:

md
Instruction  Operands        Description
-----------  --------        -----------
MOV R0, #1                   Load immediate value 1 into R0
LDR R1, [R0]                 Load word from memory address in R0 into R1
STR R1, [R0]                 Store R1 to memory address in R0
ADD R2, R0, R1               R2 = R0 + R1
BX  LR                       Branch to address in Link Register (return)

c
#include "stm32f1xx.h"

int main(void) {
    // Enable GPIOC clock
    RCC->APB2ENR |= RCC_APB2ENR_IOPCEN;

    // Configure PC13 as push-pull output
    GPIOC->CRH &= ~(GPIO_CRH_CNF13 | GPIO_CRH_MODE13);
    GPIOC->CRH |=  GPIO_CRH_MODE13_0; // Output mode, max speed 10 MHz

    while (1) {
        GPIOC->BSRR = GPIO_BSRR_BS13;   // LED ON
        for (volatile int i = 0; i < 500000; i++);
        GPIOC->BSRR = GPIO_BSRR_BR13;   // LED OFF
        for (volatile int i = 0; i < 500000; i++);
    }
}


Module 5: Intermediate ARM Programming

Advanced Peripheral Programming

After mastering GPIO, the next step is communication peripherals:

md
Peripheral  Protocol     Typical Use
----------  --------     -----------
UART        Serial       Debug output, PC communication
SPI         Serial       High-speed sensors, displays, flash memory
I2C         Serial       Sensors, EEPROMs, RTCs (short distances)

Real-Time Operating Systems (RTOS)

For applications beyond simple super-loops, an RTOS provides:

  • Task scheduling — multiple concurrent tasks with priorities
  • Inter-task communication — queues, mailboxes, semaphores
  • Timing services — software timers, periodic tasks
  • Synchronization — mutexes to prevent data races

FreeRTOS is the most widely used RTOS on ARM Cortex-M:

c
// FreeRTOS task example
void vLEDTask(void *pvParameters) {
    while (1) {
        GPIO_TogglePin(GPIOC, GPIO_PIN_13);
        vTaskDelay(pdMS_TO_TICKS(500));  // Non-blocking 500ms delay
    }
}

int main(void) {
    xTaskCreate(vLEDTask, "LED", 128, NULL, 1, NULL);
    vTaskStartScheduler();
    while (1);
}

Debugging and Optimization

  • GDB + OpenOCD for source-level debugging over SWD
  • SWV (Serial Wire Viewer) for real-time variable monitoring
  • Compiler flags for size (-Os) and speed (-O2, -O3) optimization
  • Link-time optimization (LTO) for smaller binaries

Module 6: Advanced ARM Topics

ARM in IoT and Connectivity

ARM MCUs are commonly used with IoT protocols:

  • MQTT for lightweight publish/subscribe messaging
  • CoAP for constrained RESTful communication
  • AWS IoT integration via MQTT and TLS

ARM Security Features

TrustZone provides hardware-enforced security isolation:

md
+--------------------+     +--------------------+
|   Secure World     |     |   Non-Secure World  |
|   (TrustZone)      |     |   (Normal App)      |
|   Keys, certs      |     |   User code         |
|   Crypto ops       |     |   RTOS tasks        |
+--------------------+     +--------------------+
         ^                           ^
         |      ARM Cortex-M33       |
         +----------- SoC -----------+

Secure boot ensures the processor only executes authenticated firmware, preventing malicious code injection.

Machine Learning on ARM

ARM provides:

  • CMSIS-NN — neural network kernels optimized for Cortex-M
  • Arm NN — inference engine for Cortex-A
  • TensorFlow Lite for Microcontrollers — runs on Cortex-M with no OS

Module 7: ARM Ecosystem and Career

ARM-Based Platforms

DomainPlatformProcessor
MobileQualcomm SnapdragonCortex-A
MobileApple A/M seriesCustom ARM
AutomotiveNXP S32Cortex-M/R
IoTSTM32Cortex-M
IndustrialRenesas RZCortex-A

ARM Learning Resources

  • ARM Keil MDK — professional development environment
  • ARM Developer website — datasheets, AN, training
  • Coursera/edX ARM courses — structured learning paths
  • OpenCores — open hardware reference designs

Career Pathways with ARM Expertise

Mastering ARM bare-metal development opens roles in:

  • Embedded firmware engineer — MCU-level device firmware
  • RTOS developer — real-time system integration
  • IoT systems engineer — connected device development
  • Safety-critical engineer — ISO 26262, IEC 61508 domains

md
Foundation:     ARM Bare Metal (GPIO, Timers, Interrupts)
         |
         v
Intermediate:   Communication Protocols (UART, SPI, I2C)
         |
         v
Advanced:       RTOS, Security (TrustZone), ML (CMSIS-NN)
         |
         v
Specialization: Automotive, IoT, Medical, Industrial


Final Thoughts

ARM bare-metal development is the foundation of professional embedded engineering. The ARM Cortex-M ecosystem provides a standardized, well-documented, and extensively tooled platform for developing firmware that ranges from a simple LED blink to a complex IoT gateway.

Understanding ARM bare metal means understanding how software directly commands silicon.