What is an Embedded System & Microcontroller Overview-Free Embedded C Tutorial

Need Help or More Information?

Questions about this free C programming course, embedded C training or career guidance? Get in touch.

Embedded C Programming · Module 1 · Lesson 1

What is an Embedded System & Microcontroller Overview

Understand what embedded systems are, how they differ from general-purpose computers, and get a deep-dive into the microcontroller — the heart of every embedded C program.

Beginner
Level
~25 min
Read Time
Module 1
Foundation

🎯 What You Will Learn in This Lesson

  • What an embedded system is and how it differs from a general-purpose computer
  • Real-world examples of embedded systems around you every day
  • Key characteristics that define an embedded system
  • What a microcontroller (MCU) is and what components it contains
  • Difference between a microcontroller (MCU) and a microprocessor (MPU)
  • Overview of the STM32F407 microcontroller and the ARM Cortex-M4 core
  • Introduction to the MCU memory map and peripheral register regions
  • Why the C programming language is ideal for embedded systems programming
Key Topics Covered
Embedded System Microcontroller (MCU) STM32F407 ARM Cortex-M4 MCU vs MPU Memory Map Flash Memory SRAM Peripherals Embedded C Programming

1. What is an Embedded System?

An embedded system is a dedicated computer system designed to perform one or a few specific functions within a larger system — often with real-time computing constraints. Unlike your laptop or desktop, which is a general-purpose machine that can run any software, an embedded system is purpose-built for its task.

The word embedded comes from the fact that these systems are embedded (built inside) larger products — they are not standalone computers. You interact with dozens of embedded systems every single day without even realizing it.

💡 Simple Definition

An embedded system = a microcontroller or processor + software + hardware circuitry combined to do a specific dedicated job inside a product.

Real-World Examples of Embedded Systems

Embedded systems are everywhere. Here are examples across different domains:

🚗
Automotive
  • Engine Control Unit (ECU)
  • Anti-lock Braking System (ABS)
  • Airbag control system
  • Dashboard display
🏠
Home Appliances
  • Washing machine
  • Microwave oven
  • Air conditioner
  • Smart TV remote
💊
Medical
  • Pacemaker
  • Blood glucose monitor
  • Digital thermometer
  • Insulin pump
📷
Consumer Electronics
  • Digital camera
  • Smartwatch
  • ATM machine
  • Traffic light controller

2. Key Characteristics of Embedded Systems

Embedded systems have a unique set of characteristics that differentiate them from general-purpose computing systems. Understanding these will help you write better embedded C code:

Characteristic Description Impact on C Code
Dedicated Function Designed for one specific task or a small set of tasks Code is lean, optimized, no OS overhead usually
Real-Time Operation Must respond to events within strict time deadlines Careful use of interrupts, avoid blocking delays
Limited Resources Small RAM (KB range), limited Flash, low-power CPU Memory-conscious code, avoid dynamic allocation
Hardware Interaction Directly controls physical hardware (sensors, motors, LEDs) Register-level programming, memory-mapped I/O
Power Constraints Battery-operated devices need low power consumption Sleep modes, clock gating, efficient algorithms
Reliability Must run continuously, often without human intervention Watchdog timers, error handling, defensive coding

3. General-Purpose Computer vs Embedded System

Before going further, let us clearly understand the difference between what you use to write code (a general-purpose computer) and what you program (an embedded system):

General-Purpose Computer vs Embedded System — Key Differences
Property General-Purpose Computer Embedded System
Purpose Runs any application One specific task
Processor Microprocessor (MPU) Microcontroller (MCU)
RAM 8 GB – 64 GB 64 KB – 512 KB (typical)
Storage 256 GB – 2 TB SSD 128 KB – 2 MB Flash
Operating System Windows, Linux, macOS Bare-metal or RTOS
Power Consumption 10–300 Watts milliwatts to <1 Watt
Cost $300 – $3000 $0.10 – $20 (MCU chip)

4. What is a Microcontroller (MCU)?

A microcontroller (MCU) is a compact integrated circuit (chip) that contains a processor core, memory (both Flash and RAM), and programmable input/output peripherals — all on a single chip. This is the critical difference from a microprocessor (MPU), which only contains the CPU core and requires external memory and peripherals.

📌 Key Insight

A microcontroller is a complete computer on a single chip. It contains the CPU, Flash (program storage), SRAM (data storage), timers, UART, SPI, I2C, ADC, GPIO — everything needed to build an embedded application without needing external components for basic operation.

Components Inside an MCU

