forked from M-Labs/zynq-rs
add static exception handling
This commit is contained in:
parent
b13bf72c17
commit
2df74cc055
14
link.x
14
link.x
|
@ -1,6 +1,14 @@
|
|||
ENTRY(_boot_cores);
|
||||
|
||||
STACK_SIZE = 0x2000 - 0x10;
|
||||
PROVIDE(Reset = _boot_cores);
|
||||
PROVIDE(UndefinedInstruction = Reset);
|
||||
PROVIDE(SoftwareInterrupt = Reset);
|
||||
PROVIDE(PrefetchAbort = Reset);
|
||||
PROVIDE(DataAbort = Reset);
|
||||
PROVIDE(ReservedException = Reset);
|
||||
PROVIDE(IRQ = Reset);
|
||||
PROVIDE(FIQ = Reset);
|
||||
|
||||
MEMORY
|
||||
{
|
||||
|
@ -10,9 +18,13 @@ MEMORY
|
|||
|
||||
SECTIONS
|
||||
{
|
||||
.exceptions :
|
||||
{
|
||||
. = 0x0;
|
||||
KEEP(*(.text.exceptions));
|
||||
} > OCM
|
||||
.text :
|
||||
{
|
||||
/* Starts at LOADER_ADDR. */
|
||||
. = 0x8000;
|
||||
KEEP(*(.text.boot))
|
||||
*(.text .text.*)
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
.section ".text.exceptions"
|
||||
.global exception_vector
|
||||
|
||||
exception_vector:
|
||||
b Reset
|
||||
b UndefinedInstruction
|
||||
b SoftwareInterrupt
|
||||
b PrefetchAbort
|
||||
b DataAbort
|
||||
b ReservedException
|
||||
b IRQ
|
||||
b FIQ
|
|
@ -1,2 +1,4 @@
|
|||
pub mod asm;
|
||||
pub mod regs;
|
||||
|
||||
global_asm!(include_str!("exceptions.s"));
|
||||
|
|
11
src/main.rs
11
src/main.rs
|
@ -1,6 +1,7 @@
|
|||
#![no_std]
|
||||
#![no_main]
|
||||
#![feature(asm)]
|
||||
#![feature(global_asm)]
|
||||
#![feature(naked_functions)]
|
||||
|
||||
use core::fmt::Write;
|
||||
|
@ -94,3 +95,13 @@ fn panic(info: &core::panic::PanicInfo) -> ! {
|
|||
slcr::RegisterBlock::unlocked(|slcr| slcr.soft_reset());
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn PrefetchAbort() {
|
||||
panic!("PrefetchAbort");
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn DataAbort() {
|
||||
panic!("DataAbort");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue