From 6119cf88b1591f58a5c5ed28870f23429ae8861b Mon Sep 17 00:00:00 2001 From: Andre Richter Date: Tue, 29 Oct 2019 22:32:49 +0100 Subject: [PATCH] Actions: Add RPi4 build --- .github/workflows/build_rpi3.yml | 6 +-- .github/workflows/build_rpi4.yml | 40 ++++++++++++++++ .github/workflows/check_fmt.yml | 2 +- 01_wait_forever/Cargo.toml | 1 + 01_wait_forever/Makefile | 13 +++++ 01_wait_forever/src/arch.rs | 4 +- 01_wait_forever/src/bsp.rs | 4 +- 02_runtime_init/Cargo.toml | 1 + 02_runtime_init/Makefile | 13 +++++ 02_runtime_init/README.md | 4 +- 02_runtime_init/src/arch.rs | 4 +- 02_runtime_init/src/bsp.rs | 4 +- 03_hacky_hello_world/Cargo.toml | 1 + 03_hacky_hello_world/Makefile | 13 +++++ 03_hacky_hello_world/README.md | 9 ++++ 03_hacky_hello_world/src/arch.rs | 4 +- 03_hacky_hello_world/src/bsp.rs | 4 +- 04_zero_overhead_abstraction/Cargo.toml | 1 + 04_zero_overhead_abstraction/Makefile | 13 +++++ 04_zero_overhead_abstraction/README.md | 4 +- 04_zero_overhead_abstraction/src/arch.rs | 4 +- 04_zero_overhead_abstraction/src/bsp.rs | 4 +- 05_safe_globals/Cargo.toml | 1 + 05_safe_globals/Makefile | 13 +++++ 05_safe_globals/src/arch.rs | 4 +- 05_safe_globals/src/bsp.rs | 4 +- 06_drivers_gpio_uart/README.md | 60 ++---------------------- utils/make_all.rb | 6 +-- 28 files changed, 155 insertions(+), 86 deletions(-) create mode 100644 .github/workflows/build_rpi4.yml diff --git a/.github/workflows/build_rpi3.yml b/.github/workflows/build_rpi3.yml index 9c10123e..08c96d9e 100644 --- a/.github/workflows/build_rpi3.yml +++ b/.github/workflows/build_rpi3.yml @@ -1,4 +1,4 @@ -name: Build RPi3 +name: BSP-RPi3 on: push: @@ -20,7 +20,7 @@ on: jobs: build: - name: Build RPi3 kernels + name: Build kernels runs-on: ubuntu-18.04 steps: @@ -37,4 +37,4 @@ jobs: cargo install cargo-xbuild cargo-binutils - name: Make all run: | - ruby utils/make_all.rb + ruby utils/make_all.rb rpi3 diff --git a/.github/workflows/build_rpi4.yml b/.github/workflows/build_rpi4.yml new file mode 100644 index 00000000..6d23070b --- /dev/null +++ b/.github/workflows/build_rpi4.yml @@ -0,0 +1,40 @@ +name: BSP-RPi4 + +on: + push: + branches: + - master + paths-ignore: + - 'utils/**' + - 'doc/**' + - 'docker/**' + pull_request: + branches: + - master + paths-ignore: + - 'utils/**' + - 'doc/**' + - 'docker/**' + schedule: + - cron: '0 5 * * *' + +jobs: + build: + name: Build kernels + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v1 + - name: Set up Ruby 2.x + uses: actions/setup-ruby@v1 + with: + ruby-version: 2.x + - name: Set up Rust nightly + run: | + rustup self update + rustup toolchain install nightly --component rust-src llvm-tools-preview + rustup default nightly + cargo install cargo-xbuild cargo-binutils + - name: Make all + run: | + ruby utils/make_all.rb rpi4 diff --git a/.github/workflows/check_fmt.yml b/.github/workflows/check_fmt.yml index 15451b74..6834dc2b 100644 --- a/.github/workflows/check_fmt.yml +++ b/.github/workflows/check_fmt.yml @@ -32,6 +32,6 @@ jobs: rustup self update rustup toolchain install nightly --component rustfmt rustup default nightly - - name: Make all + - name: Run cargo fmt run: | ruby utils/fmt_all.rb --check diff --git a/01_wait_forever/Cargo.toml b/01_wait_forever/Cargo.toml index c0949451..6d320b6e 100644 --- a/01_wait_forever/Cargo.toml +++ b/01_wait_forever/Cargo.toml @@ -11,6 +11,7 @@ sysroot_path = "../xbuild_sysroot" [features] default = [] bsp_rpi3 = [] +bsp_rpi4 = [] [dependencies] diff --git a/01_wait_forever/Makefile b/01_wait_forever/Makefile index ec59366e..2b36070a 100644 --- a/01_wait_forever/Makefile +++ b/01_wait_forever/Makefile @@ -16,6 +16,14 @@ ifeq ($(BSP),rpi3) QEMU_MISC_ARGS = -d in_asm LINKER_FILE = src/bsp/rpi/link.ld RUSTC_MISC_ARGS = -C target-cpu=cortex-a53 +else ifeq ($(BSP),rpi4) + TARGET = aarch64-unknown-none-softfloat + OUTPUT = kernel8.img +# QEMU_BINARY = qemu-system-aarch64 +# QEMU_MACHINE_TYPE = +# QEMU_MISC_ARGS = -d in_asm + LINKER_FILE = src/bsp/rpi/link.ld + RUSTC_MISC_ARGS = -C target-cpu=cortex-a72 endif SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) $(wildcard **/*.ld) @@ -56,9 +64,14 @@ doc: cargo xdoc --target=$(TARGET) --features bsp_$(BSP) --document-private-items xdg-open target/$(TARGET)/doc/kernel/index.html +ifeq ($(QEMU_MACHINE_TYPE),) +qemu: + @echo "This board is not yet supported for QEMU." +else qemu: all $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(CONTAINER_UTILS) \ $(DOCKER_EXEC_QEMU) $(QEMU_MISC_ARGS) +endif clippy: cargo xclippy --target=$(TARGET) --features bsp_$(BSP) diff --git a/01_wait_forever/src/arch.rs b/01_wait_forever/src/arch.rs index 421e377f..b1f035c5 100644 --- a/01_wait_forever/src/arch.rs +++ b/01_wait_forever/src/arch.rs @@ -4,8 +4,8 @@ //! Conditional exporting of processor architecture code. -#[cfg(feature = "bsp_rpi3")] +#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))] mod aarch64; -#[cfg(feature = "bsp_rpi3")] +#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))] pub use aarch64::*; diff --git a/01_wait_forever/src/bsp.rs b/01_wait_forever/src/bsp.rs index 127f99db..73d115c5 100644 --- a/01_wait_forever/src/bsp.rs +++ b/01_wait_forever/src/bsp.rs @@ -4,8 +4,8 @@ //! Conditional exporting of Board Support Packages. -#[cfg(feature = "bsp_rpi3")] +#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))] mod rpi; -#[cfg(feature = "bsp_rpi3")] +#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))] pub use rpi::*; diff --git a/02_runtime_init/Cargo.toml b/02_runtime_init/Cargo.toml index da487f1a..aaabf7c5 100644 --- a/02_runtime_init/Cargo.toml +++ b/02_runtime_init/Cargo.toml @@ -11,6 +11,7 @@ sysroot_path = "../xbuild_sysroot" [features] default = [] bsp_rpi3 = [] +bsp_rpi4 = [] [dependencies] r0 = "0.2.*" diff --git a/02_runtime_init/Makefile b/02_runtime_init/Makefile index ec59366e..2b36070a 100644 --- a/02_runtime_init/Makefile +++ b/02_runtime_init/Makefile @@ -16,6 +16,14 @@ ifeq ($(BSP),rpi3) QEMU_MISC_ARGS = -d in_asm LINKER_FILE = src/bsp/rpi/link.ld RUSTC_MISC_ARGS = -C target-cpu=cortex-a53 +else ifeq ($(BSP),rpi4) + TARGET = aarch64-unknown-none-softfloat + OUTPUT = kernel8.img +# QEMU_BINARY = qemu-system-aarch64 +# QEMU_MACHINE_TYPE = +# QEMU_MISC_ARGS = -d in_asm + LINKER_FILE = src/bsp/rpi/link.ld + RUSTC_MISC_ARGS = -C target-cpu=cortex-a72 endif SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) $(wildcard **/*.ld) @@ -56,9 +64,14 @@ doc: cargo xdoc --target=$(TARGET) --features bsp_$(BSP) --document-private-items xdg-open target/$(TARGET)/doc/kernel/index.html +ifeq ($(QEMU_MACHINE_TYPE),) +qemu: + @echo "This board is not yet supported for QEMU." +else qemu: all $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(CONTAINER_UTILS) \ $(DOCKER_EXEC_QEMU) $(QEMU_MISC_ARGS) +endif clippy: cargo xclippy --target=$(TARGET) --features bsp_$(BSP) diff --git a/02_runtime_init/README.md b/02_runtime_init/README.md index fddae8f8..c47516c7 100644 --- a/02_runtime_init/README.md +++ b/02_runtime_init/README.md @@ -22,8 +22,8 @@ Check out `make qemu` again to see the additional code run. diff -uNr 01_wait_forever/Cargo.toml 02_runtime_init/Cargo.toml --- 01_wait_forever/Cargo.toml +++ 02_runtime_init/Cargo.toml -@@ -13,4 +13,4 @@ - bsp_rpi3 = [] +@@ -14,4 +14,4 @@ + bsp_rpi4 = [] [dependencies] - diff --git a/02_runtime_init/src/arch.rs b/02_runtime_init/src/arch.rs index 421e377f..b1f035c5 100644 --- a/02_runtime_init/src/arch.rs +++ b/02_runtime_init/src/arch.rs @@ -4,8 +4,8 @@ //! Conditional exporting of processor architecture code. -#[cfg(feature = "bsp_rpi3")] +#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))] mod aarch64; -#[cfg(feature = "bsp_rpi3")] +#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))] pub use aarch64::*; diff --git a/02_runtime_init/src/bsp.rs b/02_runtime_init/src/bsp.rs index 127f99db..73d115c5 100644 --- a/02_runtime_init/src/bsp.rs +++ b/02_runtime_init/src/bsp.rs @@ -4,8 +4,8 @@ //! Conditional exporting of Board Support Packages. -#[cfg(feature = "bsp_rpi3")] +#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))] mod rpi; -#[cfg(feature = "bsp_rpi3")] +#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))] pub use rpi::*; diff --git a/03_hacky_hello_world/Cargo.toml b/03_hacky_hello_world/Cargo.toml index da487f1a..aaabf7c5 100644 --- a/03_hacky_hello_world/Cargo.toml +++ b/03_hacky_hello_world/Cargo.toml @@ -11,6 +11,7 @@ sysroot_path = "../xbuild_sysroot" [features] default = [] bsp_rpi3 = [] +bsp_rpi4 = [] [dependencies] r0 = "0.2.*" diff --git a/03_hacky_hello_world/Makefile b/03_hacky_hello_world/Makefile index e80eb9d3..6ba564ab 100644 --- a/03_hacky_hello_world/Makefile +++ b/03_hacky_hello_world/Makefile @@ -16,6 +16,14 @@ ifeq ($(BSP),rpi3) QEMU_MISC_ARGS = -serial stdio LINKER_FILE = src/bsp/rpi/link.ld RUSTC_MISC_ARGS = -C target-cpu=cortex-a53 +else ifeq ($(BSP),rpi4) + TARGET = aarch64-unknown-none-softfloat + OUTPUT = kernel8.img +# QEMU_BINARY = qemu-system-aarch64 +# QEMU_MACHINE_TYPE = +# QEMU_MISC_ARGS = -serial stdio + LINKER_FILE = src/bsp/rpi/link.ld + RUSTC_MISC_ARGS = -C target-cpu=cortex-a72 endif SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) $(wildcard **/*.ld) @@ -56,9 +64,14 @@ doc: cargo xdoc --target=$(TARGET) --features bsp_$(BSP) --document-private-items xdg-open target/$(TARGET)/doc/kernel/index.html +ifeq ($(QEMU_MACHINE_TYPE),) +qemu: + @echo "This board is not yet supported for QEMU." +else qemu: all $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(CONTAINER_UTILS) \ $(DOCKER_EXEC_QEMU) $(QEMU_MISC_ARGS) +endif clippy: cargo xclippy --target=$(TARGET) --features bsp_$(BSP) diff --git a/03_hacky_hello_world/README.md b/03_hacky_hello_world/README.md index c6b173b0..c8cfa808 100644 --- a/03_hacky_hello_world/README.md +++ b/03_hacky_hello_world/README.md @@ -37,6 +37,15 @@ diff -uNr 02_runtime_init/Makefile 03_hacky_hello_world/Makefile + QEMU_MISC_ARGS = -serial stdio LINKER_FILE = src/bsp/rpi/link.ld RUSTC_MISC_ARGS = -C target-cpu=cortex-a53 + else ifeq ($(BSP),rpi4) +@@ -21,7 +21,7 @@ + OUTPUT = kernel8.img + # QEMU_BINARY = qemu-system-aarch64 + # QEMU_MACHINE_TYPE = +-# QEMU_MISC_ARGS = -d in_asm ++# QEMU_MISC_ARGS = -serial stdio + LINKER_FILE = src/bsp/rpi/link.ld + RUSTC_MISC_ARGS = -C target-cpu=cortex-a72 endif diff -uNr 02_runtime_init/src/bsp/rpi.rs 03_hacky_hello_world/src/bsp/rpi.rs diff --git a/03_hacky_hello_world/src/arch.rs b/03_hacky_hello_world/src/arch.rs index 421e377f..b1f035c5 100644 --- a/03_hacky_hello_world/src/arch.rs +++ b/03_hacky_hello_world/src/arch.rs @@ -4,8 +4,8 @@ //! Conditional exporting of processor architecture code. -#[cfg(feature = "bsp_rpi3")] +#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))] mod aarch64; -#[cfg(feature = "bsp_rpi3")] +#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))] pub use aarch64::*; diff --git a/03_hacky_hello_world/src/bsp.rs b/03_hacky_hello_world/src/bsp.rs index 127f99db..73d115c5 100644 --- a/03_hacky_hello_world/src/bsp.rs +++ b/03_hacky_hello_world/src/bsp.rs @@ -4,8 +4,8 @@ //! Conditional exporting of Board Support Packages. -#[cfg(feature = "bsp_rpi3")] +#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))] mod rpi; -#[cfg(feature = "bsp_rpi3")] +#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))] pub use rpi::*; diff --git a/04_zero_overhead_abstraction/Cargo.toml b/04_zero_overhead_abstraction/Cargo.toml index a0734bd3..fbdd786b 100644 --- a/04_zero_overhead_abstraction/Cargo.toml +++ b/04_zero_overhead_abstraction/Cargo.toml @@ -11,6 +11,7 @@ sysroot_path = "../xbuild_sysroot" [features] default = [] bsp_rpi3 = ["cortex-a"] +bsp_rpi4 = ["cortex-a"] [dependencies] r0 = "0.2.*" diff --git a/04_zero_overhead_abstraction/Makefile b/04_zero_overhead_abstraction/Makefile index e80eb9d3..6ba564ab 100644 --- a/04_zero_overhead_abstraction/Makefile +++ b/04_zero_overhead_abstraction/Makefile @@ -16,6 +16,14 @@ ifeq ($(BSP),rpi3) QEMU_MISC_ARGS = -serial stdio LINKER_FILE = src/bsp/rpi/link.ld RUSTC_MISC_ARGS = -C target-cpu=cortex-a53 +else ifeq ($(BSP),rpi4) + TARGET = aarch64-unknown-none-softfloat + OUTPUT = kernel8.img +# QEMU_BINARY = qemu-system-aarch64 +# QEMU_MACHINE_TYPE = +# QEMU_MISC_ARGS = -serial stdio + LINKER_FILE = src/bsp/rpi/link.ld + RUSTC_MISC_ARGS = -C target-cpu=cortex-a72 endif SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) $(wildcard **/*.ld) @@ -56,9 +64,14 @@ doc: cargo xdoc --target=$(TARGET) --features bsp_$(BSP) --document-private-items xdg-open target/$(TARGET)/doc/kernel/index.html +ifeq ($(QEMU_MACHINE_TYPE),) +qemu: + @echo "This board is not yet supported for QEMU." +else qemu: all $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(CONTAINER_UTILS) \ $(DOCKER_EXEC_QEMU) $(QEMU_MISC_ARGS) +endif clippy: cargo xclippy --target=$(TARGET) --features bsp_$(BSP) diff --git a/04_zero_overhead_abstraction/README.md b/04_zero_overhead_abstraction/README.md index 985756b9..742a71a5 100644 --- a/04_zero_overhead_abstraction/README.md +++ b/04_zero_overhead_abstraction/README.md @@ -13,12 +13,14 @@ which provides zero-overhead abstractions and wraps the `unsafe` parts. diff -uNr 03_hacky_hello_world/Cargo.toml 04_zero_overhead_abstraction/Cargo.toml --- 03_hacky_hello_world/Cargo.toml +++ 04_zero_overhead_abstraction/Cargo.toml -@@ -10,7 +10,10 @@ +@@ -10,8 +10,11 @@ # The features section is used to select the target board. [features] default = [] -bsp_rpi3 = [] +-bsp_rpi4 = [] +bsp_rpi3 = ["cortex-a"] ++bsp_rpi4 = ["cortex-a"] [dependencies] r0 = "0.2.*" diff --git a/04_zero_overhead_abstraction/src/arch.rs b/04_zero_overhead_abstraction/src/arch.rs index 421e377f..b1f035c5 100644 --- a/04_zero_overhead_abstraction/src/arch.rs +++ b/04_zero_overhead_abstraction/src/arch.rs @@ -4,8 +4,8 @@ //! Conditional exporting of processor architecture code. -#[cfg(feature = "bsp_rpi3")] +#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))] mod aarch64; -#[cfg(feature = "bsp_rpi3")] +#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))] pub use aarch64::*; diff --git a/04_zero_overhead_abstraction/src/bsp.rs b/04_zero_overhead_abstraction/src/bsp.rs index 127f99db..73d115c5 100644 --- a/04_zero_overhead_abstraction/src/bsp.rs +++ b/04_zero_overhead_abstraction/src/bsp.rs @@ -4,8 +4,8 @@ //! Conditional exporting of Board Support Packages. -#[cfg(feature = "bsp_rpi3")] +#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))] mod rpi; -#[cfg(feature = "bsp_rpi3")] +#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))] pub use rpi::*; diff --git a/05_safe_globals/Cargo.toml b/05_safe_globals/Cargo.toml index a0734bd3..fbdd786b 100644 --- a/05_safe_globals/Cargo.toml +++ b/05_safe_globals/Cargo.toml @@ -11,6 +11,7 @@ sysroot_path = "../xbuild_sysroot" [features] default = [] bsp_rpi3 = ["cortex-a"] +bsp_rpi4 = ["cortex-a"] [dependencies] r0 = "0.2.*" diff --git a/05_safe_globals/Makefile b/05_safe_globals/Makefile index e80eb9d3..6ba564ab 100644 --- a/05_safe_globals/Makefile +++ b/05_safe_globals/Makefile @@ -16,6 +16,14 @@ ifeq ($(BSP),rpi3) QEMU_MISC_ARGS = -serial stdio LINKER_FILE = src/bsp/rpi/link.ld RUSTC_MISC_ARGS = -C target-cpu=cortex-a53 +else ifeq ($(BSP),rpi4) + TARGET = aarch64-unknown-none-softfloat + OUTPUT = kernel8.img +# QEMU_BINARY = qemu-system-aarch64 +# QEMU_MACHINE_TYPE = +# QEMU_MISC_ARGS = -serial stdio + LINKER_FILE = src/bsp/rpi/link.ld + RUSTC_MISC_ARGS = -C target-cpu=cortex-a72 endif SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) $(wildcard **/*.ld) @@ -56,9 +64,14 @@ doc: cargo xdoc --target=$(TARGET) --features bsp_$(BSP) --document-private-items xdg-open target/$(TARGET)/doc/kernel/index.html +ifeq ($(QEMU_MACHINE_TYPE),) +qemu: + @echo "This board is not yet supported for QEMU." +else qemu: all $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(CONTAINER_UTILS) \ $(DOCKER_EXEC_QEMU) $(QEMU_MISC_ARGS) +endif clippy: cargo xclippy --target=$(TARGET) --features bsp_$(BSP) diff --git a/05_safe_globals/src/arch.rs b/05_safe_globals/src/arch.rs index 421e377f..b1f035c5 100644 --- a/05_safe_globals/src/arch.rs +++ b/05_safe_globals/src/arch.rs @@ -4,8 +4,8 @@ //! Conditional exporting of processor architecture code. -#[cfg(feature = "bsp_rpi3")] +#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))] mod aarch64; -#[cfg(feature = "bsp_rpi3")] +#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))] pub use aarch64::*; diff --git a/05_safe_globals/src/bsp.rs b/05_safe_globals/src/bsp.rs index 127f99db..73d115c5 100644 --- a/05_safe_globals/src/bsp.rs +++ b/05_safe_globals/src/bsp.rs @@ -4,8 +4,8 @@ //! Conditional exporting of Board Support Packages. -#[cfg(feature = "bsp_rpi3")] +#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))] mod rpi; -#[cfg(feature = "bsp_rpi3")] +#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))] pub use rpi::*; diff --git a/06_drivers_gpio_uart/README.md b/06_drivers_gpio_uart/README.md index 8dd32f70..fc5fa487 100644 --- a/06_drivers_gpio_uart/README.md +++ b/06_drivers_gpio_uart/README.md @@ -80,11 +80,12 @@ sudo screen /dev/ttyUSB0 115200 diff -uNr 05_safe_globals/Cargo.toml 06_drivers_gpio_uart/Cargo.toml --- 05_safe_globals/Cargo.toml +++ 06_drivers_gpio_uart/Cargo.toml -@@ -10,10 +10,12 @@ +@@ -10,11 +10,12 @@ # The features section is used to select the target board. [features] default = [] -bsp_rpi3 = ["cortex-a"] +-bsp_rpi4 = ["cortex-a"] +bsp_rpi3 = ["cortex-a", "register"] +bsp_rpi4 = ["cortex-a", "register"] @@ -95,40 +96,6 @@ diff -uNr 05_safe_globals/Cargo.toml 06_drivers_gpio_uart/Cargo.toml cortex-a = { version = "2.*", optional = true } +register = { version = "0.3.*", optional = true } -diff -uNr 05_safe_globals/Makefile 06_drivers_gpio_uart/Makefile ---- 05_safe_globals/Makefile -+++ 06_drivers_gpio_uart/Makefile -@@ -16,6 +16,14 @@ - QEMU_MISC_ARGS = -serial stdio - LINKER_FILE = src/bsp/rpi/link.ld - RUSTC_MISC_ARGS = -C target-cpu=cortex-a53 -+else ifeq ($(BSP),rpi4) -+ TARGET = aarch64-unknown-none-softfloat -+ OUTPUT = kernel8.img -+# QEMU_BINARY = qemu-system-aarch64 -+# QEMU_MACHINE_TYPE = -+# QEMU_MISC_ARGS = -serial stdio -+ LINKER_FILE = src/bsp/rpi/link.ld -+ RUSTC_MISC_ARGS = -C target-cpu=cortex-a72 - endif - - SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) $(wildcard **/*.ld) -@@ -56,9 +64,14 @@ - cargo xdoc --target=$(TARGET) --features bsp_$(BSP) --document-private-items - xdg-open target/$(TARGET)/doc/kernel/index.html - -+ifeq ($(QEMU_MACHINE_TYPE),) -+qemu: -+ @echo "This board is not yet supported for QEMU." -+else - qemu: all - $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(CONTAINER_UTILS) \ - $(DOCKER_EXEC_QEMU) $(QEMU_MISC_ARGS) -+endif - - clippy: - cargo xclippy --target=$(TARGET) --features bsp_$(BSP) - diff -uNr 05_safe_globals/src/arch/aarch64.rs 06_drivers_gpio_uart/src/arch/aarch64.rs --- 05_safe_globals/src/arch/aarch64.rs +++ 06_drivers_gpio_uart/src/arch/aarch64.rs @@ -149,21 +116,6 @@ diff -uNr 05_safe_globals/src/arch/aarch64.rs 06_drivers_gpio_uart/src/arch/aarc #[inline(always)] pub fn wait_forever() -> ! { -diff -uNr 05_safe_globals/src/arch.rs 06_drivers_gpio_uart/src/arch.rs ---- 05_safe_globals/src/arch.rs -+++ 06_drivers_gpio_uart/src/arch.rs -@@ -4,8 +4,8 @@ - - //! Conditional exporting of processor architecture code. - --#[cfg(feature = "bsp_rpi3")] -+#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))] - mod aarch64; - --#[cfg(feature = "bsp_rpi3")] -+#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))] - pub use aarch64::*; - diff -uNr 05_safe_globals/src/bsp/driver/bcm/bcm2xxx_gpio.rs 06_drivers_gpio_uart/src/bsp/driver/bcm/bcm2xxx_gpio.rs --- 05_safe_globals/src/bsp/driver/bcm/bcm2xxx_gpio.rs +++ 06_drivers_gpio_uart/src/bsp/driver/bcm/bcm2xxx_gpio.rs @@ -849,19 +801,15 @@ diff -uNr 05_safe_globals/src/bsp/rpi.rs 06_drivers_gpio_uart/src/bsp/rpi.rs diff -uNr 05_safe_globals/src/bsp.rs 06_drivers_gpio_uart/src/bsp.rs --- 05_safe_globals/src/bsp.rs +++ 06_drivers_gpio_uart/src/bsp.rs -@@ -4,8 +4,10 @@ +@@ -4,6 +4,8 @@ //! Conditional exporting of Board Support Packages. --#[cfg(feature = "bsp_rpi3")] +mod driver; + -+#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))] + #[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))] mod rpi; --#[cfg(feature = "bsp_rpi3")] -+#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))] - pub use rpi::*; diff -uNr 05_safe_globals/src/interface.rs 06_drivers_gpio_uart/src/interface.rs --- 05_safe_globals/src/interface.rs diff --git a/utils/make_all.rb b/utils/make_all.rb index dd5290e4..2e83f127 100755 --- a/utils/make_all.rb +++ b/utils/make_all.rb @@ -7,14 +7,14 @@ require_relative 'helpers/tutorial_folders.rb' -def make_all +def make_all(bsp = 'rpi3') crates = tutorial_folders crates.each do |x| x = File.dirname(x) puts "\n\n" + x.to_s + "\n\n" Dir.chdir(x) do - unless system('make') + unless system("BSP=#{bsp} make") puts "\n\nBuild failed!" exit(1) # Exit with error code end @@ -22,4 +22,4 @@ def make_all end end -make_all if $PROGRAM_NAME == __FILE__ +make_all(ARGV[0]) if $PROGRAM_NAME == __FILE__