Skip to content

Commit ce7a866

Browse files
committed
bootloader addr corrections
1 parent 784a6d7 commit ce7a866

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

bootloader/src/main.rs

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,30 @@ const CLOCK_FREQ: Hertz = Hertz::from_raw(50_000_000);
3535

3636
// Important bootloader addresses and offsets, vector table information.
3737

38+
const NVM_SIZE: u32 = 0x20000;
3839
const BOOTLOADER_START_ADDR: u32 = 0x0;
3940
const BOOTLOADER_CRC_ADDR: u32 = BOOTLOADER_END_ADDR - 2;
4041
// This is also the maximum size of the bootloader.
4142
const BOOTLOADER_END_ADDR: u32 = 0x3000;
4243
const APP_A_START_ADDR: u32 = BOOTLOADER_END_ADDR;
43-
const APP_A_SIZE_ADDR: u32 = APP_A_END_ADDR - 8; // 0x117F8
44-
// Four bytes reserved, even when only 2 byte CRC is used. Leaves flexibility to switch to CRC32.
45-
const APP_A_CRC_ADDR: u32 = APP_A_END_ADDR - 4; // 0x117FC
46-
pub const APP_A_END_ADDR: u32 = APP_B_END_ADDR - BOOTLOADER_END_ADDR / 2; // 0x11800
47-
// The actual size of the image which is relevant for CRC calculation.
44+
// 0x117F8
45+
const APP_A_SIZE_ADDR: u32 = APP_A_END_ADDR - 8;
46+
// Four bytes reserved, even when only 2 byte CRC is used. Leaves flexibility to switch to CRC32.
47+
// 0x117FC
48+
const APP_A_CRC_ADDR: u32 = APP_A_END_ADDR - 4;
49+
// 0x11800
50+
pub const APP_A_END_ADDR: u32 = APP_B_END_ADDR - BOOTLOADER_END_ADDR / 2;
51+
// The actual size of the image which is relevant for CRC calculation.
4852
const APP_B_START_ADDR: u32 = APP_A_END_ADDR;
4953
// The actual size of the image which is relevant for CRC calculation.
50-
const APP_B_SIZE_ADDR: u32 = APP_B_END_ADDR - 8; // 0x1FFF8
51-
// Four bytes reserved, even when only 2 byte CRC is used. Leaves flexibility to switch to CRC32.
52-
const APP_B_CRC_ADDR: u32 = APP_B_END_ADDR - 4; // 0x1FFFC
53-
pub const APP_B_END_ADDR: u32 = 0x20000;
54-
pub const APP_IMG_SZ: u32 = APP_B_END_ADDR - APP_A_END_ADDR / 2;
54+
// 0x1FFF8
55+
const APP_B_SIZE_ADDR: u32 = APP_B_END_ADDR - 8;
56+
// Four bytes reserved, even when only 2 byte CRC is used. Leaves flexibility to switch to CRC32.
57+
// 0x1FFFC
58+
const APP_B_CRC_ADDR: u32 = APP_B_END_ADDR - 4;
59+
// 0x20000
60+
pub const APP_B_END_ADDR: u32 = NVM_SIZE;
61+
pub const APP_IMG_SZ: u32 = (APP_B_END_ADDR - APP_A_START_ADDR) / 2;
5562

5663
static_assertions::const_assert!((APP_B_END_ADDR - BOOTLOADER_END_ADDR) % 2 == 0);
5764

0 commit comments

Comments
 (0)