This repo is the main code repo for the 1FPGA Firmware and its companion libraries and binaries.
This repo is a monorepo, containing multiple crates.
The main crate is firmware
(binary named one_fpga
), which is the actual firmware for 1FPGA.
It is meant as a drop-in replacement for MiSTer.
This repo also contains the twin packages senior
and junior
, which are the client and server respectively.
They are meant to be used together to replace the MiSTer firmware into a client/server architecture to help debug and develop cores and firmware features that don't require user interface.
Basically, running junior
on the DE10-Nano, it starts a webserver and does not provide an interactive interface.
The webserver provides a full REST API to interact with the FPGA, and the senior
client can be used as a client CLI to interact with it (though not needed).
1FPGA wants to be a replacement for the MiSTer Firmware, achieving the same emulation capabilities, but with a better codebase (more maintainable) and an easier, user-focused interface.
From MiSTer's wiki:
MiSTer is an open project that aims to recreate various classic computers, game consoles and arcade machines, using modern hardware. It allows software and game images to run as they would on original hardware, using peripherals such as mice, keyboards, joysticks and other game controllers.
The MiSTer code is currently coded in legacy C and C++. It is hard to maintain, hard to build, and hard to contribute to.
1FPGA is written in easier-to-maintain (but still Open Source) Rust. The design of the application has been made from top down to enable contributions and maintenance. It is easier to read this code.
This is also an opportunity to improve the user experience greatly. For example,
Try it, get up to speed with the MiSTer project itself, and get ready to contribute when the time comes.
There are currently two parts to this repo; a Rust library that is then linked with the C++ code.
The current structure is still in flux, but essentially the rust
code is in the src
directory, while the C++ code is in the root.
C++ dependencies are located in the lib/
folder, and the support/
folder contains various code necessary to run the cores.
To build the rust
library portion of this code, you'll need to install the rust
toolchain.
The easiest way to do this is to use rustup
.
Instructions can be found here.
To build the DE10 target executable, you will also need Docker and cross
installed.
Assuming you have Docker installed, you can install cross
with the following command:
cargo install cross --git https://github.com/cross-rs/cross
Then, you can build the firmware with the following command:
cross build --bin one_fpga --target=armv7-unknown-linux-gnueabihf --no-default-features --features=platform_de10 --release
If everything goes well, this will output the executable in ./target/armv7-unknown-linux-gnueabihf/release/one_fpga
. Simply copy that binary to your device and execute it.
The following commands can help:
ssh root@$MISTER_IP 'killall MiSTer one_fpga' # Make sure MiSTer (and 1FPGA) is not running
scp ./target/armv7-unknown-linux-gnueabihf/release/one_fpga root@$MISTER_IP:/media/fat/one_fpga # Copy the binary to the device
ssh root@$MISTER_IP 'sync; /media/fat/one_fpga' # Restart the firmware
Running one_fpga --help
will show you the available CLI options.
There is a Desktop version of this (that does not support Cores), which can be ran locally in debug mode with:
cargo run --bin one_fpga
This version should help develop some features that don't require an FPGA (like menus and configs).
Tests can be run with cargo test
as you would.
This repo is not the main fork of the MiSTer firmware. If you want to contribute to MiSTer itself, please go to the MiSTer repo.
You can help a lot by testing this firmware and report bugs.
To contribute, please fork this repo, make your changes, and submit a PR. Most PRs should be approved right away, but some may require discussion.
Make sure you follow the Rust Code of Conduct when contributing. We use the Rust CoC currently because it is the most complete and well thought out CoC we could find. We might fork it locally in the future.
Thank you for understanding.