forked from M-Labs/zynq-rs
1
0
Fork 0

fix SP init

This commit is contained in:
Astro 2019-05-20 01:21:22 +02:00
parent b754581452
commit c88374eab1
1 changed files with 9 additions and 6 deletions

View File

@ -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();