Microcontroller Internal Architecture
CPU Core (ARM Cortex-M4)
Executes program instructions | Performs arithmetic and logic | Manages interrupts
Flash Memory
1 MB (STM32F407)
Stores your program
Non-volatile (keeps data after power off)
SRAM
192 KB (STM32F407)
Stores variables at runtime
Volatile (lost on power off)
Clock System
HSE, HSI, PLL
Controls speed of MCU
Up to 168 MHz
GPIO
General Purpose I/O
Control LEDs, read buttons
Configurable as input/output
Timers
General purpose timers
PWM generation
Input capture
UART / USART
Serial communication
Debug output
Communicate with PC
SPI / I2C
High-speed serial bus
Communicate with sensors
External devices
ADC / DAC
Analog to Digital
Read sensor voltages
12-bit resolution
Internal Bus System (AHB/APB)
Connects all components | Transfers data between CPU, Memory, and Peripherals

5. MCU vs MPU — The Fundamental Difference

This is one of the most commonly asked questions in embedded systems interviews. Let us settle it clearly:

MCU — Microcontroller
  • CPU + Flash + RAM + Peripherals — all on one chip
  • Self-contained — can run standalone
  • Lower performance (MHz range)
  • Very low power, very low cost
  • Examples: STM32, AVR Arduino, PIC, ESP32
  • Used in: appliances, IoT, automotive sensors
MPU — Microprocessor
  • CPU only — needs external RAM, storage, peripherals
  • Requires complete board design with external chips
  • Higher performance (GHz range)
  • Higher power, higher cost
  • Examples: Intel Core, ARM Cortex-A (Raspberry Pi)
  • Used in: smartphones, PCs, embedded Linux systems
💡 Simple Memory Aid

MCU = Mini Complete Unit (everything inside). MPU = Main Processor Unit only (needs external parts).

6. STM32F407 — Our Target Microcontroller

Throughout this course we use the STM32F407VGT6 microcontroller mounted on the STM32F407 Discovery board. This is an excellent learning platform — powerful enough to learn real embedded programming, and widely used in industry.

STM32F407 Key Specs
  • Core: ARM Cortex-M4
  • Speed: Up to 168 MHz
  • Flash: 1 MB
  • SRAM: 192 KB (128+64)
  • GPIO: Up to 82 I/O pins
  • Timers: 17 timers
  • ADC: 3 x 12-bit ADC
  • USB: USB OTG FS/HS
  • Operating Voltage: 1.8 – 3.6V
ARM Cortex-M4 Core
  • Architecture: ARMv7E-M
  • Data bus: 32-bit
  • FPU: Hardware Floating Point Unit
  • DSP: DSP instructions built-in
  • Pipeline: 3-stage + branch predictor
  • Endianness: Little-endian
  • Interrupt: NVIC (240 IRQs)
  • Debug: SWD / JTAG

What is the ARM Cortex-M4?

ARM does not manufacture chips. ARM designs the processor architecture (instruction set, pipeline, registers) and licenses it to chip manufacturers. STMicroelectronics (the maker of STM32) licenses the Cortex-M4 design from ARM and integrates it with their own memory, peripherals, and bus systems to create the STM32F407.

The Cortex-M family is specifically designed for microcontrollers — it is optimized for low power, deterministic interrupt handling, and ease of programming in C.

7. Introduction to the MCU Memory Map

One of the most critical concepts in embedded C programming is the memory map. The ARM Cortex-M4 has a 32-bit address bus, which means it can address 232 = 4 GB of memory locations. This entire 4 GB address space is divided into regions, each with a specific purpose.

STM32F407 Memory Map (Simplified)
0xFFFFFFFF
0xE0000000
0x60000000
0x40000000
0x20000000
0x08000000
0x00000000
Vendor-specific / Reserved
Core Peripherals (NVIC, SysTick, Debug) — 0xE0000000
External Memory / FSMC — 0x60000000
★ PERIPHERAL REGISTERS — 0x40000000 (GPIO, UART, SPI, RCC…)
★ SRAM — 0x20000000 (192 KB — Variables, Stack, Heap)
★ FLASH (CODE) — 0x08000000 (1 MB — Your Program Code)
Code Alias / System Memory — 0x00000000

The three most important regions for your embedded C code are:

  • Flash (0x08000000): Where your compiled C program is stored. Read-only during normal operation. Non-volatile — your program survives power cycles.
  • SRAM (0x20000000): Where global variables, local variables, and the stack live at runtime. Volatile — lost when power is off.
  • Peripheral Registers (0x40000000): Where all hardware peripherals (GPIO, UART, SPI, etc.) are accessible. Writing to these addresses controls physical hardware.
⚠ Remember This Always

In embedded C, when you write uint32_t *pReg = (uint32_t*)0x40020C00; and then *pReg = 0x01;, you are writing a value directly to a hardware register. There is no operating system between you and the hardware. That is the power — and responsibility — of embedded C programming.

8. Why C for Embedded Systems Programming?

C has been the dominant language for embedded systems programming for over 40 years. While languages like C++, Rust, and Python are gaining ground in some areas, C remains the gold standard for microcontroller programming. Here is why:

