diff --git a/src/main.rs b/src/main.rs index 5302a180..6cc161d6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,15 +29,12 @@ pub unsafe extern "C" fn _boot_cores() -> ! { use cortex_a9::{asm, regs::*}; const CORE_MASK: u32 = 0x3; - // End of OCM RAM - const STACK_START: u32 = 256 << 10; + let stack_start = __end + 4096; match MPIDR.get() & CORE_MASK { 0 => { - SP.set(STACK_START); - zero_bss(&mut __bss_start, &mut __bss_end); - main(); - panic!("return from main"); + SP.set(stack_start); + boot_core0(); } _ => loop { // if not core0, infinitely wait for events @@ -46,6 +43,12 @@ pub unsafe extern "C" fn _boot_cores() -> ! { } } +unsafe fn boot_core0() -> ! { + zero_bss(&mut __bss_start, &mut __bss_end); + main(); + panic!("return from main"); +} + fn main() { let mut uart = Uart::uart0(); writeln!(uart, "Hello World\r").unwrap();