Skip to content

Cross-Compile Skill

Cross-platform builds for ESP32 (via ESP-IDF), FreeRTOS, and Linux ARM targets.

Invoke with: /cross-compile

ESP32 Build

Prerequisites

bash
# macOS
brew install cmake ninja dfu-util python3

# Ubuntu/Debian
sudo apt-get install git wget flex bison gperf python3 python3-pip python3-venv \
    cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0

# Clone and install ESP-IDF
git clone --recursive https://github.com/espressif/esp-idf.git ~/esp/esp-idf
cd ~/esp/esp-idf && ./install.sh esp32

Build Steps

bash
# 1. Source ESP-IDF environment (each terminal session)
. ~/esp/esp-idf/export.sh

# 2. Create project directory
mkdir -p myproject/components && cd myproject

# 3. Extract Ioto into components
cd components
tar xvfz /path/to/ioto-VERSION.tgz
mv ioto-* ioto
cd ioto && bin/setup-esp32 && cd ../..

# 4. Select and build app
make APP=blink

# 5. Flash to device
idf.py -p /dev/ttyUSB0 flash

# 6. Monitor serial output
idf.py monitor

WiFi Configuration

Set WiFi credentials via sdkconfig.defaults:

CONFIG_WIFI_SSID="YourNetwork"
CONFIG_WIFI_PASSWORD="YourPassword"

TLS on ESP32

ESP32 uses MbedTLS by default:

bash
ME_COM_MBEDTLS=1 ME_COM_OPENSSL=0 make APP=http

FreeRTOS Build

bash
# 1. Clone FreeRTOS
git clone --recurse-submodules https://github.com/FreeRTOS/FreeRTOS.git

# 2. Create app directory
cd FreeRTOS/FreeRTOS/Demo && mkdir App && cd App

# 3. Extract Ioto and copy app template
tar xvfz /path/to/ioto-VERSION.tgz
mv ioto-* ioto
cp -r ioto/apps/http/freertos/* .

# 4. Build
make -C ioto APP=http
make

FreeRTOS Requirements

  • TLS stack (MbedTLS or OpenSSL)
  • Flash file system (LittleFS recommended)
  • 32-bit CPU minimum
  • 2MB RAM minimum

Linux Cross-Compilation

bash
export CC=arm-linux-gnueabihf-gcc
make CC=$CC OPTIMIZE=release

Build Variables

VariableValuesDescription
OPTIMIZEdebug, releaseOptimization level
PROFILEdev, prodConfiguration profile
ME_COM_OPENSSL0, 1Enable OpenSSL
ME_COM_MBEDTLS0, 1Enable MbedTLS
APPapp nameTarget application
SHOW1Show build commands