pub struct StartupCode {
pub stack_top: u32,
pub entry_point: u32,
pub data_start: u32,
pub data_end: u32,
pub data_load: u32,
pub bss_start: u32,
pub bss_end: u32,
pub enable_fpu: bool,
pub memory_size: u32,
}Expand description
Cortex-M startup code generator
Fields§
§stack_top: u32Stack top address
entry_point: u32Entry point (main function)
data_start: u32Data section start (in RAM)
data_end: u32Data section end (in RAM)
data_load: u32Data load address (in flash)
bss_start: u32BSS section start
bss_end: u32BSS section end
enable_fpu: boolEnable FPU (set CPACR for CP10+CP11 full access)
memory_size: u32Linear memory size in bytes (stored in R10 for memory.size)
Implementations§
Source§impl StartupCode
impl StartupCode
Sourcepub fn generate_thumb(&self) -> Vec<u8> ⓘ
pub fn generate_thumb(&self) -> Vec<u8> ⓘ
Generate Thumb-2 startup code (reset handler)
This generates minimal startup code that:
- Optionally enables FPU (CPACR setup for CP10+CP11)
- Sets up the stack pointer (already done by hardware from vector table)
- Initializes R11 as linear memory base (0x20000000)
- Calls the entry point
- Loops forever if entry returns
Sourcepub fn generate_default_handler() -> Vec<u8> ⓘ
pub fn generate_default_handler() -> Vec<u8> ⓘ
Generate a default exception handler (infinite loop)
Auto Trait Implementations§
impl Freeze for StartupCode
impl RefUnwindSafe for StartupCode
impl Send for StartupCode
impl Sync for StartupCode
impl Unpin for StartupCode
impl UnsafeUnpin for StartupCode
impl UnwindSafe for StartupCode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more