|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Emulator text-console surfaces: UART echo, ITM/SWO echo, escapes. More...
Go to the source code of this file.
Enumerations | |
| enum | itm_addr_t : uint64_t { k_itm_stim0_addr = 0xE0000000UL , k_itm_tcr_addr = 0xE0000E80UL , k_itm_tenr_addr = 0xE0000E00UL , k_scb_demcr_addr = 0xE000EDFCUL , k_sau_type_addr = 0xE000EDD4UL , k_ns_sram2_base = 0x32100000UL , k_ns_alias_bit = 0x10000000UL } |
| ITM / debug PPB addresses and TrustZone alias constants. More... | |
| enum | itm_bits_t : uint32_t { k_itm_line_max = 240U , k_itm_tcr_itmena = 0x00000001U , k_itm_tenr_port0 = 0x00000001U , k_itm_stim_ready = 0x00000001U , k_scb_demcr_trcena = 0x01000000U , k_sau_type_regs = 0x00000008U } |
| ITM enable-bit values and line sizing for the stimulus echo. More... | |
| enum | console_cfg_t : uint32_t { k_uart_line_max = 512U } |
| Console-UART presentation sizing. More... | |
Functions | |
| void | emu_console_install (uc_engine *uc) |
| Seed ITM "ready" bits and arm the stimulus-port echo hook. | |
| void | console_flush_line (uint8_t channel) |
| Flush the pending [uart] line to injected output sink with its channel prefix. | |
| void | console_tx_sink (uint8_t channel, uint8_t byte) |
| SCI TX sink: print each transmitted byte (prefixed line + raw mirror). | |
| uint32_t | decode_escapes (const char *in, uint8_t *out, uint32_t cap) |
| Decode a C-style escaped –input string into a raw byte buffer. | |
| void | emu_console_reset (void) |
| Reset the in-flight ITM line (warm-reboot support). | |
Emulator text-console surfaces: UART echo, ITM/SWO echo, escapes.
The two text endpoints ra8_emulator surfaces on injected output sink plus the CLI string decoder that feeds them:
Split out of the ra8_emulator main translation unit; behaviour unchanged.
Definition in file emu_console.h.
| enum console_cfg_t : uint32_t |
Console-UART presentation sizing.
Line-buffer capacity for the pretty [uart] SCIn: echo; also the sizing every CLI byte-injection buffer (--input / --keys / --usb-in) borrows.
| Enumerator | |
|---|---|
| k_uart_line_max | Pretty-print line buffer for the [uart] prefix. |
Definition at line 91 of file emu_console.h.
| enum itm_addr_t : uint64_t |
ITM / debug PPB addresses and TrustZone alias constants.
The ITM stimulus/control words the seed-and-echo model touches, the DEMCR trace-enable word (shared with the DWT cycle-counter model), and the SAU / Non-secure-alias constants the TrustZone and memory-map code reads from this same historical group.
Definition at line 48 of file emu_console.h.
| enum itm_bits_t : uint32_t |
ITM enable-bit values and line sizing for the stimulus echo.
The specific bits itm_seed_ready() plants so ra8_log's readiness checks pass, plus the echo line-buffer cap and the SAU region-count seed used by the TrustZone boot path.
Definition at line 70 of file emu_console.h.
| void console_flush_line | ( | uint8_t | channel | ) |
Flush the pending [uart] line to injected output sink with its channel prefix.
Terminates and prints the accumulated line as [uart] SCIn: ...; a no-op when nothing is buffered. The run-end report calls this so bytes emitted without a trailing newline still surface.
| [in] | channel | SCI channel number used in the printed prefix. |
Definition at line 155 of file emu_console.c.
References priv_emu_io_outf(), s_uart_line, and s_uart_line_len.
Referenced by console_tx_sink(), and internal_run_print_stop_summary().
| void console_tx_sink | ( | uint8_t | channel, |
| uint8_t | byte ) |
SCI TX sink: print each transmitted byte (prefixed line + raw mirror).
Installed via board_periph_sci_set_tx_sink(). Printable bytes accumulate into a line that is flushed – with an [uart] SCIn: prefix – on newline or when the buffer fills, so console output reads cleanly in the log; CR is dropped from the pretty line.
| [in] | channel | SCI channel that transmitted the byte. |
| [in] | byte | The transmitted data byte. |
Definition at line 165 of file emu_console.c.
References console_flush_line(), k_uart_line_max, s_uart_line, and s_uart_line_len.
Referenced by internal_main_bringup_peripherals().
| uint32_t decode_escapes | ( | const char * | in, |
| uint8_t * | out, | ||
| uint32_t | cap ) |
Decode a C-style escaped –input string into a raw byte buffer.
Translates \n / \r / \t / \0 / \\ in in so a shell argument can carry the line endings a console example expects (e.g. --input "ping\r\n"); any other character (including an unrecognised escape's backslash) is copied verbatim. Bounded by cap; never overruns.
| [in] | in | NUL-terminated source string. |
| [out] | out | Destination byte buffer. |
| [in] | cap | Capacity of out in bytes. |
out. | 0 | in was empty (or cap was 0). |
in is NUL-terminated and out holds at least cap bytes. cap bounds the write (enforced by the loop condition). cap bytes of out are written. Definition at line 179 of file emu_console.c.
Referenced by internal_main_feed_inputs().
| void emu_console_install | ( | uc_engine * | uc | ) |
Seed ITM "ready" bits and arm the stimulus-port echo hook.
On hardware a debugger sets DEMCR.TRCENA and enables the ITM; with none attached those PPB registers read zero and ra8_log drops every byte. ra8_emulator maps the PPB as plain RAM, so this writes the enable bits (DEMCR.TRCENA, ITM TCR.ITMENA, TENR port-0, a ready STIM0) and installs the UC_HOOK_MEM_WRITE echo on the STIM0 word so each emitted line prints as [itm] <line> and lands on the board_console ITM channel. The firmware only ever reads these registers, so the seed persists for the run.
| [in,out] | uc | Initialised Unicorn engine with the PPB region mapped. |
uc has the PPB region (0xE0000000) mapped as RAM. Seed ITM "ready" bits and arm the stimulus-port echo hook.
Definition at line 142 of file emu_console.c.
References internal_itm_seed_ready(), internal_on_itm_stim_write(), and k_itm_stim0_addr.
Referenced by internal_main_install_core_seams().
| void emu_console_reset | ( | void | ) |
Reset the in-flight ITM line (warm-reboot support).
Drops any partially-assembled [itm] line so a rebooted firmware starts with a clean stimulus stream; the multi-channel board_console store is reset separately by the reboot path.
Reset the in-flight ITM line (warm-reboot support).
Definition at line 211 of file emu_console.c.
References s_itm_len.
Referenced by warm_reboot().