Embedded Programming

Week 04

  • Demonstrate and compare the toolchains and development workflows for available embedded architectures
  • Document your work to the group work page and reflect on your individual page what you learned

Overview of Architectures

This week, the team explored and compared various embedded architectures, ranging from minimal 8-bit microcontrollers requiring dedicated programmers to modern 32-bit ARM processors with native USB and high-level language support.


ATtiny45 (ISP Protocol)

  • Toolchain
    C Code -> Compiler (avr-gcc) -> ELF Executable -> ObjCopy -> HEX -> avrdude -> Microcontroller.
  • Workflow
    Flashing requires a dedicated programmer, such as the Atmel-ICE. The process involves pulling the reset pin to 0V/GND to halt the CPU. The programmer then pulses the clock pin and sends raw assembly bytes to the MOSI pin. The PC compiles the C code to binary and writes it to flash memory in sync with the clock cycle. Finally, releasing the reset pin allows the new code to execute.

ATtiny412 (UPDI Protocol)

  • Toolchain
    C++ Code -> Arduino IDE (Compile) -> SerialUPDI (Upload) -> Chip
  • Workflow
    By bridging the RX and TX lines of an FTDI cable with a 4.7k Ohm resistor, the device enters a write mode where instructions are sent via TX and confirmed via RX. Code is compiled using avr-gcc and avr-objcopy, and flashed using pymcuprog over UART. To read serial data, the resistor is removed, and the ATtiny's PA6 pin is connected directly to the FTDI's RX line to listen via a python serial terminal.

RP2040 (UF2 Bootloader)

  • Toolchain
    CircuitPython Firmware (.uf2) -> UF2 Bootloader (USB Mass Storage) -> Python Code (code.py) -> Text Editor (Save) -> Auto-Reload/Execution -> Chip
  • Workflow
    CircuitPython turns the microcontroller into a USB drive that runs Python code on the fly. By dropping a .uf2 file onto the drive, the board reboots and mounts with a filesystem. Students can copy required library files (e.g., adafruit_ssd1306.mpy) into the lib folder and directly edit the code.py file. Saving the file automatically reloads and executes the new code instantly, vastly speeding up the development process.