1. Introduction

1. Motivations to Learn ARM-Cortex-M Programming

Popularity

ARM-Cortex-M cores are extremely popular in embedded systems. With a wide range of devices employing these processors, understanding ARM-Cortex-M programming opens doors to numerous job opportunities and project work.

32-bit Architecture

The 32-bit architecture allows for more memory and higher performance, offering a significant advantage over older 8-bit or 16-bit architectures.

Features: FPU, DSP, MPU

Some ARM-Cortex-M series chips come with Floating Point Units (FPU), Digital Signal Processors (DSP), and Memory Protection Units (MPU), offering more computational power and flexibility.

Lots of Interrupts and Easy to Use

These processors offer extensive interrupt handling capabilities, which are crucial for real-time applications. They are also easy to set up and manage.

RTOS-Friendly

ARM-Cortex-M is well-suited for Real-Time Operating Systems (RTOS), allowing for multitasking and better resource management.

Rich Instruction Set

The ARM-Cortex-M series employs a Thumb instruction set which offers a good trade-off between code density and performance. It’s often preferred over the standard ARM instruction set for its efficiency.

Extensive Documentation

There is a wealth of documentation and community support available for ARM-Cortex-M, making it easier to learn and troubleshoot.


2. Major Competitors

This course focuses on STM32 microcontrollers, which utilize ARM-Cortex-M cores. However, there are other popular microcontrollers and processors in the embedded systems landscape.

Arduino

  • Manufacturer: Arduino
  • Core: Various, including AVR, ARM, and ESP
  • Characteristics:
    • Known for user-friendly development environment
    • Rich community support and libraries
  • Documentation to Consult:
    • Arduino official website for libraries and board specs
    • Community forums for project ideas and troubleshooting

ESP (Espressif)

  • Manufacturer: Espressif Systems
  • Core: Tensilica Xtensa LX6 (ESP8266), Xtensa LX7 (ESP32)
  • Characteristics:
    • Known for integrated WiFi and Bluetooth capabilities
    • Lower cost and power-efficient
  • Documentation to Consult:
    • Espressif official documentation
    • ESP-IDF GitHub repository for SDK and toolchain

PIC (Microchip)

  • Manufacturer: Microchip Technology
  • Core: PIC
  • Characteristics:
    • Variety of families with varying performance and features
    • Known for long legacy and durability
  • Documentation to Consult:
    • PIC datasheets and reference manuals
    • Microchip developer forums

AVR (Atmel, now Microchip)

  • Manufacturer: Originally Atmel, now owned by Microchip
  • Core: AVR
  • Characteristics:
    • Known for low power consumption
    • Used in some Arduino boards
  • Documentation to Consult:
    • Atmel/Microchip datasheets and reference manuals
    • Community forums for tips and code snippets

Raspberry Pi (ARM-based)

  • Manufacturer: Raspberry Pi Foundation
  • Core: ARM Cortex-A series
  • Characteristics:
    • Single-board computers more than microcontrollers
    • Rich in features, suitable for more complex tasks
  • Documentation to Consult:
    • Raspberry Pi official website
    • Community forums and online tutorials

Texas Instruments (TI)

  • Manufacturer: Texas Instruments
  • Core: MSP430, ARM Cortex-M/R/A series among others
  • Characteristics:
    • Wide range of microcontrollers suitable for both low-power and high-performance tasks
    • Known for integrated analog components and robust peripherals
    • Strong support for real-time control applications
  • Documentation to Consult:
    • TI datasheets and reference manuals
    • Code Composer Studio IDE documentation
    • E2E support forums provided by TI

3. Hardware Heirarchy

In this section, we'll break down essential terminology, using the STM32F446 Nucleo 64 board as our example. This should provide a practical context for understanding these terms in the realm of embedded systems.

Development Board and Evaluation Board

  • Manufacturer: STMicroelectronics
  • Components:
    • MCU: STM32F446
    • On-board debugger/programmer
    • Various peripherals like LEDs, buttons
    • Pin headers for GPIOs and power
  • Documentation to Consult:
    • Nucleo board user manual
    • Board schematics

