2019-08-08 09:12:17 +00:00
|
|
|
# Build instructions for Emulator (Unix port)
|
|
|
|
|
2020-11-11 13:43:09 +00:00
|
|
|
First clone, initialize submodules, install Poetry and enter the Poetry shell as
|
2020-09-25 14:21:23 +00:00
|
|
|
defined [here](index.md). **Do not forget you need to be in a `poetry shell`
|
2020-02-10 12:05:41 +00:00
|
|
|
environment!**
|
2019-08-08 09:12:17 +00:00
|
|
|
|
|
|
|
## Dependencies
|
|
|
|
|
|
|
|
Install the required packages, depending on your operating system.
|
|
|
|
|
|
|
|
* __Debian/Ubuntu__:
|
|
|
|
|
|
|
|
```sh
|
2021-05-20 09:58:09 +00:00
|
|
|
sudo apt-get install scons libsdl2-dev libsdl2-image-dev llvm-dev libclang-dev clang
|
2019-08-08 09:12:17 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
* __Fedora__:
|
|
|
|
|
|
|
|
```sh
|
2021-05-20 09:58:09 +00:00
|
|
|
sudo yum install scons SDL2-devel SDL2_image-devel clang-devel
|
2019-08-08 09:12:17 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
* __OpenSUSE__:
|
|
|
|
|
|
|
|
```sh
|
|
|
|
sudo zypper install scons libSDL2-devel libSDL2_image-devel
|
|
|
|
```
|
|
|
|
|
|
|
|
* __Arch__:
|
|
|
|
|
|
|
|
```sh
|
2021-05-20 09:58:09 +00:00
|
|
|
sudo pacman -S scons sdl2 sdl2_image clang-devel
|
2019-08-08 09:12:17 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
* __NixOS__:
|
|
|
|
|
|
|
|
There is a `shell.nix` file in the root of the project. Just run the following **before** entering the `core` directory:
|
|
|
|
|
|
|
|
```sh
|
|
|
|
nix-shell
|
|
|
|
```
|
|
|
|
|
|
|
|
* __Mac OS X__:
|
|
|
|
|
2020-07-20 08:48:22 +00:00
|
|
|
_Consider using [Nix](https://nixos.org/download.html). With Nix all you need to do is `nix-shell`._
|
|
|
|
|
|
|
|
For other users:
|
|
|
|
|
2019-08-08 09:12:17 +00:00
|
|
|
```sh
|
2021-05-20 09:58:09 +00:00
|
|
|
brew install scons sdl2 sdl2_image pkg-config llvm
|
2019-08-08 09:12:17 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
* __Windows__: not supported yet, sorry.
|
|
|
|
|
2021-05-20 09:58:09 +00:00
|
|
|
## Rust
|
|
|
|
|
2022-08-18 11:16:53 +00:00
|
|
|
You will require Rust and Cargo. The currently supported version is 1.64 nightly. The
|
|
|
|
recommended way to install both is with [`rustup`](https://rustup.rs/). Make sure you
|
|
|
|
are up to date:
|
2021-05-20 09:58:09 +00:00
|
|
|
|
|
|
|
```sh
|
2022-08-18 11:16:53 +00:00
|
|
|
rustup default nightly
|
2021-05-20 09:58:09 +00:00
|
|
|
rustup update
|
|
|
|
```
|
|
|
|
|
|
|
|
The [bindgen crate](https://rust-lang.github.io/rust-bindgen/requirements.html)
|
|
|
|
requires libclang for generating MicroPython FFI.
|
|
|
|
|
2019-08-08 09:12:17 +00:00
|
|
|
## Build
|
|
|
|
|
|
|
|
Run the build with:
|
|
|
|
|
|
|
|
```sh
|
2020-02-10 12:05:41 +00:00
|
|
|
make build_unix
|
2019-08-08 09:12:17 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Run
|
|
|
|
|
|
|
|
Now you can start the emulator:
|
|
|
|
|
|
|
|
```sh
|
2020-01-16 14:14:08 +00:00
|
|
|
./emu.py
|
2019-08-08 09:12:17 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
The emulator has a number of interesting features all documented in the [Emulator](../emulator/index.md) section.
|
|
|
|
|
|
|
|
## Building for debugging and hacking in Emulator (Unix port)
|
|
|
|
|
|
|
|
Build the debuggable unix binary so you can attach the gdb or lldb.
|
|
|
|
This removes optimizations and reduces address space randomization.
|
|
|
|
Beware that this will significantly bloat the final binary
|
|
|
|
and the firmware runtime memory limit HEAPSIZE may have to be increased.
|
|
|
|
|
|
|
|
```sh
|
|
|
|
DEBUG_BUILD=1 make build_unix
|
|
|
|
```
|