From 971a716342adce782df24905fff05bbe4b3ec6d5 Mon Sep 17 00:00:00 2001 From: Brad Gibson Date: Tue, 26 Sep 2023 20:37:52 -0700 Subject: [PATCH] Update for Rpi4 support --- .gitignore | 1 + 01_wait_forever/Makefile | 2 +- 02_runtime_init/Makefile | 2 +- 03_hacky_hello_world/Makefile | 2 +- 03_hacky_hello_world/README.md | 2 +- 03_hacky_hello_world/src/panic_wait.rs | 9 +++++---- 04_safe_globals/Makefile | 2 +- 05_drivers_gpio_uart/Makefile | 2 +- 07_timestamps/Makefile | 2 +- 08_hw_debug_JTAG/Makefile | 2 +- 09_privilege_level/Makefile | 2 +- 10_virtual_mem_part1_identity_mapping/Makefile | 2 +- 11_exceptions_part1_groundwork/Makefile | 2 +- 12_integrated_testing/Makefile | 2 +- 12_integrated_testing/README.md | 2 +- 13_exceptions_part2_peripheral_IRQs/Makefile | 2 +- 14_virtual_mem_part2_mmio_remap/Makefile | 2 +- 15_virtual_mem_part3_precomputed_tables/Makefile | 2 +- 16_virtual_mem_part4_higher_half_kernel/Makefile | 2 +- 17_kernel_symbols/Makefile | 2 +- 18_backtrace/Makefile | 2 +- 19_kernel_heap/Makefile | 2 +- 20_timer_callbacks/Makefile | 2 +- X1_JTAG_boot/Makefile | 2 +- common/docker.mk | 2 +- docker/rustembedded-osdev-utils/Makefile | 6 +++--- 26 files changed, 32 insertions(+), 30 deletions(-) diff --git a/.gitignore b/.gitignore index 5bc8cd8d..83b21427 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ **/target/* **/.gdb_history **/kernel8.img +**/.idea node_modules .bundle diff --git a/01_wait_forever/Makefile b/01_wait_forever/Makefile index 51c128f7..302ddce2 100644 --- a/01_wait_forever/Makefile +++ b/01_wait_forever/Makefile @@ -35,7 +35,7 @@ else ifeq ($(BSP),rpi4) TARGET = aarch64-unknown-none-softfloat KERNEL_BIN = kernel8.img QEMU_BINARY = qemu-system-aarch64 - QEMU_MACHINE_TYPE = + QEMU_MACHINE_TYPE = raspi4 QEMU_RELEASE_ARGS = -d in_asm -display none OBJDUMP_BINARY = aarch64-none-elf-objdump NM_BINARY = aarch64-none-elf-nm diff --git a/02_runtime_init/Makefile b/02_runtime_init/Makefile index 893564e2..4bfd97ab 100644 --- a/02_runtime_init/Makefile +++ b/02_runtime_init/Makefile @@ -35,7 +35,7 @@ else ifeq ($(BSP),rpi4) TARGET = aarch64-unknown-none-softfloat KERNEL_BIN = kernel8.img QEMU_BINARY = qemu-system-aarch64 - QEMU_MACHINE_TYPE = + QEMU_MACHINE_TYPE = raspi4 QEMU_RELEASE_ARGS = -d in_asm -display none OBJDUMP_BINARY = aarch64-none-elf-objdump NM_BINARY = aarch64-none-elf-nm diff --git a/03_hacky_hello_world/Makefile b/03_hacky_hello_world/Makefile index ce5aff09..01d48668 100644 --- a/03_hacky_hello_world/Makefile +++ b/03_hacky_hello_world/Makefile @@ -35,7 +35,7 @@ else ifeq ($(BSP),rpi4) TARGET = aarch64-unknown-none-softfloat KERNEL_BIN = kernel8.img QEMU_BINARY = qemu-system-aarch64 - QEMU_MACHINE_TYPE = + QEMU_MACHINE_TYPE = raspi4 QEMU_RELEASE_ARGS = -serial stdio -display none OBJDUMP_BINARY = aarch64-none-elf-objdump NM_BINARY = aarch64-none-elf-nm diff --git a/03_hacky_hello_world/README.md b/03_hacky_hello_world/README.md index 07bf4503..94573b98 100644 --- a/03_hacky_hello_world/README.md +++ b/03_hacky_hello_world/README.md @@ -65,7 +65,7 @@ diff -uNr 02_runtime_init/Makefile 03_hacky_hello_world/Makefile @@ -36,7 +36,7 @@ KERNEL_BIN = kernel8.img QEMU_BINARY = qemu-system-aarch64 - QEMU_MACHINE_TYPE = + QEMU_MACHINE_TYPE = raspi4 - QEMU_RELEASE_ARGS = -d in_asm -display none + QEMU_RELEASE_ARGS = -serial stdio -display none OBJDUMP_BINARY = aarch64-none-elf-objdump diff --git a/03_hacky_hello_world/src/panic_wait.rs b/03_hacky_hello_world/src/panic_wait.rs index 5bb0896e..d4ec8f8d 100644 --- a/03_hacky_hello_world/src/panic_wait.rs +++ b/03_hacky_hello_world/src/panic_wait.rs @@ -51,13 +51,14 @@ fn panic(info: &PanicInfo) -> ! { }; println!( - "Kernel panic!\n\n\ - Panic location:\n File '{}', line {}, column {}\n\n\ - {}", + "Kernel panic!\n\ + {space}Panic message:\n{space}{space}{}\n\ + {space}Panic location:\n{space}{space}File '{}', line {}, column {}", + info.message().unwrap_or(&format_args!("")), location, line, column, - info.message().unwrap_or(&format_args!("")), + space = " ", ); cpu::wait_forever() diff --git a/04_safe_globals/Makefile b/04_safe_globals/Makefile index ce5aff09..01d48668 100644 --- a/04_safe_globals/Makefile +++ b/04_safe_globals/Makefile @@ -35,7 +35,7 @@ else ifeq ($(BSP),rpi4) TARGET = aarch64-unknown-none-softfloat KERNEL_BIN = kernel8.img QEMU_BINARY = qemu-system-aarch64 - QEMU_MACHINE_TYPE = + QEMU_MACHINE_TYPE = raspi4 QEMU_RELEASE_ARGS = -serial stdio -display none OBJDUMP_BINARY = aarch64-none-elf-objdump NM_BINARY = aarch64-none-elf-nm diff --git a/05_drivers_gpio_uart/Makefile b/05_drivers_gpio_uart/Makefile index f5135d1e..38184361 100644 --- a/05_drivers_gpio_uart/Makefile +++ b/05_drivers_gpio_uart/Makefile @@ -38,7 +38,7 @@ else ifeq ($(BSP),rpi4) TARGET = aarch64-unknown-none-softfloat KERNEL_BIN = kernel8.img QEMU_BINARY = qemu-system-aarch64 - QEMU_MACHINE_TYPE = + QEMU_MACHINE_TYPE = raspi4 QEMU_RELEASE_ARGS = -serial stdio -display none OBJDUMP_BINARY = aarch64-none-elf-objdump NM_BINARY = aarch64-none-elf-nm diff --git a/07_timestamps/Makefile b/07_timestamps/Makefile index b13f0dfb..eba5ca3f 100644 --- a/07_timestamps/Makefile +++ b/07_timestamps/Makefile @@ -38,7 +38,7 @@ else ifeq ($(BSP),rpi4) TARGET = aarch64-unknown-none-softfloat KERNEL_BIN = kernel8.img QEMU_BINARY = qemu-system-aarch64 - QEMU_MACHINE_TYPE = + QEMU_MACHINE_TYPE = raspi4 QEMU_RELEASE_ARGS = -serial stdio -display none OBJDUMP_BINARY = aarch64-none-elf-objdump NM_BINARY = aarch64-none-elf-nm diff --git a/08_hw_debug_JTAG/Makefile b/08_hw_debug_JTAG/Makefile index 9549f092..f496efb5 100644 --- a/08_hw_debug_JTAG/Makefile +++ b/08_hw_debug_JTAG/Makefile @@ -40,7 +40,7 @@ else ifeq ($(BSP),rpi4) TARGET = aarch64-unknown-none-softfloat KERNEL_BIN = kernel8.img QEMU_BINARY = qemu-system-aarch64 - QEMU_MACHINE_TYPE = + QEMU_MACHINE_TYPE = raspi4 QEMU_RELEASE_ARGS = -serial stdio -display none OBJDUMP_BINARY = aarch64-none-elf-objdump NM_BINARY = aarch64-none-elf-nm diff --git a/09_privilege_level/Makefile b/09_privilege_level/Makefile index 9549f092..f496efb5 100644 --- a/09_privilege_level/Makefile +++ b/09_privilege_level/Makefile @@ -40,7 +40,7 @@ else ifeq ($(BSP),rpi4) TARGET = aarch64-unknown-none-softfloat KERNEL_BIN = kernel8.img QEMU_BINARY = qemu-system-aarch64 - QEMU_MACHINE_TYPE = + QEMU_MACHINE_TYPE = raspi4 QEMU_RELEASE_ARGS = -serial stdio -display none OBJDUMP_BINARY = aarch64-none-elf-objdump NM_BINARY = aarch64-none-elf-nm diff --git a/10_virtual_mem_part1_identity_mapping/Makefile b/10_virtual_mem_part1_identity_mapping/Makefile index 9549f092..f496efb5 100644 --- a/10_virtual_mem_part1_identity_mapping/Makefile +++ b/10_virtual_mem_part1_identity_mapping/Makefile @@ -40,7 +40,7 @@ else ifeq ($(BSP),rpi4) TARGET = aarch64-unknown-none-softfloat KERNEL_BIN = kernel8.img QEMU_BINARY = qemu-system-aarch64 - QEMU_MACHINE_TYPE = + QEMU_MACHINE_TYPE = raspi4 QEMU_RELEASE_ARGS = -serial stdio -display none OBJDUMP_BINARY = aarch64-none-elf-objdump NM_BINARY = aarch64-none-elf-nm diff --git a/11_exceptions_part1_groundwork/Makefile b/11_exceptions_part1_groundwork/Makefile index 9549f092..f496efb5 100644 --- a/11_exceptions_part1_groundwork/Makefile +++ b/11_exceptions_part1_groundwork/Makefile @@ -40,7 +40,7 @@ else ifeq ($(BSP),rpi4) TARGET = aarch64-unknown-none-softfloat KERNEL_BIN = kernel8.img QEMU_BINARY = qemu-system-aarch64 - QEMU_MACHINE_TYPE = + QEMU_MACHINE_TYPE = raspi4 QEMU_RELEASE_ARGS = -serial stdio -display none OBJDUMP_BINARY = aarch64-none-elf-objdump NM_BINARY = aarch64-none-elf-nm diff --git a/12_integrated_testing/Makefile b/12_integrated_testing/Makefile index 4e2efeff..b1db9235 100644 --- a/12_integrated_testing/Makefile +++ b/12_integrated_testing/Makefile @@ -48,7 +48,7 @@ else ifeq ($(BSP),rpi4) TARGET = aarch64-unknown-none-softfloat KERNEL_BIN = kernel8.img QEMU_BINARY = qemu-system-aarch64 - QEMU_MACHINE_TYPE = + QEMU_MACHINE_TYPE = raspi4 QEMU_RELEASE_ARGS = -serial stdio -display none QEMU_TEST_ARGS = $(QEMU_RELEASE_ARGS) -semihosting OBJDUMP_BINARY = aarch64-none-elf-objdump diff --git a/12_integrated_testing/README.md b/12_integrated_testing/README.md index ae68d269..e0144aeb 100644 --- a/12_integrated_testing/README.md +++ b/12_integrated_testing/README.md @@ -449,7 +449,7 @@ provided to it by `cargo`, and finally compiles a `docker` command to execute th reference, here it is fully resolved for an `RPi3 BSP`: ```bash -docker run -t --rm -v /opt/rust-raspberrypi-OS-tutorials/12_integrated_testing:/work/tutorial -w /work/tutorial -v /opt/rust-raspberrypi-OS-tutorials/12_integrated_testing/../common:/work/common rustembedded/osdev-utils:2021.12 ruby ../common/tests/dispatch.rb qemu-system-aarch64 -M raspi3 -serial stdio -display none -semihosting -kernel $TEST_BINARY +docker run -t --rm -v /opt/rust-raspberrypi-OS-tutorials/12_integrated_testing:/work/tutorial -w /work/tutorial -v /opt/rust-raspberrypi-OS-tutorials/12_integrated_testing/../common:/work/common u007d/osdev-utils-rpi4:2023.09 ruby ../common/tests/dispatch.rb qemu-system-aarch64 -M raspi3 -serial stdio -display none -semihosting -kernel $TEST_BINARY ``` This command is quite similar to the one used in the `make test_boot` target that we have since diff --git a/13_exceptions_part2_peripheral_IRQs/Makefile b/13_exceptions_part2_peripheral_IRQs/Makefile index 4e2efeff..b1db9235 100644 --- a/13_exceptions_part2_peripheral_IRQs/Makefile +++ b/13_exceptions_part2_peripheral_IRQs/Makefile @@ -48,7 +48,7 @@ else ifeq ($(BSP),rpi4) TARGET = aarch64-unknown-none-softfloat KERNEL_BIN = kernel8.img QEMU_BINARY = qemu-system-aarch64 - QEMU_MACHINE_TYPE = + QEMU_MACHINE_TYPE = raspi4 QEMU_RELEASE_ARGS = -serial stdio -display none QEMU_TEST_ARGS = $(QEMU_RELEASE_ARGS) -semihosting OBJDUMP_BINARY = aarch64-none-elf-objdump diff --git a/14_virtual_mem_part2_mmio_remap/Makefile b/14_virtual_mem_part2_mmio_remap/Makefile index 4e2efeff..b1db9235 100644 --- a/14_virtual_mem_part2_mmio_remap/Makefile +++ b/14_virtual_mem_part2_mmio_remap/Makefile @@ -48,7 +48,7 @@ else ifeq ($(BSP),rpi4) TARGET = aarch64-unknown-none-softfloat KERNEL_BIN = kernel8.img QEMU_BINARY = qemu-system-aarch64 - QEMU_MACHINE_TYPE = + QEMU_MACHINE_TYPE = raspi4 QEMU_RELEASE_ARGS = -serial stdio -display none QEMU_TEST_ARGS = $(QEMU_RELEASE_ARGS) -semihosting OBJDUMP_BINARY = aarch64-none-elf-objdump diff --git a/15_virtual_mem_part3_precomputed_tables/Makefile b/15_virtual_mem_part3_precomputed_tables/Makefile index bc23270d..a9024aa7 100644 --- a/15_virtual_mem_part3_precomputed_tables/Makefile +++ b/15_virtual_mem_part3_precomputed_tables/Makefile @@ -48,7 +48,7 @@ else ifeq ($(BSP),rpi4) TARGET = aarch64-unknown-none-softfloat KERNEL_BIN = kernel8.img QEMU_BINARY = qemu-system-aarch64 - QEMU_MACHINE_TYPE = + QEMU_MACHINE_TYPE = raspi4 QEMU_RELEASE_ARGS = -serial stdio -display none QEMU_TEST_ARGS = $(QEMU_RELEASE_ARGS) -semihosting OBJDUMP_BINARY = aarch64-none-elf-objdump diff --git a/16_virtual_mem_part4_higher_half_kernel/Makefile b/16_virtual_mem_part4_higher_half_kernel/Makefile index bc23270d..a9024aa7 100644 --- a/16_virtual_mem_part4_higher_half_kernel/Makefile +++ b/16_virtual_mem_part4_higher_half_kernel/Makefile @@ -48,7 +48,7 @@ else ifeq ($(BSP),rpi4) TARGET = aarch64-unknown-none-softfloat KERNEL_BIN = kernel8.img QEMU_BINARY = qemu-system-aarch64 - QEMU_MACHINE_TYPE = + QEMU_MACHINE_TYPE = raspi4 QEMU_RELEASE_ARGS = -serial stdio -display none QEMU_TEST_ARGS = $(QEMU_RELEASE_ARGS) -semihosting OBJDUMP_BINARY = aarch64-none-elf-objdump diff --git a/17_kernel_symbols/Makefile b/17_kernel_symbols/Makefile index 3c33cd66..df9da46f 100644 --- a/17_kernel_symbols/Makefile +++ b/17_kernel_symbols/Makefile @@ -48,7 +48,7 @@ else ifeq ($(BSP),rpi4) TARGET = aarch64-unknown-none-softfloat KERNEL_BIN = kernel8.img QEMU_BINARY = qemu-system-aarch64 - QEMU_MACHINE_TYPE = + QEMU_MACHINE_TYPE = raspi4 QEMU_RELEASE_ARGS = -serial stdio -display none QEMU_TEST_ARGS = $(QEMU_RELEASE_ARGS) -semihosting OBJDUMP_BINARY = aarch64-none-elf-objdump diff --git a/18_backtrace/Makefile b/18_backtrace/Makefile index 7edf4edf..63bd58e7 100644 --- a/18_backtrace/Makefile +++ b/18_backtrace/Makefile @@ -48,7 +48,7 @@ else ifeq ($(BSP),rpi4) TARGET = aarch64-unknown-none-softfloat KERNEL_BIN = kernel8.img QEMU_BINARY = qemu-system-aarch64 - QEMU_MACHINE_TYPE = + QEMU_MACHINE_TYPE = raspi4 QEMU_RELEASE_ARGS = -serial stdio -display none QEMU_TEST_ARGS = $(QEMU_RELEASE_ARGS) -semihosting OBJDUMP_BINARY = aarch64-none-elf-objdump diff --git a/19_kernel_heap/Makefile b/19_kernel_heap/Makefile index f9704a44..6d3f13f5 100644 --- a/19_kernel_heap/Makefile +++ b/19_kernel_heap/Makefile @@ -53,7 +53,7 @@ else ifeq ($(BSP),rpi4) TARGET = aarch64-unknown-none-softfloat KERNEL_BIN = kernel8.img QEMU_BINARY = qemu-system-aarch64 - QEMU_MACHINE_TYPE = + QEMU_MACHINE_TYPE = raspi4 QEMU_RELEASE_ARGS = -serial stdio -display none QEMU_TEST_ARGS = $(QEMU_RELEASE_ARGS) -semihosting OBJDUMP_BINARY = aarch64-none-elf-objdump diff --git a/20_timer_callbacks/Makefile b/20_timer_callbacks/Makefile index f9704a44..6d3f13f5 100644 --- a/20_timer_callbacks/Makefile +++ b/20_timer_callbacks/Makefile @@ -53,7 +53,7 @@ else ifeq ($(BSP),rpi4) TARGET = aarch64-unknown-none-softfloat KERNEL_BIN = kernel8.img QEMU_BINARY = qemu-system-aarch64 - QEMU_MACHINE_TYPE = + QEMU_MACHINE_TYPE = raspi4 QEMU_RELEASE_ARGS = -serial stdio -display none QEMU_TEST_ARGS = $(QEMU_RELEASE_ARGS) -semihosting OBJDUMP_BINARY = aarch64-none-elf-objdump diff --git a/X1_JTAG_boot/Makefile b/X1_JTAG_boot/Makefile index b13f0dfb..eba5ca3f 100644 --- a/X1_JTAG_boot/Makefile +++ b/X1_JTAG_boot/Makefile @@ -38,7 +38,7 @@ else ifeq ($(BSP),rpi4) TARGET = aarch64-unknown-none-softfloat KERNEL_BIN = kernel8.img QEMU_BINARY = qemu-system-aarch64 - QEMU_MACHINE_TYPE = + QEMU_MACHINE_TYPE = raspi4 QEMU_RELEASE_ARGS = -serial stdio -display none OBJDUMP_BINARY = aarch64-none-elf-objdump NM_BINARY = aarch64-none-elf-nm diff --git a/common/docker.mk b/common/docker.mk index 61355768..5a5107a6 100644 --- a/common/docker.mk +++ b/common/docker.mk @@ -1 +1 @@ -DOCKER_IMAGE := rustembedded/osdev-utils:2021.12 +DOCKER_IMAGE := u007d/osdev-utils-rpi4:2023.09 diff --git a/docker/rustembedded-osdev-utils/Makefile b/docker/rustembedded-osdev-utils/Makefile index 57acd995..29cfbd1f 100644 --- a/docker/rustembedded-osdev-utils/Makefile +++ b/docker/rustembedded-osdev-utils/Makefile @@ -4,14 +4,14 @@ # Reference followed: https://www.docker.com/blog/getting-started-with-docker-for-arm-on-linux -TAG := 2021.12 +TAG := 2023.09 default: build_local build_local: cp ../../Gemfile . docker build \ - --tag rustembedded/osdev-utils:$(TAG) \ + --tag u007d/osdev-utils-rpi4:$(TAG) \ --build-arg VCS_REF=`git rev-parse --short HEAD` . rm Gemfile @@ -20,6 +20,6 @@ buildx_push: docker buildx build \ --push \ --platform linux/arm64/v8,linux/amd64 \ - --tag rustembedded/osdev-utils:$(TAG) \ + --tag u007d/osdev-utils-rpi4:$(TAG) \ --build-arg VCS_REF=`git rev-parse --short HEAD` . rm Gemfile