1use core::panic::PanicInfo;
6use kernel::debug;
7use kernel::hil::gpio;
8use kernel::hil::led;
9
10#[cfg(not(test))]
12#[panic_handler]
13pub unsafe fn panic_fmt(pi: &PanicInfo) -> ! {
14 let led_green = &sifive::gpio::GpioPin::new(
16 arty_e21_chip::gpio::GPIO0_BASE,
17 sifive::gpio::pins::pin1,
18 sifive::gpio::pins::pin1::SET,
19 sifive::gpio::pins::pin1::CLEAR,
20 );
21 gpio::Configure::make_output(led_green);
22 gpio::Output::clear(led_green);
23
24 let led_blue = &sifive::gpio::GpioPin::new(
25 arty_e21_chip::gpio::GPIO0_BASE,
26 sifive::gpio::pins::pin0,
27 sifive::gpio::pins::pin0::SET,
28 sifive::gpio::pins::pin0::CLEAR,
29 );
30 gpio::Configure::make_output(led_blue);
31 gpio::Output::clear(led_blue);
32
33 let led_red_pin = &mut sifive::gpio::GpioPin::new(
34 arty_e21_chip::gpio::GPIO0_BASE,
35 sifive::gpio::pins::pin2,
36 sifive::gpio::pins::pin2::SET,
37 sifive::gpio::pins::pin2::CLEAR,
38 );
39
40 let led_red = &mut led::LedHigh::new(led_red_pin);
41
42 debug::panic::<_, sifive::uart::Uart, _, _>(
43 &mut [led_red],
44 sifive::uart::UartPanicWriterConfig {
45 registers: arty_e21_chip::uart::UART0_BASE,
46 clock_frequency: 32_000_000,
47 params: kernel::hil::uart::Parameters {
48 baud_rate: 115200,
49 stop_bits: kernel::hil::uart::StopBits::One,
50 parity: kernel::hil::uart::Parity::None,
51 hw_flow_control: false,
52 width: kernel::hil::uart::Width::Eight,
53 },
54 },
55 pi,
56 &rv32i::support::nop,
57 crate::PANIC_RESOURCES.get(),
58 )
59}