Skip to content

Commit

Permalink
Create a raspberry pi package
Browse files Browse the repository at this point in the history
Merge all the peripherals code to single package and 
extracted the rpi code from the sdl code
  • Loading branch information
alloncm committed Jun 16, 2023
1 parent b97a689 commit bd4987f
Show file tree
Hide file tree
Showing 62 changed files with 1,160 additions and 1,644 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Dependencies/
*.wav
*.bmp
*.img
config.txt

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
Expand All @@ -31,7 +32,6 @@ x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/

Expand Down
63 changes: 32 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ members = [
"gb",
"lib_gb",
"image_inter",
"bcm_host",
"baremetal"
"rpi",
"common"
]

[workspace.package]
Expand Down
12 changes: 12 additions & 0 deletions Cross.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

[target.armv7-unknown-linux-gnueabihf]
pre-build = [
"echo deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi >> /etc/apt/sources.list",
"touch /etc/apt/sources.list.d/raspi.list",
"echo deb http://archive.raspberrypi.org/debian/ buster main >> /etc/apt/sources.list.d/raspi.list",
"apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9165938D90FDDD2E",
"apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 82B129927FA3303E",
"dpkg --add-architecture armhf",
"apt-get update",
"apt-get install -y libraspberrypi-dev"
]
42 changes: 42 additions & 0 deletions Makefile.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[config]
default_to_workspace = false

[tasks.all]
dependencies = ["test", "sdl", "rpios", "rpi_baremetal"]

[tasks.test]
command = "cargo"
args = ["test", "--package", "lib_gb"]

[tasks.sdl]
command = "cargo"
args = ["build", "--release", "--package", "gb"]

[tasks.sdl.linux]
args = ["build", "--release", "--package", "gb", "--no-default-features"]
dependencies = ["install_sdl2_linux"]

[tasks.install_sdl2_linux]
script = ["sudo apt-get install -y libsdl2-dev"]

[tasks.rpios]
install_crate = {crate_name = "cross", binary = "cross", test_arg = "-h"}
command = "cross"
args = ["build", "--release", "--target", "armv7-unknown-linux-gnueabihf", "--bin", "rpios","--no-default-features", "--features", "std"]

[tasks.rpi_baremetal]
toolchain = "nightly"
install_crate = "cargo-binutils"
command = "rust-objcopy"
args = ["target/armv7a-none-eabihf/release/baremetal", "-O", "binary", "kernel7.img"]
dependencies = ["build_rpi_baremetal","install_llvm_tools"]

[tasks.build_rpi_baremetal]
toolchain = "nightly"
cwd = "./rpi/"
command = "cargo"
args = ["build", "--release", "--target", "armv7a-none-eabihf","--package", "rpi", "--bin", "baremetal", "-Z", "build-std=core", "--no-default-features", "--features", "rpi4"]

[tasks.install_llvm_tools]
toolchain = "nightly"
install_crate = {rustup_component_name = "llvm-tools-preview"}
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,20 @@ The main goal of this project is to be able to play Pokemon on my own emulator.

## Building

Install `cargo-make`
```sh
cargo install cargo-make
```
verify you have docker or podman installed

### Desktop

```sh
cargo make sdl
```

or with more configuration options:

```shell
cargo build --release --package gb --features [optional_features]
```
Expand Down Expand Up @@ -47,6 +59,12 @@ On by default

### Raspberry Pi Baremetal (with ili9341 display and gpio buttons)

```sh
cargo make rpi_baremetal
```

or manually:

1. Install the rust nightly toolchain for `armv7a-none-eabihf`:
```shell
rustup target add armv7a-none-eabihf --toolchain nightly
Expand Down
6 changes: 0 additions & 6 deletions baremetal/.cargo/config.toml

This file was deleted.

17 changes: 0 additions & 17 deletions baremetal/Cargo.toml

This file was deleted.

2 changes: 0 additions & 2 deletions baremetal/build.bat

This file was deleted.

5 changes: 0 additions & 5 deletions baremetal/build.rs

This file was deleted.

3 changes: 0 additions & 3 deletions baremetal/build.sh

This file was deleted.

7 changes: 0 additions & 7 deletions baremetal/config.txt

This file was deleted.

42 changes: 0 additions & 42 deletions baremetal/src/drivers/gpio_joypad.rs

This file was deleted.

Loading

0 comments on commit bd4987f

Please sign in to comment.