Skip to content

[sw,dv] Add SW-DV logging#600

Open
martin-velay wants to merge 4 commits into
lowRISC:mainfrom
martin-velay:sw_dv_log
Open

[sw,dv] Add SW-DV logging#600
martin-velay wants to merge 4 commits into
lowRISC:mainfrom
martin-velay:sw_dv_log

Conversation

@martin-velay
Copy link
Copy Markdown
Contributor

Related to this issue: #261

Signed-off-by: martin-velay <mvelay@lowrisc.org>
Signed-off-by: martin-velay <mvelay@lowrisc.org>
The upstream script assumes a 32-bit struct layout (5×uint32, 20 B, LONG
header). Mocha's rv64 log_fields_t uses 8-byte const char * pointer
fields, giving a 32-byte struct and an 8-byte QUAD section-address
header.

Add a patch that detects the ELF class at runtime and selects the
correct header format, entry size, and unpack string accordingly.

Wire the script into build_sw_collateral_for_sim.py so each
CMake install step produces the .logs.txt and .rodata.txt files
that sw_logger_if needs at simulation start.

Signed-off-by: martin-velay <mvelay@lowrisc.org>
Each call site places a log_fields_t entry in a new .logs.fields ELF
section; extract_sw_logs.py produces the database consumed by
sw_logger_if to decode printf-style messages at simulation start, with
no UART overhead.

Add mocha_system_dv_log() to the HAL for CHERI-safe access to the log
write port (0x2002_0008). Add the .logs.fields section to the linker
script after .rodata so string constants are resolved before log entries
are laid out. Add dv_log.h/c implementing the DV_LOG_INFO/WARNING/ERROR/
FATAL macros and the runtime dv_log_write() function. Add
dv_log_smoketest to verify the end-to-end path.

Signed-off-by: martin-velay <mvelay@lowrisc.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant