🛠 Programmer un CM3+ en C++ nu (bare metal) avec Circle

Raspberry Pi Compute Module 3+ (CM3+ / CM3+ Lite) · avance · Schéma : un module CM3+ sur carte CMIO3 avec carte SD, relié par un câble série à un PC ; à l'écran, le code C++ compilé croise le compilateur aarch64 puis s'exécute sans système d'exploitation.

Objectives

The CM3+ is one of the few consumer products on which you can write code executed without any operating system: rsta2's Circle environment (github.com/rsta2/circle repository) explicitly lists "Compute Module 3+ — Reported to work". This tutorial compiles a bare-metal C++ program for the BCM2837B0 (ARMv8-A, Cortex-A53), places it on an SD card with the Raspberry Pi firmware, and launches it — the serial console displays the output. Useful for understanding SoC initialization, register drivers, or a hard real-time product.

Hardware

Complete code

# 1. Toolchain (via ARM GNU bare-metal ou paquet distribution)
arm-none-eabi-gcc --version   # ou aarch64-none-elf-gcc --version

# 2. Récupérer Circle et compiler l'exemple « hello » (mode 64 bits AArch64)
git clone https://github.com/rsta2/circle
cd circle/sample/01-helloworld
make -j4 CIRCLE_HOME=../.. AARCH64=1

# 3. Préparer la SD : partition FAT avec kernel8.img + les fichiers firmware
cp -r ../../testlibs ../.. ; # (les binaires RPiBasic/rpiboot ne sont pas requis)
cp kernel8.img /media/$USER/boot/kernel8.img
cp ../../testlibs/../../sample/01-helloworld/kernel8.img /media/$USER/boot/ 2>/dev/null
cat > /media/$USER/boot/config.txt <<'EOF'
enable_uart=1
arm_64bit=1
kernel=kernel8.img
EOF
sync && umount /media/$USER/boot

# 4. Démarrer le CM3+ : la console série 115200 affiche le programme

Expected verification

Without Linux, the serial console displays the output of the Circle program ("Hello" message followed by an LED blinking loop if the code adds it). The program runs on bare silicon: no shell, no Linux scheduler, startup in a few hundred milliseconds. make clean && make AARCH64=1 recompiles cleanly.

Common errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials