calculate most bootloader properties
This commit is contained in:
parent
051042ad1b
commit
5b336a2b41
@ -11,9 +11,11 @@ panic-rtt-target = { version = "0.1.3" }
|
|||||||
panic-halt = { version = "0.2" }
|
panic-halt = { version = "0.2" }
|
||||||
rtt-target = { version = "0.5" }
|
rtt-target = { version = "0.5" }
|
||||||
crc = "3"
|
crc = "3"
|
||||||
|
static_assertions = "1"
|
||||||
|
|
||||||
[dependencies.va416xx-hal]
|
[dependencies.va416xx-hal]
|
||||||
path = "../va416xx-hal"
|
path = "../va416xx-hal"
|
||||||
|
features = ["va41630"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
|
@ -12,11 +12,11 @@ The bootloader uses the following memory map:
|
|||||||
| 0x0 | Bootloader start | code up to 0x3FFC bytes |
|
| 0x0 | Bootloader start | code up to 0x3FFC bytes |
|
||||||
| 0x3FFC | Bootloader CRC | word |
|
| 0x3FFC | Bootloader CRC | word |
|
||||||
| 0x4000 | App image A start | code up to 0x1DFFC (~120K) bytes |
|
| 0x4000 | App image A start | code up to 0x1DFFC (~120K) bytes |
|
||||||
| 0x21FFC | App image A CRC check length | word |
|
| 0x21FF8 | App image A CRC check length | word |
|
||||||
| 0x21FFE | App image A CRC check value | word |
|
| 0x21FFC | App image A CRC check value | word |
|
||||||
| 0x22000 | App image B start | code up to 0x1DFFC (~120K) bytes |
|
| 0x22000 | App image B start | code up to 0x1DFFC (~120K) bytes |
|
||||||
| 0x3FFFC | App image B CRC check length | word |
|
| 0x3FFF8 | App image B CRC check length | word |
|
||||||
| 0x3FFFE | App image B CRC check value | word |
|
| 0x3FFFC | App image B CRC check value | word |
|
||||||
| 0x40000 | End of NVM | end |
|
| 0x40000 | End of NVM | end |
|
||||||
|
|
||||||
## Additional Information
|
## Additional Information
|
||||||
|
@ -39,20 +39,27 @@ const RTT_PRINTOUT: bool = true;
|
|||||||
|
|
||||||
// Important bootloader addresses and offsets, vector table information.
|
// Important bootloader addresses and offsets, vector table information.
|
||||||
|
|
||||||
|
const NVM_SIZE: u32 = 0x40000;
|
||||||
|
|
||||||
const BOOTLOADER_START_ADDR: u32 = 0x0;
|
const BOOTLOADER_START_ADDR: u32 = 0x0;
|
||||||
|
const BOOTLOADER_CRC_ADDR: u32 = BOOTLOADER_END_ADDR - 4;
|
||||||
const BOOTLOADER_END_ADDR: u32 = 0x4000;
|
const BOOTLOADER_END_ADDR: u32 = 0x4000;
|
||||||
const BOOTLOADER_CRC_ADDR: u32 = 0x3FFC;
|
|
||||||
const APP_A_START_ADDR: u32 = 0x4000;
|
const APP_A_START_ADDR: u32 = BOOTLOADER_END_ADDR; // 0x4000
|
||||||
pub const APP_A_END_ADDR: u32 = 0x22000;
|
|
||||||
// The actual size of the image which is relevant for CRC calculation.
|
// The actual size of the image which is relevant for CRC calculation.
|
||||||
const APP_A_SIZE_ADDR: u32 = 0x21FF8;
|
const APP_A_SIZE_ADDR: u32 = APP_B_END_ADDR - 8; // 0x21FF8
|
||||||
const APP_A_CRC_ADDR: u32 = 0x21FFC;
|
const APP_A_CRC_ADDR: u32 = APP_B_END_ADDR - 4; // 0x21FFC
|
||||||
const APP_B_START_ADDR: u32 = 0x22000;
|
pub const APP_A_END_ADDR: u32 = APP_B_END_ADDR - BOOTLOADER_END_ADDR / 2;
|
||||||
pub const APP_B_END_ADDR: u32 = 0x40000;
|
|
||||||
|
const APP_B_START_ADDR: u32 = APP_A_END_ADDR; // 0x22000
|
||||||
// The actual size of the image which is relevant for CRC calculation.
|
// The actual size of the image which is relevant for CRC calculation.
|
||||||
const APP_B_SIZE_ADDR: u32 = 0x3FFF8;
|
const APP_B_SIZE_ADDR: u32 = APP_B_END_ADDR - 8; // 0x3FFF8
|
||||||
const APP_B_CRC_ADDR: u32 = 0x3FFFC;
|
const APP_B_CRC_ADDR: u32 = APP_B_END_ADDR - 4; // 0x3FFFC
|
||||||
pub const APP_IMG_SZ: u32 = 0x1E000;
|
pub const APP_B_END_ADDR: u32 = NVM_SIZE; // 0x40000
|
||||||
|
|
||||||
|
pub const APP_IMG_SZ: u32 = APP_B_END_ADDR - APP_A_END_ADDR / 2;
|
||||||
|
|
||||||
|
static_assertions::const_assert!((APP_B_END_ADDR - BOOTLOADER_END_ADDR) % 2 == 0);
|
||||||
|
|
||||||
pub const VECTOR_TABLE_OFFSET: u32 = 0x0;
|
pub const VECTOR_TABLE_OFFSET: u32 = 0x0;
|
||||||
pub const VECTOR_TABLE_LEN: u32 = 0x350;
|
pub const VECTOR_TABLE_LEN: u32 = 0x350;
|
||||||
|
@ -7,11 +7,11 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cortex-m-rt = "0.7"
|
cortex-m-rt = "0.7"
|
||||||
va416xx-hal = { path = "../../va416xx-hal" }
|
|
||||||
panic-rtt-target = { version = "0.1.3" }
|
panic-rtt-target = { version = "0.1.3" }
|
||||||
rtt-target = { version = "0.5" }
|
rtt-target = { version = "0.5" }
|
||||||
cortex-m = { version = "0.7", features = ["critical-section-single-core"] }
|
cortex-m = { version = "0.7", features = ["critical-section-single-core"] }
|
||||||
embedded-hal = "1"
|
embedded-hal = "1"
|
||||||
|
va416xx-hal = { path = "../../va416xx-hal", features = ["va41630"] }
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
codegen-units = 1
|
codegen-units = 1
|
||||||
|
@ -7,11 +7,11 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cortex-m-rt = "0.7"
|
cortex-m-rt = "0.7"
|
||||||
va416xx-hal = { path = "../../va416xx-hal" }
|
|
||||||
panic-rtt-target = { version = "0.1.3" }
|
panic-rtt-target = { version = "0.1.3" }
|
||||||
rtt-target = { version = "0.5" }
|
rtt-target = { version = "0.5" }
|
||||||
cortex-m = { version = "0.7", features = ["critical-section-single-core"] }
|
cortex-m = { version = "0.7", features = ["critical-section-single-core"] }
|
||||||
embedded-hal = "1"
|
embedded-hal = "1"
|
||||||
|
va416xx-hal = { path = "../../va416xx-hal", features = ["va41630"] }
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
codegen-units = 1
|
codegen-units = 1
|
||||||
|
Loading…
Reference in New Issue
Block a user