Go to file
2026-02-23 22:45:26 +01:00
.gitignore Basic working version generates sounds and graphics 2026-02-23 22:39:29 +01:00
boot.S Basic working version generates sounds and graphics 2026-02-23 22:39:29 +01:00
build.sh Basic working version generates sounds and graphics 2026-02-23 22:39:29 +01:00
deploy.sh Basic working version generates sounds and graphics 2026-02-23 22:39:29 +01:00
kernel.c Basic working version generates sounds and graphics 2026-02-23 22:39:29 +01:00
link.ld Basic working version generates sounds and graphics 2026-02-23 22:39:29 +01:00
Makefile Basic working version generates sounds and graphics 2026-02-23 22:39:29 +01:00
README.md Basic working version generates sounds and graphics 2026-02-23 22:39:29 +01:00
setup-dev-env.sh Basic working version generates sounds and graphics 2026-02-23 22:39:29 +01:00

Raspberry Pi 1 Bare-Metal Synthesizer

This project turns an original Raspberry Pi (Model 1 B/B+, Zero, or Zero W) into an instant-on, single-voice synthesizer that runs without any operating system (bare metal).

It boots in under two seconds and produces sound and graphics with minimal external components.

Features

  • Instant-On: Boots directly into the synth application in ~1-2 seconds.
  • Audio Output: Generates a sawtooth waveform on the 3.5mm composite audio jack.
  • Video Output: Displays a simple amplitude visualizer on the composite video output.
  • Looped Melody: Plays a pre-programmed random melody, no input required.

Requirements

Hardware

  • Raspberry Pi: Model 1 (A, B, B+), Pi Zero, or Pi Zero W. This code is for the BCM2835 SoC and will not work on Pi 2, 3, 4, or 5.
  • SD Card: A microSD or standard SD card (depending on your Pi model), 1GB is more than enough.
  • Power Supply: A standard 5V micro-USB power supply.
  • Audio Cable: A 3.5mm audio cable to connect to headphones or a speaker.

Software

  • Distrobox: Required for the automated setup script. It works on most Linux distributions and is pre-installed on systems like Fedora Silverblue/Kinoite and Bazzite.
  • The provided scripts handle all other dependencies.

This project includes scripts to automate the entire setup and deployment process.

1. Set Up the Development Environment (One-Time Setup)

The setup-dev-env.sh script creates a self-contained environment with all the necessary build tools, without altering your host operating system.

./setup-dev-env.sh

2. Build and Deploy to SD Card

Insert a FAT32-formatted SD card so that it is mounted by your system. The deploy.sh script will then build the kernel, download the necessary firmware, and interactively ask you which device to deploy to.

Run the script with sudo because it needs permission to unmount the drive when it's finished.

sudo ./deploy.sh

Follow the on-screen prompts to select your SD card. The script handles the rest.

How the Automation Works

  • setup-dev-env.sh: This script uses Distrobox to create a lightweight Ubuntu container named pi-synth-dev. Inside this container, it installs the make and gcc-arm-none-eabi toolchain required for cross-compiling. This isolates dependencies and keeps your host system clean.

  • deploy.sh: This script orchestrates the entire build and deployment process from your host machine:

    1. Builds the Kernel: It automatically enters the pi-synth-dev container to run build.sh, which compiles the source code into kernel.img.
    2. Fetches Firmware: It checks for bootcode.bin and start.elf. If they are missing, it downloads them from the official Raspberry Pi firmware repository.
    3. Finds the SD Card: It scans for mounted removable drives and presents an interactive menu for you to choose the correct SD card partition.
    4. Copies Files: It copies kernel.img, bootcode.bin, and start.elf to the selected SD card.
    5. Unmounts: It safely unmounts the SD card, making it ready for use in the Raspberry Pi.

Manual Alternative

If you prefer not to use the scripts, you can perform the steps manually.

  1. Install Toolchain: Install gcc-arm-none-eabi and make on your system.
  2. Get Firmware: Download bootcode.bin and start.elf from the official Raspberry Pi firmware repository.
  3. Build: Run make to compile kernel.img.
  4. Deploy: Copy kernel.img, bootcode.bin, and start.elf to the root of a FAT32-formatted SD card.

Hardware Connections

  1. SD Card: Insert the prepared SD card into your Raspberry Pi.
  2. Audio: Connect headphones or a speaker to the 3.5mm audio jack.
  3. Video (Optional): Connect a composite video cable from the RCA jack (on Model B) or the 3.5mm jack (on later models) to a compatible display.
  4. Power: Connect the 5V micro-USB power supply. The Pi will boot immediately.

Usage

Once powered on, the synthesizer will automatically start playing a random melody loop. The composite video output will show a simple red bar that visualizes the audio amplitude.

There is no user input required for this version of the code.


This project is for educational purposes and demonstrates low-level hardware control on the BCM2835 SoC.