segger

Module rtt

Source
Expand description

Segger RTT implementation.

RTT is a protocol for sending debugging messages to a connected host. The embedded platform configures a portion of memory in a special way, and then the host uses a JTAG connection to read the messages out of the chip’s memory.

§Receiving RTT Messages

With the jlink tools, receiving RTT messages is a two step process. First, open a JTAG connection with a command like:

$ JLinkExe -device nrf52 -if swd -speed 1000 -autoconnect 1

Then, use the JLinkRTTClient tool in a different terminal to print the messages:

$ JLinkRTTClient

§Todo

  • Implement receive functionality.

§Usage

pub struct Platform {
    // Other fields omitted for clarity
    console: &'static capsules::console::Console<'static>,
}

In main():


let virtual_alarm_rtt = static_init!(
    VirtualMuxAlarm<'static, nrf5x::rtc::Rtc>,
    VirtualMuxAlarm::new(mux_alarm)
);
virtual_alarm_rtt.setup();

let rtt_memory = static_init!(
    capsules::segger_rtt::SeggerRttMemory,
    capsules::segger_rtt::SeggerRttMemory::new(b"Terminal\0",
        &mut capsules::segger_rtt::UP_BUFFER,
        b"Terminal\0",
        &mut capsules::segger_rtt::DOWN_BUFFER)
);

let rtt = static_init!(
    capsules::segger_rtt::SeggerRtt<VirtualMuxAlarm<'static, nrf5x::rtc::Rtc>>,
    capsules::segger_rtt::SeggerRtt::new(virtual_alarm_rtt, rtt_memory,
        &mut capsules::segger_rtt::UP_BUFFER,
        &mut capsules::segger_rtt::DOWN_BUFFER)
);
virtual_alarm_rtt.set_client(rtt);

let console = static_init!(
    capsules::console::Console<'static>,
    capsules::console::Console::new(
        rtt,
        &mut capsules::console::WRITE_BUF,
        &mut capsules::console::READ_BUF,
        board_kernel.create_grant(&grant_cap)
    )
);
kernel::hil::uart::UART::set_client(rtt, console);
console.initialize();

Structs§

Constants§