Skip to main content

StartupCode

Struct StartupCode 

Source
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: u32

Stack top address

§entry_point: u32

Entry point (main function)

§data_start: u32

Data section start (in RAM)

§data_end: u32

Data section end (in RAM)

§data_load: u32

Data load address (in flash)

§bss_start: u32

BSS section start

§bss_end: u32

BSS section end

§enable_fpu: bool

Enable FPU (set CPACR for CP10+CP11 full access)

§memory_size: u32

Linear memory size in bytes (stored in R10 for memory.size)

Implementations§

Source§

impl StartupCode

Source

pub fn minimal(entry_point: u32) -> Self

Create minimal startup that just jumps to entry point

Source

pub fn generate_thumb(&self) -> Vec<u8>

Generate Thumb-2 startup code (reset handler)

This generates minimal startup code that:

  1. Optionally enables FPU (CPACR setup for CP10+CP11)
  2. Sets up the stack pointer (already done by hardware from vector table)
  3. Initializes R11 as linear memory base (0x20000000)
  4. Calls the entry point
  5. Loops forever if entry returns
Source

pub fn generate_default_handler() -> Vec<u8>

Generate a default exception handler (infinite loop)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.