Expand description
Support for in-kernel debugging.
For printing, this module uses an internal buffer to write the strings into.
If you are writing and the buffer fills up, you can make the size of
output_buffer
larger.
Before debug interfaces can be used, the board file must assign them hardware:
ⓘ
kernel::debug::assign_gpios(
Some(&sam4l::gpio::PA[13]),
Some(&sam4l::gpio::PA[15]),
None,
);
components::debug_writer::DebugWriterComponent::new(uart_mux)
.finalize(components::debug_writer_component_static!());
The debug queue is optional, if not set in the board it is just ignored. You can add one in the board file as follows:
ⓘ
components::debug_queue::DebugQueueComponent::new()
.finalize(components::debug_queue_component_static!());
§Example
debug!("Yes the code gets here with value {}", i);
debug_verbose!("got here"); // Includes message count, file, and line.
debug_gpio!(0, toggle); // Toggles the first debug GPIO.
debug_enqueue!("foo"); // Adds some message to the debug queue.
debug_flush_queue!(); // Flushes the queue, writing "foo".
debug_enqueue!("bar");
panic!("42"); // Flushes the queue, writing "bar" in the debug queue section
// of the panic diagnostic.
Yes the code gets here with value 42
TOCK_DEBUG(0): /tock/capsules/src/sensys.rs:24: got here
Structs§
- Queue to hold debug strings.
- Wrapper type that we need a mutable reference to for the
core::fmt::Write
interface. - Main type that we share with the UART provider and this debug module.
- Wrapper type that we need a mutable reference to for the
core::fmt::Write
interface.
Statics§
- Object to hold the assigned debugging GPIOs.
Traits§
- Implementation of
std::io::Write
forno_std
.
Functions§
- Map up to three GPIO pins to use for debugging.
- Return how many bytes are remaining in the internal debug buffer.
- Add a format string to the debug queue.
- Flush the debug queue by writing to the underlying writer implementation.
- Write a debug message without a trailing newline.
- Write a debug message with a trailing newline.
- Write a
ReadableProcessSlice
to the debug output. - Write a debug message with file and line information without a trailing newline.
- Write a debug message with file and line information with a trailing newline.
- Flush any stored messages to the output writer.
- Tock default panic routine.
- Lightweight prints about the current panic and kernel version.
- Generic panic entry.
- Blinks a recognizable pattern forever.
- Print current machine (CPU) state.
- Tock panic routine, without the infinite LED-blinking loop.
- More detailed prints about all processes.
- Function used by board main.rs to set a reference to the debug queue.
- Function used by board main.rs to set a reference to the writer.