⚗ Low-Level Hardware Access

C allows direct memory manipulation via pointers, enabling direct access to hardware registers at specific memory addresses.

⚙ Efficient Code Generation

C compilers generate tight, predictable machine code — critical when you have only 128 KB of Flash for your entire program.

📚 Portability

C code can be compiled for virtually any processor architecture with minimal changes — from 8-bit AVR to 32-bit ARM to 64-bit processors.

🌟 Industry Standard

All major embedded frameworks (CMSIS, HAL, FreeRTOS, Linux kernel) are written in C. Knowing C means you can read and contribute to all of them.

Embedded C is essentially standard C (typically C99 or C11) with additional features and conventions specific to embedded work — such as fixed-width integer types from <stdint.h>, the volatile and const type qualifiers, bit-field structures, and memory-mapped register access patterns.

🌟 Key Takeaways — Lesson 1.1

  • An embedded system is a dedicated computer for a specific function, embedded inside a larger product
  • MCU = CPU + Flash + RAM + Peripherals all on one chip — self-contained and low-cost
  • MPU (microprocessor) = CPU only — needs external memory and peripherals
  • STM32F407 has ARM Cortex-M4 core at 168 MHz, 1 MB Flash, 192 KB SRAM
  • The memory map divides 4 GB address space into Flash (code), SRAM (data), and Peripheral regions
  • Peripheral registers at 0x40000000 — writing to these addresses controls hardware
  • C is the dominant embedded language due to low-level access, efficiency, and portability

⚠ Common Misconceptions for Beginners

  • “MCU and MPU are the same thing” — They are NOT. MCU is all-in-one; MPU is CPU only.
  • “Embedded C is a different language” — It is standard C with embedded-specific conventions, not a separate language.
  • “I need an OS to program a microcontroller” — No. Bare-metal embedded C runs directly on hardware with no OS.
  • “The MCU memory is like a PC’s memory” — MCU memory is measured in KB, not GB. Code runs directly from Flash.
  • “GPIO just controls LEDs” — GPIO is a general-purpose I/O — it can interface with any digital signal: buttons, sensors, displays, relays.

Frequently Asked Questions (FAQ)

Q1: What is the difference between an embedded system and a real-time system?
An embedded system is defined by its dedicated hardware purpose. A real-time system is defined by its timing requirements — it must respond to events within guaranteed deadlines. Many embedded systems are also real-time systems (like an airbag controller), but not all (like a USB flash drive). All real-time systems are embedded systems, but not all embedded systems are strictly real-time.
Q2: Why do we use the STM32F407 for learning embedded C?
The STM32F407 offers an excellent balance: it is powerful enough (168 MHz Cortex-M4, 1 MB Flash, 192 KB RAM) to run real applications, yet simple enough to understand at the register level without complex OS abstraction. It has extensive documentation, affordable hardware (Discovery board), and is widely used in the industry — making your skills directly transferable.
Q3: Is Flash memory the same as the hard drive of an MCU?
Conceptually yes — both are non-volatile storage (data survives power-off). But MCU Flash is much smaller (KB to MB) and the program runs directly from Flash without being loaded into RAM first (unlike a PC where the OS loads programs from disk into RAM). On MCU, Flash is part of the same address space as RAM — there is no separate disk.
Q4: What does “memory-mapped I/O” mean in embedded C?
Memory-mapped I/O means that peripheral registers (hardware control registers) are mapped to specific addresses in the processor’s memory address space. The CPU accesses these registers using the same load/store instructions it uses for RAM. So in C, writing to a specific memory address (like 0x40020C00) directly controls hardware — there is no special I/O instruction needed.
Q5: Can I run Python or Java on a microcontroller like STM32?
Python (via MicroPython) can run on some MCUs, but it requires significant Flash/RAM and the execution is slower. Java is generally not practical for bare-metal MCUs. C remains the dominant choice because it compiles to efficient native machine code, giving you precise control over timing, memory, and hardware — which Python/Java interpreters cannot guarantee.
Q6: What is SRAM and why is it volatile?
SRAM (Static Random Access Memory) is a type of RAM that uses flip-flops to store each bit. It is called “volatile” because it requires continuous power to maintain its contents — when power is removed, all data is lost. This is why global variables and local variables stored in SRAM are reset/zeroed at each power-up (via the startup code), and your program itself is stored in non-volatile Flash.

▶ Next Steps

Now that you understand what an embedded system is and how the STM32F407 MCU is structured internally, the next lesson covers:

  • Setting up the STM32CubeIDE development environment
  • Creating your first embedded C project
  • Understanding the project files (startup, linker script, main.c)
  • The build → flash → debug workflow

Need Help or More Information?

Questions about this free C programming course, embedded C training or career guidance? Get in touch.

2 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *