Skip to content

Week 04: Embedded Programming

Demonstration and Comparison of Embedded Development Toolchains

On the 4th of ou week, this section demonstrates and compares the development workflows used for programming embedded microcontrollers. Different embedded architectures use different toolchains, programming environments, debugging tools, and communication methods as follow.

The goal of this exercise is to understand how software is developed, compiled, uploaded, and debugged in embedded systems.

Starting with the ebedded concept with Local instructor, Rico

alt text

Embedded Architectures Tested

The following architectures and development environments were explored:

Architecture Microcontroller Toolchain
AVR ATmega328 / ATtiny Arduino IDE / AVR-GCC
ARM SAMD21 / Cortex-M Arduino IDE / PlatformIO
RISC-V ESP32-C3 ESP-IDF / Arduino
Simulation ESP32 Wokwi Simulator

1. AVR Architecture Workflow (ATmega / ATtiny)

Toolchain

  • Arduino IDE our focus
  • AVR-GCC compiler
  • avrdude uploader

Installation Steps

Step 1 — Install Arduino IDE

Go to https://www.arduino.cc/en/software

Download Arduino IDE for your OS.

Install the program.

Launch Arduino IDE.

Step 2 — Install Board Manager

Open Arduino IDE

Navigate to Search for Tools → Board → Boards Manager

alt text

Arduino AVR Boards

Click Install

Step 3 — Connect the Board

Connect Arduino board using USB cable

Select board

Tools → Board → Arduino Uno

Select port

Tools → Port → COMx

Programming

Example Code

void setup() {
  pinMode(13, OUTPUT);
}

void loop() {
  digitalWrite(13, HIGH);
  delay(1000);
  digitalWrite(13, LOW);
  delay(1000);
}

Upload Program

Click Upload in the Arduino IDE to upload the program to the microcontroller.

Workflow

Code → Compile → Upload → Run


Debugging

AVR debugging options:

Method Description
Serial Monitor Print debug messages
LED Indicators Simple hardware debugging
AVR Debugger Hardware debugging tool

Example Debugging Code

Serial.begin(9600);
Serial.println("System started");

Open the Serial Monitor from:

Tools → Serial Monitor

Method Description
UART Serial communication
SPI High-speed peripheral communication
I2C Sensor communication
USB Programming and serial communication

Communication Protocols

Protocol Use
UART Serial communication
SPI Sensors and displays
I2C Sensor networks
CAN Industrial communication
USB Data and programming

alt text alt text