From b66b60497b2f963606e59ea4ced3f7009ad8ec2f Mon Sep 17 00:00:00 2001 From: bunnie Date: Sun, 22 Dec 2024 00:29:50 +0800 Subject: [PATCH] make the app uart configurable so processes other than swap can use it --- loader/src/platform/cramium/swap.rs | 39 ++++++++++++++++------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/loader/src/platform/cramium/swap.rs b/loader/src/platform/cramium/swap.rs index 1634e7b07..f21fd1a30 100644 --- a/loader/src/platform/cramium/swap.rs +++ b/loader/src/platform/cramium/swap.rs @@ -429,22 +429,25 @@ pub fn userspace_maps(cfg: &mut BootConfig) { udma_uart.write(b"APP UART INIT OK\n\r"); - // map the debug UART HW page - cfg.map_page_32( - root, - // TODO: use PD2/3 AF2 for this UART; set up the IOs for this - utralib::utra::udma_uart_0::HW_UDMA_UART_0_BASE, - SWAP_APP_UART_VADDR, - FLG_R | FLG_W | FLG_U | FLG_VALID, - SWAPPER_PID, - ); - // map the debug UART IFRAM page - cfg.map_page_32( - root, - // TODO: use PD2/3 AF2 for this UART; set up the IOs for this - APP_UART_IFRAM_ADDR, - SWAP_APP_UART_IFRAM_VADDR, - FLG_R | FLG_W | FLG_U | FLG_VALID, - SWAPPER_PID, - ); + #[cfg(feature = "userspace-swap-debug")] + { + // map the debug UART HW page + cfg.map_page_32( + root, + // TODO: use PD2/3 AF2 for this UART; set up the IOs for this + utralib::utra::udma_uart_0::HW_UDMA_UART_0_BASE, + SWAP_APP_UART_VADDR, + FLG_R | FLG_W | FLG_U | FLG_VALID, + SWAPPER_PID, + ); + // map the debug UART IFRAM page + cfg.map_page_32( + root, + // TODO: use PD2/3 AF2 for this UART; set up the IOs for this + APP_UART_IFRAM_ADDR, + SWAP_APP_UART_IFRAM_VADDR, + FLG_R | FLG_W | FLG_U | FLG_VALID, + SWAPPER_PID, + ); + } }