Files
main-website/docs/build-guide.md
T
2026-06-15 19:20:24 +02:00

2.5 KiB

Build Guide

Detailed build instructions for ReviveSparc across different platforms and configurations.

Directory Structure

revivesparc/
  emu/           -- Functional instruction-set simulator (C)
  rtl/           -- Verilog RTL for synthesis
  soft/          -- Firmware and boot ROM code
  tests/         -- ISA verification test suite
  tools/         -- Helper scripts and utilities
  docs/          -- Additional documentation
  Makefile       -- Top-level build file
  CMakeLists.txt -- CMake build configuration

Build System

ReviveSparc supports two build systems: Make (simple) and CMake (advanced).

Make (Default)

make

CMake

mkdir build && cd build
cmake ..
make -j$(nproc)

CMake offers more granular control:

cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_TRACE=ON

Platform-Specific Notes

Linux (x86_64)

Standard build with GCC:

sudo apt install build-essential cmake git
git clone https://github.com/revivesparc/revivesparc.git
cd revivesparc
make

Linux (aarch64)

sudo apt install build-essential cmake git
make

No additional steps required.

macOS (Apple Silicon)

Install dependencies via Homebrew:

brew install cmake make gcc
make CC=gcc-14

macOS (Intel)

brew install cmake make
make

Cross-Compilation

To build for a different target architecture:

make CROSS=aarch64-linux-gnu-

This is useful for embedded ReviveSparc deployments.

Building the RTL

The Verilog RTL requires Verilator or Icarus Verilog for simulation:

make rtl

For synthesis, see the RTL Synthesis Guide.

Building the Toolchain

ReviveSparc includes scripts to build a complete SPARC cross-toolchain:

cd tools
./build-toolchain.sh

This builds sparc-elf-gcc, sparc-linux-gcc, and associated binutils. The toolchain is installed to tools/toolchain/.

Common Build Issues

"No such file or directory" for standard headers

Install libc development headers:

# Debian/Ubuntu
sudo apt install libc6-dev

# Fedora
sudo dnf install glibc-devel

# macOS
# Headers are included with Xcode Command Line Tools

"cc1: error: unrecognized command-line option"

You may be using an older GCC. ReviveSparc requires GCC 8+ or Clang 10+.

"undefined reference to `clock_gettime'"

Link with librt on older glibc versions:

make LDFLAGS=-lrt

Cleaning the Build

make clean     # Remove build artifacts
make distclean # Also remove generated files