Concept
The overall structure of the product, including Business & Use Cases as well as the High-Level Architecture.
Goal
Create a setup for the XIAO Seeed RP2040 able to run the UART, the ADC, the PWM, the Interrupts and the Timer on Renode over PlatformIO.
Business & Use Cases
Business Cases
- Rapid Prototyping: Enable developers to test firmware for the XIAO Seeed RP2040 without needing physical hardware, reducing hardware costs and setup time.
- Continuous Integration: Provide a simulated environment for automated testing of peripheral drivers and application logic in CI/CD pipelines.
Use Cases
- Firmware Development: A developer writes code for XIAO Seeed RP2040 peripherals (UART, ADC, PWM, Interrupts, Timer) and wants to verify the logic in a simulated environment.
- Automated Regression Testing: Every commit to the firmware repository triggers a build and a simulation run in Renode to ensure no regressions in peripheral handling.
High-Level Architecture
The system consists of three main components: 1. Development Environment (PlatformIO): Handles firmware compilation, dependency management, and target configuration for the RP2040. 2. Simulation Engine (Renode): Emulates the RP2040 SoC and board-level peripherals. 3. Verification Layer (Robot Framework): Orchestrates tests by interacting with Renode's monitor and simulated UART to verify functional correctness.
Functional Components
- UART Interface: For serial communication simulation and console output.
- ADC (Analog-to-Digital Converter): For simulating sensor inputs and analog signal processing.
- PWM (Pulse Width Modulation): For simulating motor control, LED dimming, or other timed outputs.
- Interrupts: For handling asynchronous events and hardware signals.
- Timer: For precise timing, delays, and periodic event execution.
- PIO (Programmable I/O): For simulating high-speed, custom I/O protocols and hardware-offloaded timing logic.
Major Choices & Alternatives
Choice 1: Emulation Framework
- Option A: Renode (Selected) - Highly flexible, supports RP2040, easy to integrate with CI.
Choice 2: Build System
- Option A: PlatformIO (Selected) - Industry standard for embedded development, excellent package management.
Discarded Alternatives
- Choice 1: Option B: QEMU - Limited RP2040 support compared to Renode.
- Choice 1: Option C: Wokwi - Excellent for web/UI, but harder to integrate into local CLI-based CI/CD workflows for some use cases.
- Choice 2: Option B: CMake (Pico SDK) - Native for RP2040, but requires more manual configuration for library management.
- Choice 2: Option C: Arduino IDE - Not suitable for professional CI/CD and complex project structures.