Week 4 — Embedded programming

This week’s topic: Embedded programming.

Individual assignment

Your personal work for this week — notes, photos, design files, and reflections.

Group assignment

Guangzhou (Chaihuo) — group documentation: comparing toolchains and development workflows across embedded architectures.

Abstract

The group demonstrates and contrasts what is available on different embedded architectures in the lab: not only compilers and link scripts, but the full toolchain (build system, programmer/debug probe, flashing utilities, debug servers, and board-support packages) and the day-to-day workflow from “edit code” to “running firmware on hardware.” The write-up compares development software (IDEs, extensions, vendor tools), programming languages in use (C, C++, Rust, MicroPython, etc.), and pre-deployment utilities (linters, simulators, packaging, CI) as part of one coherent story. It should make it obvious why a student would pick one stack versus another for a given board or assignment.

Case study: RP2040 vs ESP32-C3 (Seeed XIAO)

The group uses Raspberry Pi RP2040 and Espressif ESP32-C3 as two common Fab-lab paths: RP2040 highlights PIO, dual-core MCU, USB device capability, and an “MCU + external flash” model without on-chip radio; ESP32-C3 adds 2.4 GHz Wi‑Fi and Bluetooth 5 LE on a single-core RISC-V for connected / low-power IoT. The thumb-sized Seeed XIAO RP2040 and XIAO ESP32C3 share a similar footprint, so they are a fair pair for a toolchain comparison.

Seeed XIAO RP2040 development board
Figure 1: Seeed XIAO RP2040 — RP2040 toolchain case study hardware.
Seeed XIAO ESP32-C3 development board
Figure 2: Seeed XIAO ESP32C3 — ESP32-C3 / wireless toolchain case study hardware.

References: Seeed Studio — XIAO series introduction (online) · offline copy in this repo: xiao-series-introduction-seeed-wiki.html.

Chip capabilities (check datasheets for your revision)

Comparison chart of multiple MCU families and features
Figure 3: Multi-MCU comparison chart — use with the table below and vendor datasheets for your silicon revision.
Topic RP2040 ESP32-C3
CPU Dual ARM Cortex-M0+, typically 133 MHz (overclocking depends on board and firmware) Single-core 32-bit RISC-V, up to about 160 MHz
On-chip SRAM 264 KB (multi-bank) About 400 KB (partitioning per Espressif datasheet)
Program storage No in-package flash; external QSPI serial flash (often 2–16 MB) In-package or on-board flash common (~4 MB class for many modules)
Wireless No built-in Wi‑Fi / Bluetooth 2.4 GHz Wi‑Fi (802.11 b/g/n) + Bluetooth 5 LE
USB USB 1.1 controller + PHY (device or host roles depend on SDK and hardware) USB serial / JTAG paths for flash and debug (exact options depend on chip revision and board)
Notable peripherals PIO (eight state machines) for custom fast I/O protocols Rich connectivity: wireless stacks, GDMA, multiple SPI / I2C / UART, PWM, ADC, etc.
ADC On-chip ADC (channels and resolution per RP2040 datasheet) 12-bit SAR ADC (available GPIO count depends on package / module)
GPIO (chip) Up to about 30 multifunction GPIO About 22 programmable GPIO (XIAO exposes a subset)
Security Typical MCU features (no integrated wireless security stack) Optional secure boot, flash encryption, hardware crypto accelerators (series / config dependent)
Typical supply Often about 1.8–5.5 V (confirm on Pico / XIAO schematic) Often 3.0–3.6 V at the module (USB 5 V via LDO)

XIAO boards break out far fewer pins than the chip maximum; routing, antenna, and USB front-end affect which GPIO and RF performance you actually get.

Toolchains and workflows (typical class paths)

Stage RP2040 (e.g. XIAO RP2040) ESP32-C3 (e.g. XIAO ESP32C3)
Official SDK Pico SDK (CMake + GCC); verify pin map and clocks for XIAO ESP-IDF (FreeRTOS components); idf.py build flash monitor
Arduino Arduino-Pico core arduino-esp32 — select ESP32-C3 board target
Scripting MicroPython / CircuitPython (mature on RP2040) MicroPython and other scripting options; many Wi‑Fi examples
Debug SWD (Pico Probe, DAPLink, etc.); printf-style trace in some setups OpenOCD + GDB, USB-JTAG paths depending on silicon and board
Flash UF2 drag-and-drop (BOOTSEL) or SWD to external flash UART download, USB flash; ESP-IDF integration
Pre-flash tooling clangd, PIO tooling ideas from Raspberry Pi docs, optional static analysis idf.py menuconfig, partition table, Wi‑Fi provisioning, log levels
Ecosystem strengths USB gadgets, LED / display drivers, PIO for odd protocols MQTT / HTTP, BLE, provisioning, OTA (with security care)

How to choose (for coursework)

  • Sensor-heavy, real-time GPIO, custom protocols, no network: RP2040 is often simpler; PIO can implement timing without saturating the CPU.
  • Cloud / phone BLE / always-on connectivity: ESP32-C3 ships wireless stacks and examples; Arduino and ESP-IDF communities are large.
  • Documentation tip: for each board, write one command sequence from new project → build → flash → serial monitor → (optional) step debug, and log one real failure (wrong COM port, boot mode, CMake toolchain version, etc.).

1. Architectures and boards

Name at least two embedded families or boards the lab actually uses (e.g. AVR, SAMD, STM32, ESP32, RP2040, RISC-V) and what each is good for in coursework.

2. Toolchain inventory per target

For each architecture, list the compiler/toolchain, flash method, debugger (if any), and default BSP or core packages.

3. Workflow comparison

Compare side by side: project creation, build, flash, serial monitor, breakpoint debugging (if supported), and common failure modes.

4. Languages and pre-deployment tools

Summarize language choices and tools used before flashing (formatting, static checks, emulation where relevant).