From 8513ccfd8dc83e76997c4f83252452e495fbc17b Mon Sep 17 00:00:00 2001 From: Andre Richter Date: Wed, 27 Apr 2022 22:08:55 +0200 Subject: [PATCH] Various minor fixes --- 01_wait_forever/Makefile | 1 - 01_wait_forever/src/main.rs | 4 +- 02_runtime_init/Makefile | 1 - 02_runtime_init/README.md | 6 +- 02_runtime_init/src/main.rs | 4 +- 03_hacky_hello_world/Makefile | 1 - 03_hacky_hello_world/README.md | 8 +-- 03_hacky_hello_world/src/main.rs | 4 +- 04_safe_globals/Makefile | 1 - 04_safe_globals/README.md | 6 +- 04_safe_globals/src/main.rs | 4 +- 05_drivers_gpio_uart/Makefile | 1 - 05_drivers_gpio_uart/README.md | 12 ++-- 05_drivers_gpio_uart/src/main.rs | 4 +- 06_uart_chainloader/Makefile | 1 - 06_uart_chainloader/README.md | 14 ++--- 06_uart_chainloader/src/main.rs | 4 +- 07_timestamps/Makefile | 1 - 07_timestamps/README.md | 12 ++-- 07_timestamps/src/main.rs | 4 +- 08_hw_debug_JTAG/Makefile | 1 - 08_hw_debug_JTAG/README.md | 4 +- 08_hw_debug_JTAG/src/main.rs | 4 +- 09_privilege_level/Makefile | 1 - 09_privilege_level/README.md | 8 +-- 09_privilege_level/src/main.rs | 4 +- .../Makefile | 1 - .../README.md | 10 ++-- .../src/main.rs | 4 +- 11_exceptions_part1_groundwork/Makefile | 1 - 11_exceptions_part1_groundwork/README.md | 16 ++++-- .../src/_arch/aarch64/exception.rs | 2 +- .../src/_arch/aarch64/exception.s | 4 ++ 11_exceptions_part1_groundwork/src/main.rs | 4 +- 12_integrated_testing/Makefile | 1 - .../kernel/src/_arch/aarch64/exception.rs | 2 +- .../kernel/src/_arch/aarch64/exception.s | 4 ++ 12_integrated_testing/kernel/src/lib.rs | 4 +- 12_integrated_testing/kernel/src/main.rs | 4 +- 13_exceptions_part2_peripheral_IRQs/Makefile | 1 - 13_exceptions_part2_peripheral_IRQs/README.md | 12 ++-- .../kernel/src/_arch/aarch64/exception.rs | 2 +- .../kernel/src/_arch/aarch64/exception.s | 4 ++ .../kernel/src/lib.rs | 4 +- .../kernel/src/main.rs | 4 +- 14_virtual_mem_part2_mmio_remap/Makefile | 1 - 14_virtual_mem_part2_mmio_remap/README.md | 10 ++-- .../kernel/src/_arch/aarch64/exception.rs | 2 +- .../kernel/src/_arch/aarch64/exception.s | 4 ++ .../kernel/src/lib.rs | 4 +- .../kernel/src/main.rs | 4 +- .../Makefile | 1 - .../README.md | 10 ++-- .../kernel/src/_arch/aarch64/exception.rs | 2 +- .../kernel/src/_arch/aarch64/exception.s | 4 ++ .../kernel/src/lib.rs | 4 +- .../kernel/src/main.rs | 4 +- .../Makefile | 1 - .../README.md | 2 +- .../kernel/src/_arch/aarch64/exception.rs | 2 +- .../kernel/src/_arch/aarch64/exception.s | 4 ++ .../kernel/src/lib.rs | 4 +- .../kernel/src/main.rs | 4 +- 17_kernel_symbols/Makefile | 3 +- 17_kernel_symbols/README.md | 56 +++++++++++-------- .../kernel/src/_arch/aarch64/exception.rs | 8 ++- .../kernel/src/_arch/aarch64/exception.s | 4 ++ 17_kernel_symbols/kernel/src/lib.rs | 4 +- 17_kernel_symbols/kernel/src/main.rs | 4 +- 17_kernel_symbols/kernel/src/symbols.rs | 14 +++-- .../libraries/debug-symbol-types/src/lib.rs | 6 ++ X1_JTAG_boot/Makefile | 1 - X1_JTAG_boot/src/main.rs | 4 +- 73 files changed, 228 insertions(+), 142 deletions(-) diff --git a/01_wait_forever/Makefile b/01_wait_forever/Makefile index 7699e5f4..59884220 100644 --- a/01_wait_forever/Makefile +++ b/01_wait_forever/Makefile @@ -81,7 +81,6 @@ COMPILER_ARGS = --target=$(TARGET) \ RUSTC_CMD = cargo rustc $(COMPILER_ARGS) DOC_CMD = cargo doc $(COMPILER_ARGS) CLIPPY_CMD = cargo clippy $(COMPILER_ARGS) -CHECK_CMD = cargo check $(COMPILER_ARGS) OBJCOPY_CMD = rust-objcopy \ --strip-all \ -O binary diff --git a/01_wait_forever/src/main.rs b/01_wait_forever/src/main.rs index 30dd45e7..f7e08a59 100644 --- a/01_wait_forever/src/main.rs +++ b/01_wait_forever/src/main.rs @@ -3,7 +3,9 @@ // Copyright (c) 2018-2022 Andre Richter // Rust embedded logo for `make doc`. -#![doc(html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png")] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png" +)] //! The `kernel` binary. //! diff --git a/02_runtime_init/Makefile b/02_runtime_init/Makefile index 0d877c15..ba5f0c79 100644 --- a/02_runtime_init/Makefile +++ b/02_runtime_init/Makefile @@ -81,7 +81,6 @@ COMPILER_ARGS = --target=$(TARGET) \ RUSTC_CMD = cargo rustc $(COMPILER_ARGS) DOC_CMD = cargo doc $(COMPILER_ARGS) CLIPPY_CMD = cargo clippy $(COMPILER_ARGS) -CHECK_CMD = cargo check $(COMPILER_ARGS) OBJCOPY_CMD = rust-objcopy \ --strip-all \ -O binary diff --git a/02_runtime_init/README.md b/02_runtime_init/README.md index f2f0f047..02ed0488 100644 --- a/02_runtime_init/README.md +++ b/02_runtime_init/README.md @@ -52,7 +52,7 @@ diff -uNr 01_wait_forever/Cargo.toml 02_runtime_init/Cargo.toml diff -uNr 01_wait_forever/Makefile 02_runtime_init/Makefile --- 01_wait_forever/Makefile +++ 02_runtime_init/Makefile -@@ -181,6 +181,8 @@ +@@ -180,6 +180,8 @@ $(call color_header, "Launching objdump") @$(DOCKER_TOOLS) $(OBJDUMP_BINARY) --disassemble --demangle \ --section .text \ @@ -302,7 +302,7 @@ diff -uNr 01_wait_forever/src/cpu.rs 02_runtime_init/src/cpu.rs diff -uNr 01_wait_forever/src/main.rs 02_runtime_init/src/main.rs --- 01_wait_forever/src/main.rs +++ 02_runtime_init/src/main.rs -@@ -102,6 +102,7 @@ +@@ -104,6 +104,7 @@ //! //! 1. The kernel's entry point is the function `cpu::boot::arch_boot::_start()`. //! - It is implemented in `src/_arch/__arch_name__/cpu/boot.s`. @@ -310,7 +310,7 @@ diff -uNr 01_wait_forever/src/main.rs 02_runtime_init/src/main.rs #![no_main] #![no_std] -@@ -110,4 +111,11 @@ +@@ -112,4 +113,11 @@ mod cpu; mod panic_wait; diff --git a/02_runtime_init/src/main.rs b/02_runtime_init/src/main.rs index 6b3b1efd..42653ac4 100644 --- a/02_runtime_init/src/main.rs +++ b/02_runtime_init/src/main.rs @@ -3,7 +3,9 @@ // Copyright (c) 2018-2022 Andre Richter // Rust embedded logo for `make doc`. -#![doc(html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png")] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png" +)] //! The `kernel` binary. //! diff --git a/03_hacky_hello_world/Makefile b/03_hacky_hello_world/Makefile index c3e75cce..a90b2fd6 100644 --- a/03_hacky_hello_world/Makefile +++ b/03_hacky_hello_world/Makefile @@ -81,7 +81,6 @@ COMPILER_ARGS = --target=$(TARGET) \ RUSTC_CMD = cargo rustc $(COMPILER_ARGS) DOC_CMD = cargo doc $(COMPILER_ARGS) CLIPPY_CMD = cargo clippy $(COMPILER_ARGS) -CHECK_CMD = cargo check $(COMPILER_ARGS) OBJCOPY_CMD = rust-objcopy \ --strip-all \ -O binary diff --git a/03_hacky_hello_world/README.md b/03_hacky_hello_world/README.md index 7263532c..30a717e8 100644 --- a/03_hacky_hello_world/README.md +++ b/03_hacky_hello_world/README.md @@ -70,7 +70,7 @@ diff -uNr 02_runtime_init/Makefile 03_hacky_hello_world/Makefile OBJDUMP_BINARY = aarch64-none-elf-objdump NM_BINARY = aarch64-none-elf-nm READELF_BINARY = aarch64-none-elf-readelf -@@ -86,17 +86,20 @@ +@@ -85,17 +85,20 @@ --strip-all \ -O binary @@ -94,7 +94,7 @@ diff -uNr 02_runtime_init/Makefile 03_hacky_hello_world/Makefile -@@ -192,3 +195,27 @@ +@@ -191,3 +194,27 @@ $(call color_header, "Launching nm") @$(DOCKER_TOOLS) $(NM_BINARY) --demangle --print-size $(KERNEL_ELF) | sort | rustfilt @@ -212,7 +212,7 @@ diff -uNr 02_runtime_init/src/console.rs 03_hacky_hello_world/src/console.rs diff -uNr 02_runtime_init/src/main.rs 03_hacky_hello_world/src/main.rs --- 02_runtime_init/src/main.rs +++ 03_hacky_hello_world/src/main.rs -@@ -104,12 +104,16 @@ +@@ -106,12 +106,16 @@ //! - It is implemented in `src/_arch/__arch_name__/cpu/boot.s`. //! 2. Once finished with architectural setup, the arch code calls `kernel_init()`. @@ -229,7 +229,7 @@ diff -uNr 02_runtime_init/src/main.rs 03_hacky_hello_world/src/main.rs /// Early init code. /// -@@ -117,5 +121,7 @@ +@@ -119,5 +123,7 @@ /// /// - Only a single core must be active and running this function. unsafe fn kernel_init() -> ! { diff --git a/03_hacky_hello_world/src/main.rs b/03_hacky_hello_world/src/main.rs index ee9afd2a..67b0551b 100644 --- a/03_hacky_hello_world/src/main.rs +++ b/03_hacky_hello_world/src/main.rs @@ -3,7 +3,9 @@ // Copyright (c) 2018-2022 Andre Richter // Rust embedded logo for `make doc`. -#![doc(html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png")] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png" +)] //! The `kernel` binary. //! diff --git a/04_safe_globals/Makefile b/04_safe_globals/Makefile index c3e75cce..a90b2fd6 100644 --- a/04_safe_globals/Makefile +++ b/04_safe_globals/Makefile @@ -81,7 +81,6 @@ COMPILER_ARGS = --target=$(TARGET) \ RUSTC_CMD = cargo rustc $(COMPILER_ARGS) DOC_CMD = cargo doc $(COMPILER_ARGS) CLIPPY_CMD = cargo clippy $(COMPILER_ARGS) -CHECK_CMD = cargo check $(COMPILER_ARGS) OBJCOPY_CMD = rust-objcopy \ --strip-all \ -O binary diff --git a/04_safe_globals/README.md b/04_safe_globals/README.md index bfb2b4fa..8eff4a67 100644 --- a/04_safe_globals/README.md +++ b/04_safe_globals/README.md @@ -224,7 +224,7 @@ diff -uNr 03_hacky_hello_world/src/console.rs 04_safe_globals/src/console.rs diff -uNr 03_hacky_hello_world/src/main.rs 04_safe_globals/src/main.rs --- 03_hacky_hello_world/src/main.rs +++ 04_safe_globals/src/main.rs -@@ -106,6 +106,7 @@ +@@ -108,6 +108,7 @@ #![feature(format_args_nl)] #![feature(panic_info_message)] @@ -232,7 +232,7 @@ diff -uNr 03_hacky_hello_world/src/main.rs 04_safe_globals/src/main.rs #![no_main] #![no_std] -@@ -114,6 +115,7 @@ +@@ -116,6 +117,7 @@ mod cpu; mod panic_wait; mod print; @@ -240,7 +240,7 @@ diff -uNr 03_hacky_hello_world/src/main.rs 04_safe_globals/src/main.rs /// Early init code. /// -@@ -121,7 +123,15 @@ +@@ -123,7 +125,15 @@ /// /// - Only a single core must be active and running this function. unsafe fn kernel_init() -> ! { diff --git a/04_safe_globals/src/main.rs b/04_safe_globals/src/main.rs index 422dcf91..b45e3a35 100644 --- a/04_safe_globals/src/main.rs +++ b/04_safe_globals/src/main.rs @@ -3,7 +3,9 @@ // Copyright (c) 2018-2022 Andre Richter // Rust embedded logo for `make doc`. -#![doc(html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png")] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png" +)] //! The `kernel` binary. //! diff --git a/05_drivers_gpio_uart/Makefile b/05_drivers_gpio_uart/Makefile index 38afeef9..376892d8 100644 --- a/05_drivers_gpio_uart/Makefile +++ b/05_drivers_gpio_uart/Makefile @@ -84,7 +84,6 @@ COMPILER_ARGS = --target=$(TARGET) \ RUSTC_CMD = cargo rustc $(COMPILER_ARGS) DOC_CMD = cargo doc $(COMPILER_ARGS) CLIPPY_CMD = cargo clippy $(COMPILER_ARGS) -CHECK_CMD = cargo check $(COMPILER_ARGS) OBJCOPY_CMD = rust-objcopy \ --strip-all \ -O binary diff --git a/05_drivers_gpio_uart/README.md b/05_drivers_gpio_uart/README.md index 3b6f38f3..5787ac12 100644 --- a/05_drivers_gpio_uart/README.md +++ b/05_drivers_gpio_uart/README.md @@ -155,7 +155,7 @@ diff -uNr 04_safe_globals/Makefile 05_drivers_gpio_uart/Makefile ##-------------------------------------------------------------------------------------------------- -@@ -88,6 +91,7 @@ +@@ -87,6 +90,7 @@ EXEC_QEMU = $(QEMU_BINARY) -M $(QEMU_MACHINE_TYPE) EXEC_TEST_DISPATCH = ruby ../common/tests/dispatch.rb @@ -163,7 +163,7 @@ diff -uNr 04_safe_globals/Makefile 05_drivers_gpio_uart/Makefile ##------------------------------------------------------------------------------ ## Dockerization -@@ -95,18 +99,26 @@ +@@ -94,18 +98,26 @@ DOCKER_CMD = docker run -t --rm -v $(shell pwd):/work/tutorial -w /work/tutorial DOCKER_CMD_INTERACT = $(DOCKER_CMD) -i DOCKER_ARG_DIR_COMMON = -v $(shell pwd)/../common:/work/common @@ -191,7 +191,7 @@ diff -uNr 04_safe_globals/Makefile 05_drivers_gpio_uart/Makefile all: $(KERNEL_BIN) -@@ -156,9 +168,16 @@ +@@ -155,9 +167,16 @@ qemu: $(KERNEL_BIN) $(call color_header, "Launching QEMU") @$(DOCKER_QEMU) $(EXEC_QEMU) $(QEMU_RELEASE_ARGS) -kernel $(KERNEL_BIN) @@ -1337,7 +1337,7 @@ diff -uNr 04_safe_globals/src/driver.rs 05_drivers_gpio_uart/src/driver.rs diff -uNr 04_safe_globals/src/main.rs 05_drivers_gpio_uart/src/main.rs --- 04_safe_globals/src/main.rs +++ 05_drivers_gpio_uart/src/main.rs -@@ -104,6 +104,7 @@ +@@ -106,6 +106,7 @@ //! - It is implemented in `src/_arch/__arch_name__/cpu/boot.s`. //! 2. Once finished with architectural setup, the arch code calls `kernel_init()`. @@ -1345,7 +1345,7 @@ diff -uNr 04_safe_globals/src/main.rs 05_drivers_gpio_uart/src/main.rs #![feature(format_args_nl)] #![feature(panic_info_message)] #![feature(trait_alias)] -@@ -113,6 +114,7 @@ +@@ -115,6 +116,7 @@ mod bsp; mod console; mod cpu; @@ -1353,7 +1353,7 @@ diff -uNr 04_safe_globals/src/main.rs 05_drivers_gpio_uart/src/main.rs mod panic_wait; mod print; mod synchronization; -@@ -122,16 +124,54 @@ +@@ -124,16 +126,54 @@ /// # Safety /// /// - Only a single core must be active and running this function. diff --git a/05_drivers_gpio_uart/src/main.rs b/05_drivers_gpio_uart/src/main.rs index 241d9498..9ee5a43c 100644 --- a/05_drivers_gpio_uart/src/main.rs +++ b/05_drivers_gpio_uart/src/main.rs @@ -3,7 +3,9 @@ // Copyright (c) 2018-2022 Andre Richter // Rust embedded logo for `make doc`. -#![doc(html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png")] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png" +)] //! The `kernel` binary. //! diff --git a/06_uart_chainloader/Makefile b/06_uart_chainloader/Makefile index 3cde6041..812fdf4e 100644 --- a/06_uart_chainloader/Makefile +++ b/06_uart_chainloader/Makefile @@ -86,7 +86,6 @@ COMPILER_ARGS = --target=$(TARGET) \ RUSTC_CMD = cargo rustc $(COMPILER_ARGS) DOC_CMD = cargo doc $(COMPILER_ARGS) CLIPPY_CMD = cargo clippy $(COMPILER_ARGS) -CHECK_CMD = cargo check $(COMPILER_ARGS) OBJCOPY_CMD = rust-objcopy \ --strip-all \ -O binary diff --git a/06_uart_chainloader/README.md b/06_uart_chainloader/README.md index 04a21dff..8c21ccfa 100644 --- a/06_uart_chainloader/README.md +++ b/06_uart_chainloader/README.md @@ -189,7 +189,7 @@ diff -uNr 05_drivers_gpio_uart/Makefile 06_uart_chainloader/Makefile endif # Export for build.rs. -@@ -90,8 +92,8 @@ +@@ -89,8 +91,8 @@ -O binary EXEC_QEMU = $(QEMU_BINARY) -M $(QEMU_MACHINE_TYPE) @@ -200,7 +200,7 @@ diff -uNr 05_drivers_gpio_uart/Makefile 06_uart_chainloader/Makefile ##------------------------------------------------------------------------------ ## Dockerization -@@ -110,7 +112,7 @@ +@@ -109,7 +111,7 @@ ifeq ($(shell uname -s),Linux) DOCKER_CMD_DEV = $(DOCKER_CMD_INTERACT) $(DOCKER_ARG_DEV) @@ -209,7 +209,7 @@ diff -uNr 05_drivers_gpio_uart/Makefile 06_uart_chainloader/Makefile endif -@@ -118,7 +120,7 @@ +@@ -117,7 +119,7 @@ ##-------------------------------------------------------------------------------------------------- ## Targets ##-------------------------------------------------------------------------------------------------- @@ -218,7 +218,7 @@ diff -uNr 05_drivers_gpio_uart/Makefile 06_uart_chainloader/Makefile all: $(KERNEL_BIN) -@@ -160,7 +162,7 @@ +@@ -159,7 +161,7 @@ ##------------------------------------------------------------------------------ ifeq ($(QEMU_MACHINE_TYPE),) # QEMU is not supported for the board. @@ -227,7 +227,7 @@ diff -uNr 05_drivers_gpio_uart/Makefile 06_uart_chainloader/Makefile $(call color_header, "$(QEMU_MISSING_STRING)") else # QEMU is supported. -@@ -169,13 +171,17 @@ +@@ -168,13 +170,17 @@ $(call color_header, "Launching QEMU") @$(DOCKER_QEMU) $(EXEC_QEMU) $(QEMU_RELEASE_ARGS) -kernel $(KERNEL_BIN) @@ -248,7 +248,7 @@ diff -uNr 05_drivers_gpio_uart/Makefile 06_uart_chainloader/Makefile ##------------------------------------------------------------------------------ ## Run clippy -@@ -233,7 +239,8 @@ +@@ -232,7 +238,8 @@ ##------------------------------------------------------------------------------ test_boot: $(KERNEL_BIN) $(call color_header, "Boot test - $(BSP)") @@ -457,7 +457,7 @@ diff -uNr 05_drivers_gpio_uart/src/bsp/raspberrypi/memory.rs 06_uart_chainloader diff -uNr 05_drivers_gpio_uart/src/main.rs 06_uart_chainloader/src/main.rs --- 05_drivers_gpio_uart/src/main.rs +++ 06_uart_chainloader/src/main.rs -@@ -140,38 +140,56 @@ +@@ -142,38 +142,56 @@ kernel_main() } diff --git a/06_uart_chainloader/src/main.rs b/06_uart_chainloader/src/main.rs index 79f8b0b3..21ee91a4 100644 --- a/06_uart_chainloader/src/main.rs +++ b/06_uart_chainloader/src/main.rs @@ -3,7 +3,9 @@ // Copyright (c) 2018-2022 Andre Richter // Rust embedded logo for `make doc`. -#![doc(html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png")] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png" +)] //! The `kernel` binary. //! diff --git a/07_timestamps/Makefile b/07_timestamps/Makefile index d5395011..a497ad81 100644 --- a/07_timestamps/Makefile +++ b/07_timestamps/Makefile @@ -84,7 +84,6 @@ COMPILER_ARGS = --target=$(TARGET) \ RUSTC_CMD = cargo rustc $(COMPILER_ARGS) DOC_CMD = cargo doc $(COMPILER_ARGS) CLIPPY_CMD = cargo clippy $(COMPILER_ARGS) -CHECK_CMD = cargo check $(COMPILER_ARGS) OBJCOPY_CMD = rust-objcopy \ --strip-all \ -O binary diff --git a/07_timestamps/README.md b/07_timestamps/README.md index abdca348..7bfa13dd 100644 --- a/07_timestamps/README.md +++ b/07_timestamps/README.md @@ -112,7 +112,7 @@ diff -uNr 06_uart_chainloader/Makefile 07_timestamps/Makefile endif # Export for build.rs. -@@ -92,7 +90,7 @@ +@@ -91,7 +89,7 @@ -O binary EXEC_QEMU = $(QEMU_BINARY) -M $(QEMU_MACHINE_TYPE) @@ -121,7 +121,7 @@ diff -uNr 06_uart_chainloader/Makefile 07_timestamps/Makefile EXEC_MINIPUSH = ruby ../common/serial/minipush.rb ##------------------------------------------------------------------------------ -@@ -162,7 +160,7 @@ +@@ -161,7 +159,7 @@ ##------------------------------------------------------------------------------ ifeq ($(QEMU_MACHINE_TYPE),) # QEMU is not supported for the board. @@ -130,7 +130,7 @@ diff -uNr 06_uart_chainloader/Makefile 07_timestamps/Makefile $(call color_header, "$(QEMU_MISSING_STRING)") else # QEMU is supported. -@@ -171,17 +169,13 @@ +@@ -170,17 +168,13 @@ $(call color_header, "Launching QEMU") @$(DOCKER_QEMU) $(EXEC_QEMU) $(QEMU_RELEASE_ARGS) -kernel $(KERNEL_BIN) @@ -149,7 +149,7 @@ diff -uNr 06_uart_chainloader/Makefile 07_timestamps/Makefile ##------------------------------------------------------------------------------ ## Run clippy -@@ -239,8 +233,7 @@ +@@ -238,8 +232,7 @@ ##------------------------------------------------------------------------------ test_boot: $(KERNEL_BIN) $(call color_header, "Boot test - $(BSP)") @@ -538,7 +538,7 @@ diff -uNr 06_uart_chainloader/src/cpu.rs 07_timestamps/src/cpu.rs diff -uNr 06_uart_chainloader/src/main.rs 07_timestamps/src/main.rs --- 06_uart_chainloader/src/main.rs +++ 07_timestamps/src/main.rs -@@ -118,6 +118,7 @@ +@@ -120,6 +120,7 @@ mod panic_wait; mod print; mod synchronization; @@ -546,7 +546,7 @@ diff -uNr 06_uart_chainloader/src/main.rs 07_timestamps/src/main.rs /// Early init code. /// -@@ -140,56 +141,38 @@ +@@ -142,56 +143,38 @@ kernel_main() } diff --git a/07_timestamps/src/main.rs b/07_timestamps/src/main.rs index c067d90c..1805414b 100644 --- a/07_timestamps/src/main.rs +++ b/07_timestamps/src/main.rs @@ -3,7 +3,9 @@ // Copyright (c) 2018-2022 Andre Richter // Rust embedded logo for `make doc`. -#![doc(html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png")] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png" +)] //! The `kernel` binary. //! diff --git a/08_hw_debug_JTAG/Makefile b/08_hw_debug_JTAG/Makefile index 4f6b01f9..9d76237c 100644 --- a/08_hw_debug_JTAG/Makefile +++ b/08_hw_debug_JTAG/Makefile @@ -88,7 +88,6 @@ COMPILER_ARGS = --target=$(TARGET) \ RUSTC_CMD = cargo rustc $(COMPILER_ARGS) DOC_CMD = cargo doc $(COMPILER_ARGS) CLIPPY_CMD = cargo clippy $(COMPILER_ARGS) -CHECK_CMD = cargo check $(COMPILER_ARGS) OBJCOPY_CMD = rust-objcopy \ --strip-all \ -O binary diff --git a/08_hw_debug_JTAG/README.md b/08_hw_debug_JTAG/README.md index b1f5d679..7f8a1846 100644 --- a/08_hw_debug_JTAG/README.md +++ b/08_hw_debug_JTAG/README.md @@ -338,7 +338,7 @@ diff -uNr 07_timestamps/Makefile 08_hw_debug_JTAG/Makefile LD_SCRIPT_PATH = $(shell pwd)/src/bsp/raspberrypi RUSTC_MISC_ARGS = -C target-cpu=cortex-a72 endif -@@ -99,18 +103,25 @@ +@@ -98,18 +102,25 @@ DOCKER_CMD = docker run -t --rm -v $(shell pwd):/work/tutorial -w /work/tutorial DOCKER_CMD_INTERACT = $(DOCKER_CMD) -i DOCKER_ARG_DIR_COMMON = -v $(shell pwd)/../common:/work/common @@ -364,7 +364,7 @@ diff -uNr 07_timestamps/Makefile 08_hw_debug_JTAG/Makefile endif -@@ -216,6 +227,35 @@ +@@ -215,6 +226,35 @@ diff --git a/08_hw_debug_JTAG/src/main.rs b/08_hw_debug_JTAG/src/main.rs index c067d90c..1805414b 100644 --- a/08_hw_debug_JTAG/src/main.rs +++ b/08_hw_debug_JTAG/src/main.rs @@ -3,7 +3,9 @@ // Copyright (c) 2018-2022 Andre Richter // Rust embedded logo for `make doc`. -#![doc(html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png")] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png" +)] //! The `kernel` binary. //! diff --git a/09_privilege_level/Makefile b/09_privilege_level/Makefile index 4f6b01f9..9d76237c 100644 --- a/09_privilege_level/Makefile +++ b/09_privilege_level/Makefile @@ -88,7 +88,6 @@ COMPILER_ARGS = --target=$(TARGET) \ RUSTC_CMD = cargo rustc $(COMPILER_ARGS) DOC_CMD = cargo doc $(COMPILER_ARGS) CLIPPY_CMD = cargo clippy $(COMPILER_ARGS) -CHECK_CMD = cargo check $(COMPILER_ARGS) OBJCOPY_CMD = rust-objcopy \ --strip-all \ -O binary diff --git a/09_privilege_level/README.md b/09_privilege_level/README.md index 729634ac..5b0f72c7 100644 --- a/09_privilege_level/README.md +++ b/09_privilege_level/README.md @@ -502,7 +502,7 @@ diff -uNr 08_hw_debug_JTAG/src/exception.rs 09_privilege_level/src/exception.rs diff -uNr 08_hw_debug_JTAG/src/main.rs 09_privilege_level/src/main.rs --- 08_hw_debug_JTAG/src/main.rs +++ 09_privilege_level/src/main.rs -@@ -115,6 +115,7 @@ +@@ -117,6 +117,7 @@ mod console; mod cpu; mod driver; @@ -510,7 +510,7 @@ diff -uNr 08_hw_debug_JTAG/src/main.rs 09_privilege_level/src/main.rs mod panic_wait; mod print; mod synchronization; -@@ -143,6 +144,8 @@ +@@ -145,6 +146,8 @@ /// The main function running after the early init. fn kernel_main() -> ! { @@ -519,7 +519,7 @@ diff -uNr 08_hw_debug_JTAG/src/main.rs 09_privilege_level/src/main.rs use core::time::Duration; use driver::interface::DriverManager; use time::interface::TimeManager; -@@ -154,6 +157,12 @@ +@@ -156,6 +159,12 @@ ); info!("Booting on: {}", bsp::board_name()); @@ -532,7 +532,7 @@ diff -uNr 08_hw_debug_JTAG/src/main.rs 09_privilege_level/src/main.rs info!( "Architectural timer resolution: {} ns", time::time_manager().resolution().as_nanos() -@@ -168,11 +177,15 @@ +@@ -170,11 +179,15 @@ info!(" {}. {}", i + 1, driver.compatible()); } diff --git a/09_privilege_level/src/main.rs b/09_privilege_level/src/main.rs index 45dba34c..b1b1bc27 100644 --- a/09_privilege_level/src/main.rs +++ b/09_privilege_level/src/main.rs @@ -3,7 +3,9 @@ // Copyright (c) 2018-2022 Andre Richter // Rust embedded logo for `make doc`. -#![doc(html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png")] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png" +)] //! The `kernel` binary. //! diff --git a/10_virtual_mem_part1_identity_mapping/Makefile b/10_virtual_mem_part1_identity_mapping/Makefile index 4f6b01f9..9d76237c 100644 --- a/10_virtual_mem_part1_identity_mapping/Makefile +++ b/10_virtual_mem_part1_identity_mapping/Makefile @@ -88,7 +88,6 @@ COMPILER_ARGS = --target=$(TARGET) \ RUSTC_CMD = cargo rustc $(COMPILER_ARGS) DOC_CMD = cargo doc $(COMPILER_ARGS) CLIPPY_CMD = cargo clippy $(COMPILER_ARGS) -CHECK_CMD = cargo check $(COMPILER_ARGS) OBJCOPY_CMD = rust-objcopy \ --strip-all \ -O binary diff --git a/10_virtual_mem_part1_identity_mapping/README.md b/10_virtual_mem_part1_identity_mapping/README.md index 8c2de206..3a5539c9 100644 --- a/10_virtual_mem_part1_identity_mapping/README.md +++ b/10_virtual_mem_part1_identity_mapping/README.md @@ -1081,7 +1081,7 @@ diff -uNr 09_privilege_level/src/bsp.rs 10_virtual_mem_part1_identity_mapping/sr diff -uNr 09_privilege_level/src/main.rs 10_virtual_mem_part1_identity_mapping/src/main.rs --- 09_privilege_level/src/main.rs +++ 10_virtual_mem_part1_identity_mapping/src/main.rs -@@ -105,6 +105,8 @@ +@@ -107,6 +107,8 @@ //! 2. Once finished with architectural setup, the arch code calls `kernel_init()`. #![allow(clippy::upper_case_acronyms)] @@ -1090,7 +1090,7 @@ diff -uNr 09_privilege_level/src/main.rs 10_virtual_mem_part1_identity_mapping/s #![feature(format_args_nl)] #![feature(panic_info_message)] #![feature(trait_alias)] -@@ -116,6 +118,7 @@ +@@ -118,6 +120,7 @@ mod cpu; mod driver; mod exception; @@ -1098,7 +1098,7 @@ diff -uNr 09_privilege_level/src/main.rs 10_virtual_mem_part1_identity_mapping/s mod panic_wait; mod print; mod synchronization; -@@ -126,9 +129,17 @@ +@@ -128,9 +131,17 @@ /// # Safety /// /// - Only a single core must be active and running this function. @@ -1117,7 +1117,7 @@ diff -uNr 09_privilege_level/src/main.rs 10_virtual_mem_part1_identity_mapping/s for i in bsp::driver::driver_manager().all_device_drivers().iter() { if let Err(x) = i.init() { -@@ -157,6 +168,9 @@ +@@ -159,6 +170,9 @@ ); info!("Booting on: {}", bsp::board_name()); @@ -1127,7 +1127,7 @@ diff -uNr 09_privilege_level/src/main.rs 10_virtual_mem_part1_identity_mapping/s let (_, privilege_level) = exception::current_privilege_level(); info!("Current privilege level: {}", privilege_level); -@@ -180,6 +194,13 @@ +@@ -182,6 +196,13 @@ info!("Timer test, spinning for 1 second"); time::time_manager().spin_for(Duration::from_secs(1)); diff --git a/10_virtual_mem_part1_identity_mapping/src/main.rs b/10_virtual_mem_part1_identity_mapping/src/main.rs index 148cdfff..327f3ce0 100644 --- a/10_virtual_mem_part1_identity_mapping/src/main.rs +++ b/10_virtual_mem_part1_identity_mapping/src/main.rs @@ -3,7 +3,9 @@ // Copyright (c) 2018-2022 Andre Richter // Rust embedded logo for `make doc`. -#![doc(html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png")] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png" +)] //! The `kernel` binary. //! diff --git a/11_exceptions_part1_groundwork/Makefile b/11_exceptions_part1_groundwork/Makefile index 4f6b01f9..9d76237c 100644 --- a/11_exceptions_part1_groundwork/Makefile +++ b/11_exceptions_part1_groundwork/Makefile @@ -88,7 +88,6 @@ COMPILER_ARGS = --target=$(TARGET) \ RUSTC_CMD = cargo rustc $(COMPILER_ARGS) DOC_CMD = cargo doc $(COMPILER_ARGS) CLIPPY_CMD = cargo clippy $(COMPILER_ARGS) -CHECK_CMD = cargo check $(COMPILER_ARGS) OBJCOPY_CMD = rust-objcopy \ --strip-all \ -O binary diff --git a/11_exceptions_part1_groundwork/README.md b/11_exceptions_part1_groundwork/README.md index 2f90b7ff..d0b86c55 100644 --- a/11_exceptions_part1_groundwork/README.md +++ b/11_exceptions_part1_groundwork/README.md @@ -183,6 +183,7 @@ some hand-crafted assembly. Introducing `exception.s`: /// Call the function provided by parameter `\handler` after saving the exception context. Provide /// the context as the first parameter to '\handler'. .macro CALL_WITH_CONTEXT handler +__vector_\handler: // Make room on the stack for the exception context. sub sp, sp, #16 * 17 @@ -221,6 +222,9 @@ some hand-crafted assembly. Introducing `exception.s`: // After returning from exception handling code, replay the saved context and return via // `eret`. b __exception_restore_context + +.size __vector_\handler, . - __vector_\handler +.type __vector_\handler, function .endm ``` @@ -539,7 +543,7 @@ diff -uNr 10_virtual_mem_part1_identity_mapping/src/_arch/aarch64/exception.rs 1 + /// Saved program status. + spsr_el1: SpsrEL1, + -+ // Exception syndrome register. ++ /// Exception syndrome register. + esr_el1: EsrEL1, +} + @@ -793,7 +797,7 @@ diff -uNr 10_virtual_mem_part1_identity_mapping/src/_arch/aarch64/exception.rs 1 diff -uNr 10_virtual_mem_part1_identity_mapping/src/_arch/aarch64/exception.s 11_exceptions_part1_groundwork/src/_arch/aarch64/exception.s --- 10_virtual_mem_part1_identity_mapping/src/_arch/aarch64/exception.s +++ 11_exceptions_part1_groundwork/src/_arch/aarch64/exception.s -@@ -0,0 +1,150 @@ +@@ -0,0 +1,154 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// +// Copyright (c) 2018-2022 Andre Richter @@ -805,6 +809,7 @@ diff -uNr 10_virtual_mem_part1_identity_mapping/src/_arch/aarch64/exception.s 11 +/// Call the function provided by parameter `\handler` after saving the exception context. Provide +/// the context as the first parameter to '\handler'. +.macro CALL_WITH_CONTEXT handler ++__vector_\handler: + // Make room on the stack for the exception context. + sub sp, sp, #16 * 17 + @@ -843,6 +848,9 @@ diff -uNr 10_virtual_mem_part1_identity_mapping/src/_arch/aarch64/exception.s 11 + // After returning from exception handling code, replay the saved context and return via + // `eret`. + b __exception_restore_context ++ ++.size __vector_\handler, . - __vector_\handler ++.type __vector_\handler, function +.endm + +.macro FIQ_SUSPEND @@ -1016,7 +1024,7 @@ diff -uNr 10_virtual_mem_part1_identity_mapping/src/exception.rs 11_exceptions_p diff -uNr 10_virtual_mem_part1_identity_mapping/src/main.rs 11_exceptions_part1_groundwork/src/main.rs --- 10_virtual_mem_part1_identity_mapping/src/main.rs +++ 11_exceptions_part1_groundwork/src/main.rs -@@ -137,6 +137,8 @@ +@@ -139,6 +139,8 @@ use driver::interface::DriverManager; use memory::mmu::interface::MMU; @@ -1025,7 +1033,7 @@ diff -uNr 10_virtual_mem_part1_identity_mapping/src/main.rs 11_exceptions_part1_ if let Err(string) = memory::mmu::mmu().enable_mmu_and_caching() { panic!("MMU: {}", string); } -@@ -194,13 +196,28 @@ +@@ -196,13 +198,28 @@ info!("Timer test, spinning for 1 second"); time::time_manager().spin_for(Duration::from_secs(1)); diff --git a/11_exceptions_part1_groundwork/src/_arch/aarch64/exception.rs b/11_exceptions_part1_groundwork/src/_arch/aarch64/exception.rs index e8484938..7d3b4572 100644 --- a/11_exceptions_part1_groundwork/src/_arch/aarch64/exception.rs +++ b/11_exceptions_part1_groundwork/src/_arch/aarch64/exception.rs @@ -45,7 +45,7 @@ struct ExceptionContext { /// Saved program status. spsr_el1: SpsrEL1, - // Exception syndrome register. + /// Exception syndrome register. esr_el1: EsrEL1, } diff --git a/11_exceptions_part1_groundwork/src/_arch/aarch64/exception.s b/11_exceptions_part1_groundwork/src/_arch/aarch64/exception.s index 5aae30b9..91805ee7 100644 --- a/11_exceptions_part1_groundwork/src/_arch/aarch64/exception.s +++ b/11_exceptions_part1_groundwork/src/_arch/aarch64/exception.s @@ -9,6 +9,7 @@ /// Call the function provided by parameter `\handler` after saving the exception context. Provide /// the context as the first parameter to '\handler'. .macro CALL_WITH_CONTEXT handler +__vector_\handler: // Make room on the stack for the exception context. sub sp, sp, #16 * 17 @@ -47,6 +48,9 @@ // After returning from exception handling code, replay the saved context and return via // `eret`. b __exception_restore_context + +.size __vector_\handler, . - __vector_\handler +.type __vector_\handler, function .endm .macro FIQ_SUSPEND diff --git a/11_exceptions_part1_groundwork/src/main.rs b/11_exceptions_part1_groundwork/src/main.rs index 5534750a..0c88c58e 100644 --- a/11_exceptions_part1_groundwork/src/main.rs +++ b/11_exceptions_part1_groundwork/src/main.rs @@ -3,7 +3,9 @@ // Copyright (c) 2018-2022 Andre Richter // Rust embedded logo for `make doc`. -#![doc(html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png")] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png" +)] //! The `kernel` binary. //! diff --git a/12_integrated_testing/Makefile b/12_integrated_testing/Makefile index 50986ce2..1a19e601 100644 --- a/12_integrated_testing/Makefile +++ b/12_integrated_testing/Makefile @@ -97,7 +97,6 @@ COMPILER_ARGS = --target=$(TARGET) \ RUSTC_CMD = cargo rustc $(COMPILER_ARGS) --manifest-path $(KERNEL_MANIFEST) DOC_CMD = cargo doc $(COMPILER_ARGS) CLIPPY_CMD = cargo clippy $(COMPILER_ARGS) -CHECK_CMD = cargo check $(COMPILER_ARGS) TEST_CMD = cargo test $(COMPILER_ARGS) --manifest-path $(KERNEL_MANIFEST) OBJCOPY_CMD = rust-objcopy \ --strip-all \ diff --git a/12_integrated_testing/kernel/src/_arch/aarch64/exception.rs b/12_integrated_testing/kernel/src/_arch/aarch64/exception.rs index e84699e1..0f83052c 100644 --- a/12_integrated_testing/kernel/src/_arch/aarch64/exception.rs +++ b/12_integrated_testing/kernel/src/_arch/aarch64/exception.rs @@ -45,7 +45,7 @@ struct ExceptionContext { /// Saved program status. spsr_el1: SpsrEL1, - // Exception syndrome register. + /// Exception syndrome register. esr_el1: EsrEL1, } diff --git a/12_integrated_testing/kernel/src/_arch/aarch64/exception.s b/12_integrated_testing/kernel/src/_arch/aarch64/exception.s index 5aae30b9..91805ee7 100644 --- a/12_integrated_testing/kernel/src/_arch/aarch64/exception.s +++ b/12_integrated_testing/kernel/src/_arch/aarch64/exception.s @@ -9,6 +9,7 @@ /// Call the function provided by parameter `\handler` after saving the exception context. Provide /// the context as the first parameter to '\handler'. .macro CALL_WITH_CONTEXT handler +__vector_\handler: // Make room on the stack for the exception context. sub sp, sp, #16 * 17 @@ -47,6 +48,9 @@ // After returning from exception handling code, replay the saved context and return via // `eret`. b __exception_restore_context + +.size __vector_\handler, . - __vector_\handler +.type __vector_\handler, function .endm .macro FIQ_SUSPEND diff --git a/12_integrated_testing/kernel/src/lib.rs b/12_integrated_testing/kernel/src/lib.rs index 1218e30e..442de9e0 100644 --- a/12_integrated_testing/kernel/src/lib.rs +++ b/12_integrated_testing/kernel/src/lib.rs @@ -3,7 +3,9 @@ // Copyright (c) 2018-2022 Andre Richter // Rust embedded logo for `make doc`. -#![doc(html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png")] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png" +)] //! The `kernel` library. //! diff --git a/12_integrated_testing/kernel/src/main.rs b/12_integrated_testing/kernel/src/main.rs index dfbc1166..11b6547d 100644 --- a/12_integrated_testing/kernel/src/main.rs +++ b/12_integrated_testing/kernel/src/main.rs @@ -3,7 +3,9 @@ // Copyright (c) 2018-2022 Andre Richter // Rust embedded logo for `make doc`. -#![doc(html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png")] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png" +)] //! The `kernel` binary. diff --git a/13_exceptions_part2_peripheral_IRQs/Makefile b/13_exceptions_part2_peripheral_IRQs/Makefile index 50986ce2..1a19e601 100644 --- a/13_exceptions_part2_peripheral_IRQs/Makefile +++ b/13_exceptions_part2_peripheral_IRQs/Makefile @@ -97,7 +97,6 @@ COMPILER_ARGS = --target=$(TARGET) \ RUSTC_CMD = cargo rustc $(COMPILER_ARGS) --manifest-path $(KERNEL_MANIFEST) DOC_CMD = cargo doc $(COMPILER_ARGS) CLIPPY_CMD = cargo clippy $(COMPILER_ARGS) -CHECK_CMD = cargo check $(COMPILER_ARGS) TEST_CMD = cargo test $(COMPILER_ARGS) --manifest-path $(KERNEL_MANIFEST) OBJCOPY_CMD = rust-objcopy \ --strip-all \ diff --git a/13_exceptions_part2_peripheral_IRQs/README.md b/13_exceptions_part2_peripheral_IRQs/README.md index 35e0307f..5938da9e 100644 --- a/13_exceptions_part2_peripheral_IRQs/README.md +++ b/13_exceptions_part2_peripheral_IRQs/README.md @@ -2398,7 +2398,7 @@ diff -uNr 12_integrated_testing/kernel/src/exception/asynchronous.rs 13_exceptio diff -uNr 12_integrated_testing/kernel/src/lib.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/lib.rs --- 12_integrated_testing/kernel/src/lib.rs +++ 13_exceptions_part2_peripheral_IRQs/kernel/src/lib.rs -@@ -108,6 +108,7 @@ +@@ -110,6 +110,7 @@ #![allow(clippy::upper_case_acronyms)] #![allow(incomplete_features)] @@ -2406,7 +2406,7 @@ diff -uNr 12_integrated_testing/kernel/src/lib.rs 13_exceptions_part2_peripheral #![feature(core_intrinsics)] #![feature(format_args_nl)] #![feature(linkage)] -@@ -130,6 +131,7 @@ +@@ -132,6 +133,7 @@ pub mod exception; pub mod memory; pub mod print; @@ -2418,7 +2418,7 @@ diff -uNr 12_integrated_testing/kernel/src/lib.rs 13_exceptions_part2_peripheral diff -uNr 12_integrated_testing/kernel/src/main.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/main.rs --- 12_integrated_testing/kernel/src/main.rs +++ 13_exceptions_part2_peripheral_IRQs/kernel/src/main.rs -@@ -11,7 +11,7 @@ +@@ -13,7 +13,7 @@ #![no_main] #![no_std] @@ -2427,7 +2427,7 @@ diff -uNr 12_integrated_testing/kernel/src/main.rs 13_exceptions_part2_periphera /// Early init code. /// -@@ -21,7 +21,7 @@ +@@ -23,7 +23,7 @@ /// - The init calls in this function must appear in the correct order: /// - MMU + Data caching must be activated at the earliest. Without it, any atomic operations, /// e.g. the yet-to-be-introduced spinlocks in the device drivers (which currently employ @@ -2436,7 +2436,7 @@ diff -uNr 12_integrated_testing/kernel/src/main.rs 13_exceptions_part2_periphera #[no_mangle] unsafe fn kernel_init() -> ! { use driver::interface::DriverManager; -@@ -41,15 +41,27 @@ +@@ -43,15 +43,27 @@ bsp::driver::driver_manager().post_device_driver_init(); // println! is usable from here on. @@ -2466,7 +2466,7 @@ diff -uNr 12_integrated_testing/kernel/src/main.rs 13_exceptions_part2_periphera info!("{}", libkernel::version()); info!("Booting on: {}", bsp::board_name()); -@@ -77,12 +89,9 @@ +@@ -79,12 +91,9 @@ info!(" {}. {}", i + 1, driver.compatible()); } diff --git a/13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/exception.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/exception.rs index 495dba34..662c91b9 100644 --- a/13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/exception.rs +++ b/13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/exception.rs @@ -46,7 +46,7 @@ struct ExceptionContext { /// Saved program status. spsr_el1: SpsrEL1, - // Exception syndrome register. + /// Exception syndrome register. esr_el1: EsrEL1, } diff --git a/13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/exception.s b/13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/exception.s index 5aae30b9..91805ee7 100644 --- a/13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/exception.s +++ b/13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/exception.s @@ -9,6 +9,7 @@ /// Call the function provided by parameter `\handler` after saving the exception context. Provide /// the context as the first parameter to '\handler'. .macro CALL_WITH_CONTEXT handler +__vector_\handler: // Make room on the stack for the exception context. sub sp, sp, #16 * 17 @@ -47,6 +48,9 @@ // After returning from exception handling code, replay the saved context and return via // `eret`. b __exception_restore_context + +.size __vector_\handler, . - __vector_\handler +.type __vector_\handler, function .endm .macro FIQ_SUSPEND diff --git a/13_exceptions_part2_peripheral_IRQs/kernel/src/lib.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/lib.rs index 9bd360c0..58a939f1 100644 --- a/13_exceptions_part2_peripheral_IRQs/kernel/src/lib.rs +++ b/13_exceptions_part2_peripheral_IRQs/kernel/src/lib.rs @@ -3,7 +3,9 @@ // Copyright (c) 2018-2022 Andre Richter // Rust embedded logo for `make doc`. -#![doc(html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png")] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png" +)] //! The `kernel` library. //! diff --git a/13_exceptions_part2_peripheral_IRQs/kernel/src/main.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/main.rs index 228b984b..0f72d17f 100644 --- a/13_exceptions_part2_peripheral_IRQs/kernel/src/main.rs +++ b/13_exceptions_part2_peripheral_IRQs/kernel/src/main.rs @@ -3,7 +3,9 @@ // Copyright (c) 2018-2022 Andre Richter // Rust embedded logo for `make doc`. -#![doc(html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png")] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png" +)] //! The `kernel` binary. diff --git a/14_virtual_mem_part2_mmio_remap/Makefile b/14_virtual_mem_part2_mmio_remap/Makefile index 50986ce2..1a19e601 100644 --- a/14_virtual_mem_part2_mmio_remap/Makefile +++ b/14_virtual_mem_part2_mmio_remap/Makefile @@ -97,7 +97,6 @@ COMPILER_ARGS = --target=$(TARGET) \ RUSTC_CMD = cargo rustc $(COMPILER_ARGS) --manifest-path $(KERNEL_MANIFEST) DOC_CMD = cargo doc $(COMPILER_ARGS) CLIPPY_CMD = cargo clippy $(COMPILER_ARGS) -CHECK_CMD = cargo check $(COMPILER_ARGS) TEST_CMD = cargo test $(COMPILER_ARGS) --manifest-path $(KERNEL_MANIFEST) OBJCOPY_CMD = rust-objcopy \ --strip-all \ diff --git a/14_virtual_mem_part2_mmio_remap/README.md b/14_virtual_mem_part2_mmio_remap/README.md index e19cedb7..329e2105 100644 --- a/14_virtual_mem_part2_mmio_remap/README.md +++ b/14_virtual_mem_part2_mmio_remap/README.md @@ -2136,7 +2136,7 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/driver.rs 14_virtual_me diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/lib.rs 14_virtual_mem_part2_mmio_remap/kernel/src/lib.rs --- 13_exceptions_part2_peripheral_IRQs/kernel/src/lib.rs +++ 14_virtual_mem_part2_mmio_remap/kernel/src/lib.rs -@@ -111,8 +111,10 @@ +@@ -113,8 +113,10 @@ #![feature(asm_const)] #![feature(core_intrinsics)] #![feature(format_args_nl)] @@ -2147,7 +2147,7 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/lib.rs 14_virtual_mem_p #![feature(trait_alias)] #![no_std] // Testing -@@ -125,6 +127,7 @@ +@@ -127,6 +129,7 @@ mod synchronization; pub mod bsp; @@ -2155,7 +2155,7 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/lib.rs 14_virtual_mem_p pub mod console; pub mod cpu; pub mod driver; -@@ -177,6 +180,7 @@ +@@ -179,6 +182,7 @@ #[no_mangle] unsafe fn kernel_init() -> ! { exception::handling_init(); @@ -2167,7 +2167,7 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/lib.rs 14_virtual_mem_p diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/main.rs 14_virtual_mem_part2_mmio_remap/kernel/src/main.rs --- 13_exceptions_part2_peripheral_IRQs/kernel/src/main.rs +++ 14_virtual_mem_part2_mmio_remap/kernel/src/main.rs -@@ -25,21 +25,41 @@ +@@ -27,21 +27,41 @@ #[no_mangle] unsafe fn kernel_init() -> ! { use driver::interface::DriverManager; @@ -2215,7 +2215,7 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/main.rs 14_virtual_mem_ // Let device drivers register and enable their handlers with the interrupt controller. for i in bsp::driver::driver_manager().all_device_drivers() { -@@ -66,8 +86,8 @@ +@@ -68,8 +88,8 @@ info!("{}", libkernel::version()); info!("Booting on: {}", bsp::board_name()); diff --git a/14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/exception.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/exception.rs index 495dba34..662c91b9 100644 --- a/14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/exception.rs +++ b/14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/exception.rs @@ -46,7 +46,7 @@ struct ExceptionContext { /// Saved program status. spsr_el1: SpsrEL1, - // Exception syndrome register. + /// Exception syndrome register. esr_el1: EsrEL1, } diff --git a/14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/exception.s b/14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/exception.s index 5aae30b9..91805ee7 100644 --- a/14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/exception.s +++ b/14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/exception.s @@ -9,6 +9,7 @@ /// Call the function provided by parameter `\handler` after saving the exception context. Provide /// the context as the first parameter to '\handler'. .macro CALL_WITH_CONTEXT handler +__vector_\handler: // Make room on the stack for the exception context. sub sp, sp, #16 * 17 @@ -47,6 +48,9 @@ // After returning from exception handling code, replay the saved context and return via // `eret`. b __exception_restore_context + +.size __vector_\handler, . - __vector_\handler +.type __vector_\handler, function .endm .macro FIQ_SUSPEND diff --git a/14_virtual_mem_part2_mmio_remap/kernel/src/lib.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/lib.rs index 2c874f18..aeab8c22 100644 --- a/14_virtual_mem_part2_mmio_remap/kernel/src/lib.rs +++ b/14_virtual_mem_part2_mmio_remap/kernel/src/lib.rs @@ -3,7 +3,9 @@ // Copyright (c) 2018-2022 Andre Richter // Rust embedded logo for `make doc`. -#![doc(html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png")] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png" +)] //! The `kernel` library. //! diff --git a/14_virtual_mem_part2_mmio_remap/kernel/src/main.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/main.rs index 68d34e35..17edcfd9 100644 --- a/14_virtual_mem_part2_mmio_remap/kernel/src/main.rs +++ b/14_virtual_mem_part2_mmio_remap/kernel/src/main.rs @@ -3,7 +3,9 @@ // Copyright (c) 2018-2022 Andre Richter // Rust embedded logo for `make doc`. -#![doc(html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png")] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png" +)] //! The `kernel` binary. diff --git a/15_virtual_mem_part3_precomputed_tables/Makefile b/15_virtual_mem_part3_precomputed_tables/Makefile index 85b8ca38..0d34c181 100644 --- a/15_virtual_mem_part3_precomputed_tables/Makefile +++ b/15_virtual_mem_part3_precomputed_tables/Makefile @@ -107,7 +107,6 @@ COMPILER_ARGS = --target=$(TARGET) \ RUSTC_CMD = cargo rustc $(COMPILER_ARGS) --manifest-path $(KERNEL_MANIFEST) DOC_CMD = cargo doc $(COMPILER_ARGS) CLIPPY_CMD = cargo clippy $(COMPILER_ARGS) -CHECK_CMD = cargo check $(COMPILER_ARGS) TEST_CMD = cargo test $(COMPILER_ARGS) --manifest-path $(KERNEL_MANIFEST) OBJCOPY_CMD = rust-objcopy \ --strip-all \ diff --git a/15_virtual_mem_part3_precomputed_tables/README.md b/15_virtual_mem_part3_precomputed_tables/README.md index b09b265b..9ec33fc0 100644 --- a/15_virtual_mem_part3_precomputed_tables/README.md +++ b/15_virtual_mem_part3_precomputed_tables/README.md @@ -1374,7 +1374,7 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/memory/mmu. diff -uNr 14_virtual_mem_part2_mmio_remap/kernel/src/main.rs 15_virtual_mem_part3_precomputed_tables/kernel/src/main.rs --- 14_virtual_mem_part2_mmio_remap/kernel/src/main.rs +++ 15_virtual_mem_part3_precomputed_tables/kernel/src/main.rs -@@ -15,31 +15,23 @@ +@@ -17,31 +17,23 @@ /// Early init code. /// @@ -1413,7 +1413,7 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/kernel/src/main.rs 15_virtual_mem_part // Bring up the drivers needed for printing first. for i in bsp::driver::driver_manager() .early_print_device_drivers() -@@ -49,7 +41,7 @@ +@@ -51,7 +43,7 @@ i.init().unwrap_or_else(|_| cpu::wait_forever()); } bsp::driver::driver_manager().post_early_print_device_driver_init(); @@ -1860,7 +1860,7 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/Makefile 15_virtual_mem_part3_precompu -@@ -104,6 +114,7 @@ +@@ -103,6 +113,7 @@ -O binary EXEC_QEMU = $(QEMU_BINARY) -M $(QEMU_MACHINE_TYPE) @@ -1868,7 +1868,7 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/Makefile 15_virtual_mem_part3_precompu EXEC_TEST_DISPATCH = ruby ../common/tests/dispatch.rb EXEC_MINIPUSH = ruby ../common/serial/minipush.rb -@@ -154,16 +165,24 @@ +@@ -153,16 +164,24 @@ ##------------------------------------------------------------------------------ ## Compile the kernel ELF ##------------------------------------------------------------------------------ @@ -1896,7 +1896,7 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/Makefile 15_virtual_mem_part3_precompu $(call color_progress_prefix, "Name") @echo $(KERNEL_BIN) $(call color_progress_prefix, "Size") -@@ -302,6 +321,7 @@ +@@ -301,6 +320,7 @@ TEST_ELF=$$(echo $$1 | sed -e 's/.*target/target/g') TEST_BINARY=$$(echo $$1.img | sed -e 's/.*target/target/g') diff --git a/15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/exception.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/exception.rs index 495dba34..662c91b9 100644 --- a/15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/exception.rs +++ b/15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/exception.rs @@ -46,7 +46,7 @@ struct ExceptionContext { /// Saved program status. spsr_el1: SpsrEL1, - // Exception syndrome register. + /// Exception syndrome register. esr_el1: EsrEL1, } diff --git a/15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/exception.s b/15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/exception.s index 5aae30b9..91805ee7 100644 --- a/15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/exception.s +++ b/15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/exception.s @@ -9,6 +9,7 @@ /// Call the function provided by parameter `\handler` after saving the exception context. Provide /// the context as the first parameter to '\handler'. .macro CALL_WITH_CONTEXT handler +__vector_\handler: // Make room on the stack for the exception context. sub sp, sp, #16 * 17 @@ -47,6 +48,9 @@ // After returning from exception handling code, replay the saved context and return via // `eret`. b __exception_restore_context + +.size __vector_\handler, . - __vector_\handler +.type __vector_\handler, function .endm .macro FIQ_SUSPEND diff --git a/15_virtual_mem_part3_precomputed_tables/kernel/src/lib.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/lib.rs index 2c874f18..aeab8c22 100644 --- a/15_virtual_mem_part3_precomputed_tables/kernel/src/lib.rs +++ b/15_virtual_mem_part3_precomputed_tables/kernel/src/lib.rs @@ -3,7 +3,9 @@ // Copyright (c) 2018-2022 Andre Richter // Rust embedded logo for `make doc`. -#![doc(html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png")] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png" +)] //! The `kernel` library. //! diff --git a/15_virtual_mem_part3_precomputed_tables/kernel/src/main.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/main.rs index c0c18818..5150f3af 100644 --- a/15_virtual_mem_part3_precomputed_tables/kernel/src/main.rs +++ b/15_virtual_mem_part3_precomputed_tables/kernel/src/main.rs @@ -3,7 +3,9 @@ // Copyright (c) 2018-2022 Andre Richter // Rust embedded logo for `make doc`. -#![doc(html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png")] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png" +)] //! The `kernel` binary. diff --git a/16_virtual_mem_part4_higher_half_kernel/Makefile b/16_virtual_mem_part4_higher_half_kernel/Makefile index 85b8ca38..0d34c181 100644 --- a/16_virtual_mem_part4_higher_half_kernel/Makefile +++ b/16_virtual_mem_part4_higher_half_kernel/Makefile @@ -107,7 +107,6 @@ COMPILER_ARGS = --target=$(TARGET) \ RUSTC_CMD = cargo rustc $(COMPILER_ARGS) --manifest-path $(KERNEL_MANIFEST) DOC_CMD = cargo doc $(COMPILER_ARGS) CLIPPY_CMD = cargo clippy $(COMPILER_ARGS) -CHECK_CMD = cargo check $(COMPILER_ARGS) TEST_CMD = cargo test $(COMPILER_ARGS) --manifest-path $(KERNEL_MANIFEST) OBJCOPY_CMD = rust-objcopy \ --strip-all \ diff --git a/16_virtual_mem_part4_higher_half_kernel/README.md b/16_virtual_mem_part4_higher_half_kernel/README.md index 89f650a3..32259671 100644 --- a/16_virtual_mem_part4_higher_half_kernel/README.md +++ b/16_virtual_mem_part4_higher_half_kernel/README.md @@ -799,7 +799,7 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/mem diff -uNr 15_virtual_mem_part3_precomputed_tables/kernel/src/lib.rs 16_virtual_mem_part4_higher_half_kernel/kernel/src/lib.rs --- 15_virtual_mem_part3_precomputed_tables/kernel/src/lib.rs +++ 16_virtual_mem_part4_higher_half_kernel/kernel/src/lib.rs -@@ -150,11 +150,6 @@ +@@ -152,11 +152,6 @@ ) } diff --git a/16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/exception.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/exception.rs index 495dba34..662c91b9 100644 --- a/16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/exception.rs +++ b/16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/exception.rs @@ -46,7 +46,7 @@ struct ExceptionContext { /// Saved program status. spsr_el1: SpsrEL1, - // Exception syndrome register. + /// Exception syndrome register. esr_el1: EsrEL1, } diff --git a/16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/exception.s b/16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/exception.s index 5aae30b9..91805ee7 100644 --- a/16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/exception.s +++ b/16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/exception.s @@ -9,6 +9,7 @@ /// Call the function provided by parameter `\handler` after saving the exception context. Provide /// the context as the first parameter to '\handler'. .macro CALL_WITH_CONTEXT handler +__vector_\handler: // Make room on the stack for the exception context. sub sp, sp, #16 * 17 @@ -47,6 +48,9 @@ // After returning from exception handling code, replay the saved context and return via // `eret`. b __exception_restore_context + +.size __vector_\handler, . - __vector_\handler +.type __vector_\handler, function .endm .macro FIQ_SUSPEND diff --git a/16_virtual_mem_part4_higher_half_kernel/kernel/src/lib.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/lib.rs index 5ecc3a71..c9c03792 100644 --- a/16_virtual_mem_part4_higher_half_kernel/kernel/src/lib.rs +++ b/16_virtual_mem_part4_higher_half_kernel/kernel/src/lib.rs @@ -3,7 +3,9 @@ // Copyright (c) 2018-2022 Andre Richter // Rust embedded logo for `make doc`. -#![doc(html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png")] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png" +)] //! The `kernel` library. //! diff --git a/16_virtual_mem_part4_higher_half_kernel/kernel/src/main.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/main.rs index c0c18818..5150f3af 100644 --- a/16_virtual_mem_part4_higher_half_kernel/kernel/src/main.rs +++ b/16_virtual_mem_part4_higher_half_kernel/kernel/src/main.rs @@ -3,7 +3,9 @@ // Copyright (c) 2018-2022 Andre Richter // Rust embedded logo for `make doc`. -#![doc(html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png")] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png" +)] //! The `kernel` binary. diff --git a/17_kernel_symbols/Makefile b/17_kernel_symbols/Makefile index 1e9282a2..41cecae3 100644 --- a/17_kernel_symbols/Makefile +++ b/17_kernel_symbols/Makefile @@ -124,7 +124,6 @@ COMPILER_ARGS = --target=$(TARGET) \ RUSTC_CMD = cargo rustc $(COMPILER_ARGS) --manifest-path $(KERNEL_MANIFEST) DOC_CMD = cargo doc $(COMPILER_ARGS) CLIPPY_CMD = cargo clippy $(COMPILER_ARGS) -CHECK_CMD = cargo check $(COMPILER_ARGS) TEST_CMD = cargo test $(COMPILER_ARGS) --manifest-path $(KERNEL_MANIFEST) OBJCOPY_CMD = rust-objcopy \ --strip-all \ @@ -354,7 +353,7 @@ define KERNEL_TEST_RUNNER # started by the same. KERNEL_SYMBOLS_INPUT_ELF=$$TEST_ELF \ KERNEL_SYMBOLS_OUTPUT_ELF=$$TEST_ELF_SYMS \ - $(MAKE) --no-print-directory -f kernel_symbols.mk > /dev/null 2>&1 + $(MAKE) --no-print-directory -f kernel_symbols.mk > /dev/null 2>&1 $(OBJCOPY_CMD) $$TEST_ELF_SYMS $$TEST_BINARY $(DOCKER_TEST) $(EXEC_TEST_DISPATCH) $(EXEC_QEMU) $(QEMU_TEST_ARGS) -kernel $$TEST_BINARY diff --git a/17_kernel_symbols/README.md b/17_kernel_symbols/README.md index 72428c23..897e38cd 100644 --- a/17_kernel_symbols/README.md +++ b/17_kernel_symbols/README.md @@ -49,9 +49,6 @@ pub struct Symbol { } ``` -The implementation of the struct furthermore defines the two public functions `name()` and -`contains()`, which will be used to query information. - To enable the kernel to lookup symbol names, we will add an `array` to the kernel binary that contains all the kernel symbols. Because we can query the final symbol names and addresses only _after_ the kernel has been `linked`, the same approach as for the `translation tables` will be @@ -184,11 +181,11 @@ fn kernel_symbols_slice() -> &'static [Symbol] { Lookup is done by just iterating over the slice: ```rust -/// Retrieve the symbol name corresponding to a virtual address, if any. -pub fn lookup_symbol(addr: Address) -> Option<&'static str> { +/// Retrieve the symbol corresponding to a virtual address, if any. +pub fn lookup_symbol(addr: Address) -> Option<&'static Symbol> { for i in kernel_symbols_slice() { if i.contains(addr.as_usize()) { - return Some(i.name()); + return Some(i); } } @@ -277,15 +274,17 @@ diff -uNr 16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/excep use core::{arch::global_asm, cell::UnsafeCell, fmt}; use cortex_a::{asm::barrier, registers::*}; use tock_registers::{ -@@ -262,6 +262,12 @@ +@@ -262,6 +262,14 @@ writeln!(f, "{}", self.spsr_el1)?; writeln!(f, "ELR_EL1: {:#018x}", self.elr_el1)?; + writeln!( + f, + " Symbol: {}", -+ symbols::lookup_symbol(memory::Address::new(self.elr_el1 as usize)) -+ .unwrap_or("Symbol not found") ++ match symbols::lookup_symbol(memory::Address::new(self.elr_el1 as usize)) { ++ Some(sym) => sym.name(), ++ _ => "Symbol not found", ++ } + )?; writeln!(f)?; writeln!(f, "General purpose register:")?; @@ -333,7 +332,7 @@ diff -uNr 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi/mem diff -uNr 16_virtual_mem_part4_higher_half_kernel/kernel/src/lib.rs 17_kernel_symbols/kernel/src/lib.rs --- 16_virtual_mem_part4_higher_half_kernel/kernel/src/lib.rs +++ 17_kernel_symbols/kernel/src/lib.rs -@@ -135,6 +135,7 @@ +@@ -137,6 +137,7 @@ pub mod memory; pub mod print; pub mod state; @@ -345,7 +344,7 @@ diff -uNr 16_virtual_mem_part4_higher_half_kernel/kernel/src/lib.rs 17_kernel_sy diff -uNr 16_virtual_mem_part4_higher_half_kernel/kernel/src/symbols.rs 17_kernel_symbols/kernel/src/symbols.rs --- 16_virtual_mem_part4_higher_half_kernel/kernel/src/symbols.rs +++ 17_kernel_symbols/kernel/src/symbols.rs -@@ -0,0 +1,85 @@ +@@ -0,0 +1,87 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// +// Copyright (c) 2022 Andre Richter @@ -395,11 +394,11 @@ diff -uNr 16_virtual_mem_part4_higher_half_kernel/kernel/src/symbols.rs 17_kerne +// Public Code +//-------------------------------------------------------------------------------------------------- + -+/// Retrieve the symbol name corresponding to a virtual address, if any. -+pub fn lookup_symbol(addr: Address) -> Option<&'static str> { ++/// Retrieve the symbol corresponding to a virtual address, if any. ++pub fn lookup_symbol(addr: Address) -> Option<&'static Symbol> { + for i in kernel_symbols_slice() { + if i.contains(addr.as_usize()) { -+ return Some(i.name()); ++ return Some(i); + } + } + @@ -421,12 +420,14 @@ diff -uNr 16_virtual_mem_part4_higher_half_kernel/kernel/src/symbols.rs 17_kerne + let first_sym = lookup_symbol(Address::new( + crate::common::is_aligned as *const usize as usize, + )) -+ .unwrap(); ++ .unwrap() ++ .name(); + + assert_eq!(first_sym, "libkernel::common::is_aligned"); + -+ let second_sym = -+ lookup_symbol(Address::new(crate::version as *const usize as usize)).unwrap(); ++ let second_sym = lookup_symbol(Address::new(crate::version as *const usize as usize)) ++ .unwrap() ++ .name(); + + assert_eq!(second_sym, "libkernel::version"); + } @@ -515,7 +516,7 @@ diff -uNr 16_virtual_mem_part4_higher_half_kernel/kernel_symbols/src/main.rs 17_ diff -uNr 16_virtual_mem_part4_higher_half_kernel/kernel_symbols.mk 17_kernel_symbols/kernel_symbols.mk --- 16_virtual_mem_part4_higher_half_kernel/kernel_symbols.mk +++ 17_kernel_symbols/kernel_symbols.mk -@@ -0,0 +1,101 @@ +@@ -0,0 +1,103 @@ +## SPDX-License-Identifier: MIT OR Apache-2.0 +## +## Copyright (c) 2018-2022 Andre Richter @@ -617,6 +618,8 @@ diff -uNr 16_virtual_mem_part4_higher_half_kernel/kernel_symbols.mk 17_kernel_sy + + @$(DOCKER_TOOLS) $(EXEC_SYMBOLS_TOOL) --patch_data $(KERNEL_SYMBOLS_OUTPUT_ELF) \ + $(KERNEL_SYMBOLS_STRIPPED) ++ ++ $(call color_progress_prefix, "Finished") diff -uNr 16_virtual_mem_part4_higher_half_kernel/libraries/debug-symbol-types/Cargo.toml 17_kernel_symbols/libraries/debug-symbol-types/Cargo.toml --- 16_virtual_mem_part4_higher_half_kernel/libraries/debug-symbol-types/Cargo.toml @@ -630,7 +633,7 @@ diff -uNr 16_virtual_mem_part4_higher_half_kernel/libraries/debug-symbol-types/C diff -uNr 16_virtual_mem_part4_higher_half_kernel/libraries/debug-symbol-types/src/lib.rs 17_kernel_symbols/libraries/debug-symbol-types/src/lib.rs --- 16_virtual_mem_part4_higher_half_kernel/libraries/debug-symbol-types/src/lib.rs +++ 17_kernel_symbols/libraries/debug-symbol-types/src/lib.rs -@@ -0,0 +1,39 @@ +@@ -0,0 +1,45 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// +// Copyright (c) 2022 Andre Richter @@ -643,6 +646,7 @@ diff -uNr 16_virtual_mem_part4_higher_half_kernel/libraries/debug-symbol-types/s + +/// A symbol containing a size. +#[repr(C)] ++#[derive(Clone)] +pub struct Symbol { + addr_range: Range, + name: &'static str, @@ -669,6 +673,11 @@ diff -uNr 16_virtual_mem_part4_higher_half_kernel/libraries/debug-symbol-types/s + pub fn name(&self) -> &'static str { + self.name + } ++ ++ /// Returns the symbol's size. ++ pub fn size(&self) -> usize { ++ self.addr_range.end - self.addr_range.start ++ } +} diff -uNr 16_virtual_mem_part4_higher_half_kernel/Makefile 17_kernel_symbols/Makefile @@ -700,7 +709,7 @@ diff -uNr 16_virtual_mem_part4_higher_half_kernel/Makefile 17_kernel_symbols/Mak -@@ -178,11 +195,18 @@ +@@ -177,11 +194,19 @@ @$(DOCKER_TOOLS) $(EXEC_TT_TOOL) $(BSP) $(KERNEL_ELF_TTABLES) ##------------------------------------------------------------------------------ @@ -708,7 +717,8 @@ diff -uNr 16_virtual_mem_part4_higher_half_kernel/Makefile 17_kernel_symbols/Mak +##------------------------------------------------------------------------------ +$(KERNEL_ELF_TTABLES_SYMS): $(KERNEL_ELF_TTABLES_SYMS_DEPS) + $(call color_header, "Generating kernel symbols and patching kernel ELF") -+ @$(MAKE) --no-print-directory -f kernel_symbols.mk ++ @time -f "in moduloes" \ ++ $(MAKE) --no-print-directory -f kernel_symbols.mk + +##------------------------------------------------------------------------------ ## Generate the stripped kernel binary @@ -721,7 +731,7 @@ diff -uNr 16_virtual_mem_part4_higher_half_kernel/Makefile 17_kernel_symbols/Mak $(call color_progress_prefix, "Name") @echo $(KERNEL_BIN) $(call color_progress_prefix, "Size") -@@ -319,10 +343,19 @@ +@@ -318,10 +343,19 @@ cd $(shell pwd) TEST_ELF=$$(echo $$1 | sed -e 's/.*target/target/g') @@ -736,7 +746,7 @@ diff -uNr 16_virtual_mem_part4_higher_half_kernel/Makefile 17_kernel_symbols/Mak + # started by the same. + KERNEL_SYMBOLS_INPUT_ELF=$$TEST_ELF \ + KERNEL_SYMBOLS_OUTPUT_ELF=$$TEST_ELF_SYMS \ -+ $(MAKE) --no-print-directory -f kernel_symbols.mk ++ $(MAKE) --no-print-directory -f kernel_symbols.mk > /dev/null 2>&1 + + $(OBJCOPY_CMD) $$TEST_ELF_SYMS $$TEST_BINARY $(DOCKER_TEST) $(EXEC_TEST_DISPATCH) $(EXEC_QEMU) $(QEMU_TEST_ARGS) -kernel $$TEST_BINARY diff --git a/17_kernel_symbols/kernel/src/_arch/aarch64/exception.rs b/17_kernel_symbols/kernel/src/_arch/aarch64/exception.rs index 3515d956..6781758a 100644 --- a/17_kernel_symbols/kernel/src/_arch/aarch64/exception.rs +++ b/17_kernel_symbols/kernel/src/_arch/aarch64/exception.rs @@ -46,7 +46,7 @@ struct ExceptionContext { /// Saved program status. spsr_el1: SpsrEL1, - // Exception syndrome register. + /// Exception syndrome register. esr_el1: EsrEL1, } @@ -265,8 +265,10 @@ impl fmt::Display for ExceptionContext { writeln!( f, " Symbol: {}", - symbols::lookup_symbol(memory::Address::new(self.elr_el1 as usize)) - .unwrap_or("Symbol not found") + match symbols::lookup_symbol(memory::Address::new(self.elr_el1 as usize)) { + Some(sym) => sym.name(), + _ => "Symbol not found", + } )?; writeln!(f)?; writeln!(f, "General purpose register:")?; diff --git a/17_kernel_symbols/kernel/src/_arch/aarch64/exception.s b/17_kernel_symbols/kernel/src/_arch/aarch64/exception.s index 5aae30b9..91805ee7 100644 --- a/17_kernel_symbols/kernel/src/_arch/aarch64/exception.s +++ b/17_kernel_symbols/kernel/src/_arch/aarch64/exception.s @@ -9,6 +9,7 @@ /// Call the function provided by parameter `\handler` after saving the exception context. Provide /// the context as the first parameter to '\handler'. .macro CALL_WITH_CONTEXT handler +__vector_\handler: // Make room on the stack for the exception context. sub sp, sp, #16 * 17 @@ -47,6 +48,9 @@ // After returning from exception handling code, replay the saved context and return via // `eret`. b __exception_restore_context + +.size __vector_\handler, . - __vector_\handler +.type __vector_\handler, function .endm .macro FIQ_SUSPEND diff --git a/17_kernel_symbols/kernel/src/lib.rs b/17_kernel_symbols/kernel/src/lib.rs index 68f7e874..8e38ad6f 100644 --- a/17_kernel_symbols/kernel/src/lib.rs +++ b/17_kernel_symbols/kernel/src/lib.rs @@ -3,7 +3,9 @@ // Copyright (c) 2018-2022 Andre Richter // Rust embedded logo for `make doc`. -#![doc(html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png")] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png" +)] //! The `kernel` library. //! diff --git a/17_kernel_symbols/kernel/src/main.rs b/17_kernel_symbols/kernel/src/main.rs index c0c18818..5150f3af 100644 --- a/17_kernel_symbols/kernel/src/main.rs +++ b/17_kernel_symbols/kernel/src/main.rs @@ -3,7 +3,9 @@ // Copyright (c) 2018-2022 Andre Richter // Rust embedded logo for `make doc`. -#![doc(html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png")] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png" +)] //! The `kernel` binary. diff --git a/17_kernel_symbols/kernel/src/symbols.rs b/17_kernel_symbols/kernel/src/symbols.rs index bde40a60..22001389 100644 --- a/17_kernel_symbols/kernel/src/symbols.rs +++ b/17_kernel_symbols/kernel/src/symbols.rs @@ -47,11 +47,11 @@ fn kernel_symbols_slice() -> &'static [Symbol] { // Public Code //-------------------------------------------------------------------------------------------------- -/// Retrieve the symbol name corresponding to a virtual address, if any. -pub fn lookup_symbol(addr: Address) -> Option<&'static str> { +/// Retrieve the symbol corresponding to a virtual address, if any. +pub fn lookup_symbol(addr: Address) -> Option<&'static Symbol> { for i in kernel_symbols_slice() { if i.contains(addr.as_usize()) { - return Some(i.name()); + return Some(i); } } @@ -73,12 +73,14 @@ mod tests { let first_sym = lookup_symbol(Address::new( crate::common::is_aligned as *const usize as usize, )) - .unwrap(); + .unwrap() + .name(); assert_eq!(first_sym, "libkernel::common::is_aligned"); - let second_sym = - lookup_symbol(Address::new(crate::version as *const usize as usize)).unwrap(); + let second_sym = lookup_symbol(Address::new(crate::version as *const usize as usize)) + .unwrap() + .name(); assert_eq!(second_sym, "libkernel::version"); } diff --git a/17_kernel_symbols/libraries/debug-symbol-types/src/lib.rs b/17_kernel_symbols/libraries/debug-symbol-types/src/lib.rs index 4c12e86f..b6dff082 100644 --- a/17_kernel_symbols/libraries/debug-symbol-types/src/lib.rs +++ b/17_kernel_symbols/libraries/debug-symbol-types/src/lib.rs @@ -10,6 +10,7 @@ use core::ops::Range; /// A symbol containing a size. #[repr(C)] +#[derive(Clone)] pub struct Symbol { addr_range: Range, name: &'static str, @@ -36,4 +37,9 @@ impl Symbol { pub fn name(&self) -> &'static str { self.name } + + /// Returns the symbol's size. + pub fn size(&self) -> usize { + self.addr_range.end - self.addr_range.start + } } diff --git a/X1_JTAG_boot/Makefile b/X1_JTAG_boot/Makefile index d5395011..a497ad81 100644 --- a/X1_JTAG_boot/Makefile +++ b/X1_JTAG_boot/Makefile @@ -84,7 +84,6 @@ COMPILER_ARGS = --target=$(TARGET) \ RUSTC_CMD = cargo rustc $(COMPILER_ARGS) DOC_CMD = cargo doc $(COMPILER_ARGS) CLIPPY_CMD = cargo clippy $(COMPILER_ARGS) -CHECK_CMD = cargo check $(COMPILER_ARGS) OBJCOPY_CMD = rust-objcopy \ --strip-all \ -O binary diff --git a/X1_JTAG_boot/src/main.rs b/X1_JTAG_boot/src/main.rs index d2f9dbde..0502e1c9 100644 --- a/X1_JTAG_boot/src/main.rs +++ b/X1_JTAG_boot/src/main.rs @@ -3,7 +3,9 @@ // Copyright (c) 2018-2022 Andre Richter // Rust embedded logo for `make doc`. -#![doc(html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png")] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png" +)] //! The `kernel` binary. //!