forked from M-Labs/artiq
kasli: light up ERROR LED on panic
This commit is contained in:
parent
4982fde898
commit
b83afedf43
|
@ -530,6 +530,11 @@ pub extern fn abort() {
|
|||
#[no_mangle] // https://github.com/rust-lang/rust/issues/{38281,51647}
|
||||
#[panic_implementation]
|
||||
pub fn panic_fmt(info: &core::panic::PanicInfo) -> ! {
|
||||
#[cfg(has_error_led)]
|
||||
unsafe {
|
||||
board_misoc::csr::error_led::out_write(1);
|
||||
}
|
||||
|
||||
if let Some(location) = info.location() {
|
||||
print!("panic at {}:{}:{}", location.file(), location.line(), location.column());
|
||||
} else {
|
||||
|
|
|
@ -298,6 +298,11 @@ pub fn oom(layout: core::alloc::Layout) -> ! {
|
|||
pub fn panic_impl(info: &core::panic::PanicInfo) -> ! {
|
||||
irq::set_ie(false);
|
||||
|
||||
#[cfg(has_error_led)]
|
||||
unsafe {
|
||||
csr::error_led::out_write(1);
|
||||
}
|
||||
|
||||
if let Some(location) = info.location() {
|
||||
print!("panic at {}:{}:{}", location.file(), location.line(), location.column());
|
||||
} else {
|
||||
|
|
|
@ -648,6 +648,11 @@ pub extern fn abort() {
|
|||
#[no_mangle] // https://github.com/rust-lang/rust/issues/{38281,51647}
|
||||
#[panic_implementation]
|
||||
pub fn panic_fmt(info: &core::panic::PanicInfo) -> ! {
|
||||
#[cfg(has_error_led)]
|
||||
unsafe {
|
||||
csr::error_led::out_write(1);
|
||||
}
|
||||
|
||||
if let Some(location) = info.location() {
|
||||
print!("panic at {}:{}:{}", location.file(), location.line(), location.column());
|
||||
} else {
|
||||
|
|
|
@ -110,9 +110,10 @@ class StandaloneBase(MiniSoC, AMPSoC):
|
|||
AMPSoC.__init__(self)
|
||||
add_identifier(self)
|
||||
|
||||
self.submodules.leds = gpio.GPIOOut(Cat(
|
||||
self.platform.request("user_led", 0)))
|
||||
self.csr_devices.append("leds")
|
||||
if self.platform.hw_rev == "v2.0":
|
||||
self.submodules.error_led = gpio.GPIOOut(Cat(
|
||||
self.platform.request("error_led")))
|
||||
self.csr_devices.append("error_led")
|
||||
|
||||
i2c = self.platform.request("i2c")
|
||||
self.submodules.i2c = gpio.GPIOTristate([i2c.scl, i2c.sda])
|
||||
|
|
Loading…
Reference in New Issue