|
PebbleOS v4.47.0-1161-g94e3d98da
|
Channels in RAM that a debug probe reads and writes over SWD while the target runs. More...
Functions | |
| void | pbl_rtt_init (void) |
| Set the control block up, if not done yet. | |
| size_t | pbl_rtt_write (unsigned int ch, const void *data, size_t len) |
| Write to an up channel. | |
| size_t | pbl_rtt_read (unsigned int ch, void *data, size_t len) |
| Read from a down channel. | |
| bool | pbl_rtt_flush (unsigned int ch, uint32_t timeout_us) |
| Wait for a probe to read what was written to an up channel. | |
Channels in RAM that a debug probe reads and writes over SWD while the target runs.
The control block is the global _SEGGER_RTT, which debug probes find by that symbol in the ELF. It holds CONFIG_RTT_NUM_UP channels from the target to the probe and CONFIG_RTT_NUM_DOWN back, each with a buffer of CONFIG_RTT_UP_SIZE or CONFIG_RTT_DOWN_SIZE bytes. Channel 0 is the terminal by convention.
Nothing waits for a probe: a write that does not fit is dropped whole, as RTT's NO_BLOCK_SKIP mode does. Only pbl_rtt_flush() waits, and only for a probe seen reading the channel. The functions take the kernel lock, so they also run before the kernel and from a fault handler, but not from a zero-latency interrupt.
The probe reads the RAM behind any data cache, so with one the control block and the buffers are in the kernel's non-cacheable section (PBL_NOCACHE).
| bool pbl_rtt_flush | ( | unsigned int | ch, |
| uint32_t | timeout_us | ||
| ) |
Wait for a probe to read what was written to an up channel.
Returns at once unless a probe was seen reading the channel. A probe that does not catch up within timeout_us counts as gone until it reads again, so later flushes do not wait.
| ch | Up channel. |
| timeout_us | Longest wait, in microseconds. |
| void pbl_rtt_init | ( | void | ) |
Set the control block up, if not done yet.
The other functions do it too; this lets a probe find the block before anything is written.
| size_t pbl_rtt_read | ( | unsigned int | ch, |
| void * | data, | ||
| size_t | len | ||
| ) |
Read from a down channel.
| ch | Down channel. | |
| [out] | data | Bytes read. |
| len | Most bytes to read. |
ch does not exist. | size_t pbl_rtt_write | ( | unsigned int | ch, |
| const void * | data, | ||
| size_t | len | ||
| ) |
Write to an up channel.
| ch | Up channel. |
| data | Bytes to write. |
| len | Number of bytes. |
len, or 0 when they do not all fit, or ch does not exist, and nothing is written.