Basic working version generates sounds and graphics

This commit is contained in:
Dejvino
2026-02-23 22:39:29 +01:00
parent 6459fe2f02
commit 8a3abafd84
10 changed files with 572 additions and 47 deletions
+27 -47
View File
@@ -22,70 +22,50 @@ It boots in under two seconds and produces sound and graphics with minimal exter
### Software
- **ARM Cross-Compiler**: The `arm-none-eabi-gcc` toolchain is required to build the kernel.
- **Raspberry Pi Firmware**: You need the `bootcode.bin` and `start.elf` files from the official Raspberry Pi firmware repository.
- **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.
## Quick Start with Scripts
## Quick Start (Recommended)
For a fast and easy setup, you can use the provided automation scripts.
This project includes scripts to automate the entire setup and deployment process.
1. **Build the kernel**:
```sh
./build.sh
```
This will compile the C and Assembly code and create the `kernel.img` file.
### 1. Set Up the Development Environment (One-Time Setup)
2. **Deploy to SD Card**:
Insert your FAT32-formatted SD card. Find its device name (e.g., `/dev/sdX` or `/dev/mmcblkX`) and mount point.
```sh
# Example: ./deploy.sh /media/user/RASPIBOOT
./deploy.sh <path_to_sd_card_mount_point>
```
This script copies `kernel.img`, `bootcode.bin`, and `start.elf` to the SD card and then safely unmounts it.
## Manual Setup and Deployment
### 1. Install Toolchain
On Debian/Ubuntu-based systems, you can install the cross-compiler with:
The `setup-dev-env.sh` script creates a self-contained environment with all the necessary build tools, without altering your host operating system.
```sh
sudo apt-get update
sudo apt-get install gcc-arm-none-eabi binutils-arm-none-eabi
./setup-dev-env.sh
```
### 2. Get Raspberry Pi Firmware
### 2. Build and Deploy to SD Card
The Pi's GPU first loads firmware from the SD card before handing control to the ARM core. You need two files:
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.
- `bootcode.bin`: The second-stage bootloader.
- `start.elf`: The GPU firmware.
You can download them from the official Raspberry Pi firmware repository. Make sure to grab the files from the `boot` directory. For this project, you only need these two files.
Place them in the root of this project directory so the `deploy.sh` script can find them.
### 3. Build the Kernel
With the toolchain installed, compile the synthesizer by running `make`:
Run the script with `sudo` because it needs permission to unmount the drive when it's finished.
```sh
make
sudo ./deploy.sh
```
This command uses the `Makefile` to compile `boot.S` and `kernel.c`, linking them into a final binary image named `kernel.img`.
Follow the on-screen prompts to select your SD card. The script handles the rest.
### 4. Prepare the SD Card
## How the Automation Works
Your SD card must be formatted with a **FAT32** filesystem. Most new SD cards are already formatted this way. The partition should also have the "boot" or "lba" flag set, which is standard for bootable Raspberry Pi cards.
- **`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.
### 5. Deploy to SD Card
- **`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.
Mount the SD card and copy the three essential files to its root directory:
## Manual Alternative
- `bootcode.bin` (from the firmware repo)
- `start.elf` (from the firmware repo)
- `kernel.img` (generated by the `make` command)
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.
After copying, unmount the SD card safely.
## Hardware Connections