tinyboot_ch32_hal/flash/mod.rs
1#[cfg_attr(flash_v0, path = "v0.rs")]
2#[cfg_attr(flash_v1, path = "v1.rs")]
3mod family;
4
5pub use family::*;
6
7/// Boot metadata address (ORIGIN of META region).
8/// Defined by `__tb_meta_base` in tb-boot.x / tb-app.x.
9#[inline(always)]
10pub fn meta_addr() -> u32 {
11 unsafe extern "C" {
12 static __tb_meta_base: u8;
13 }
14 unsafe { &__tb_meta_base as *const u8 as u32 }
15}
16
17/// App region base address (ORIGIN of APP region).
18/// Defined by `__tb_app_base` in tb-boot.x.
19#[inline(always)]
20pub fn app_base() -> u32 {
21 unsafe extern "C" {
22 static __tb_app_base: u8;
23 }
24 unsafe { &__tb_app_base as *const u8 as u32 }
25}