Microcontroller (MCU)

  • Manufacturer: STMicroelectronics
  • Components:
    • Processor: Contains the core and other auxiliary components like NVIC, FPB, AHB-AP, etc.
    • RAM: On-chip RAM
    • Flash Memory: On-chip Flash
    • Peripherals: UART, SPI, I2C, ADC, timers
  • Documentation to Consult:
    • STM32F446 reference manual
    • STM32F4 series datasheet

Processor

  • Manufacturer: ARM (licensed to STMicroelectronics)
  • Components:
    • Processor Core: ARM Cortex-M4
    • NVIC: Nested Vector Interrupt Controller
    • FPB: Flash Patch and Breakpoint
    • Bus Matrix
    • Memory Protection Unit
    • DWT: Data Watchpoint and Trace
    • ITM: Instrumentation Trace Macrocell
    • Note: STMicroelectronics may have implemented some of these components differently than the ARM Cortex-M4 technical reference manual specifies. They may even remove some components. For example, the STM32F446 does not have a Memory Protection Unit (MPU).
  • Documentation to Consult:
    • ARM technical documentation for the Cortex-M4
    • STM32F446 reference manual

m4_processor

Processor Core

  • Manufacturer: ARM (licensed to STMicroelectronics)
  • Components:
    • ALU: Arithmetic Logic Unit
    • Instruction Set: ARM Cortex-M4 instruction set
    • Clock Circuit: Determines the operating frequency
    • Pipeline Stages: Fetch, decode, execute stages
  • Documentation to Consult:
    • ARM Cortex-M4 technical reference manual
    • STM32F446 reference manual for how the core is implemented within the Processor

Hierarchical Breakdown

If we were to break down the STM32F446 Nucleo 64 board into a hierarchy, it would look something like this:

Development Board (STMicroelectronics)
├── MCU (STMicroelectronics)
│   ├── Processor (ARM, licensed to STMicroelectronics)
│   │   ├── Processor Core (ARM)
│   │   │   ├── ALU
│   │   │   ├── Instruction Set
│   │   │   ├── Clock Circuit
│   │   │   └── Pipeline Stages
│   │   ├── NVIC (Nested Vector Interrupt Controller)
│   │   ├── FPB (Flash Patch and Breakpoint)
│   │   ├── AHB-AP (Advanced High-performance Bus Access Port)
│   │   ├── Bus Matrix
│   │   ├── Memory Protection Unit
│   │   ├── DWT (Data Watchpoint and Trace)
│   │   └── ITM (Instrumentation Trace Macrocell)
│   ├── On-chip RAM
│   ├── On-chip Flash
│   └── Peripherals
│       ├── UART
│       ├── SPI
│       ├── I2C
│       ├── ADC
│       └── Timers
├── On-board debugger/programmer
├── Various Peripherals
│   ├── LEDs
│   └── Buttons
└── Pin headers
    ├── GPIOs
    └── Power

Other Terms

  • Microprocessor: A single-chip CPU. It does not have any on-chip memory or peripherals. This is usually more powerful than a microcontroller but requires more external components.
  • SoC: The term SoC (System-on-Chip) is often used interchangeably with MCU (Microcontroller Unit) in some contexts, but they aren't strictly the same. An SoC is essentially a complete computing system integrated onto a single chip. It includes a processor core, memory, and I/O interfaces, much like an MCU. However, an SoC generally has more capabilities, including more advanced interfaces and may even include things like graphics processing units (GPUs) or multiple processor cores.

Note of Manufacturer

ARM doesn't generally produce its own chips; instead, it designs processor architectures and licenses them to other companies like STMicroelectronics, Qualcomm, and Apple, among others. These companies then take ARM's designs and integrate them into their own products, often adding their own additional hardware features and optimizations. In the case of the STM32F446 Nucleo 64 board, the ARM Cortex-M4 core is licensed from ARM and manufactured by STMicroelectronics as part of their STM32 MCU series.