From ce7a8665a33c97c5e3e933d1922dc4343ff2a03c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 24 Sep 2024 10:21:23 +0200 Subject: [PATCH] bootloader addr corrections --- bootloader/src/main.rs | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/bootloader/src/main.rs b/bootloader/src/main.rs index 0f352db..a10ed7c 100644 --- a/bootloader/src/main.rs +++ b/bootloader/src/main.rs @@ -35,23 +35,30 @@ const CLOCK_FREQ: Hertz = Hertz::from_raw(50_000_000); // Important bootloader addresses and offsets, vector table information. +const NVM_SIZE: u32 = 0x20000; const BOOTLOADER_START_ADDR: u32 = 0x0; const BOOTLOADER_CRC_ADDR: u32 = BOOTLOADER_END_ADDR - 2; // This is also the maximum size of the bootloader. const BOOTLOADER_END_ADDR: u32 = 0x3000; const APP_A_START_ADDR: u32 = BOOTLOADER_END_ADDR; -const APP_A_SIZE_ADDR: u32 = APP_A_END_ADDR - 8; // 0x117F8 - // Four bytes reserved, even when only 2 byte CRC is used. Leaves flexibility to switch to CRC32. -const APP_A_CRC_ADDR: u32 = APP_A_END_ADDR - 4; // 0x117FC -pub const APP_A_END_ADDR: u32 = APP_B_END_ADDR - BOOTLOADER_END_ADDR / 2; // 0x11800 - // The actual size of the image which is relevant for CRC calculation. +// 0x117F8 +const APP_A_SIZE_ADDR: u32 = APP_A_END_ADDR - 8; +// Four bytes reserved, even when only 2 byte CRC is used. Leaves flexibility to switch to CRC32. +// 0x117FC +const APP_A_CRC_ADDR: u32 = APP_A_END_ADDR - 4; +// 0x11800 +pub const APP_A_END_ADDR: u32 = APP_B_END_ADDR - BOOTLOADER_END_ADDR / 2; +// The actual size of the image which is relevant for CRC calculation. const APP_B_START_ADDR: u32 = APP_A_END_ADDR; // The actual size of the image which is relevant for CRC calculation. -const APP_B_SIZE_ADDR: u32 = APP_B_END_ADDR - 8; // 0x1FFF8 - // Four bytes reserved, even when only 2 byte CRC is used. Leaves flexibility to switch to CRC32. -const APP_B_CRC_ADDR: u32 = APP_B_END_ADDR - 4; // 0x1FFFC -pub const APP_B_END_ADDR: u32 = 0x20000; -pub const APP_IMG_SZ: u32 = APP_B_END_ADDR - APP_A_END_ADDR / 2; +// 0x1FFF8 +const APP_B_SIZE_ADDR: u32 = APP_B_END_ADDR - 8; +// Four bytes reserved, even when only 2 byte CRC is used. Leaves flexibility to switch to CRC32. +// 0x1FFFC +const APP_B_CRC_ADDR: u32 = APP_B_END_ADDR - 4; +// 0x20000 +pub const APP_B_END_ADDR: u32 = NVM_SIZE; +pub const APP_IMG_SZ: u32 = (APP_B_END_ADDR - APP_A_START_ADDR) / 2; static_assertions::const_assert!((APP_B_END_ADDR - BOOTLOADER_END_ADDR) % 2 == 0);