ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_log.h File Reference

Lightweight Logging Interface for ra8-firmware. More...

#include <stdint.h>
Include dependency graph for ra8_log.h:

Go to the source code of this file.

Macros

#define RA8_LOG_LEVEL_NONE   (0)
#define RA8_LOG_LEVEL_ERROR   (1)
 RA8 LOG LEVEL ERROR.
#define RA8_LOG_LEVEL_WARN   (2)
 RA8 LOG LEVEL WARN.
#define RA8_LOG_LEVEL_INFO   (3)
 RA8 LOG LEVEL INFO.
#define RA8_LOG_LEVEL_DEBUG   (4)
 RA8 LOG LEVEL DEBUG.
#define RA8_LOG_LEVEL   RA8_LOG_LEVEL_WARN
 RA8 LOG LEVEL.
#define ra8_log_error(tag, message)
 RA8 log error.
#define ra8_log_error_val(tag, message, value)
 RA8 log error val.
#define ra8_log_warn(tag, message)
 RA8 log warn.
#define ra8_log_warn_val(tag, message, value)
 RA8 log warn val.
#define ra8_log_info(tag, message)
 RA8 log info.
#define ra8_log_info_val(tag, message, value)
 RA8 log info val.
#define ra8_log_debug(tag, message)
 RA8 log debug.
#define ra8_log_debug_val(tag, message, value)
 RA8 log debug val.

Typedefs

typedef void(* ra8_log_byte_sink_fn_t) (void *ctx, uint8_t byte)
 Optional per-byte sink for redirecting log output off ITM.

Enumerations

enum  ra8_log_level_t : uint8_t {
  k_ra8_log_level_none = (0) ,
  k_ra8_log_level_error = (1) ,
  k_ra8_log_level_warn = (2) ,
  k_ra8_log_level_info = (3) ,
  k_ra8_log_level_debug = (4)
}
 Compile-time and runtime log level. More...

Functions

void ra8_log_init (void)
 Initialise the logging backend.
void ra8_log_set_byte_sink (ra8_log_byte_sink_fn_t fn, void *ctx)
 Install (or clear) an optional byte sink for log output.
void ra8_log_emit_error (const char *tag, const char *message)
 Emit an ERROR-level log line with only a tag and a message.
void ra8_log_emit_warn (const char *tag, const char *message)
 Emit a WARN-level log line with only a tag and a message.
void ra8_log_emit_info (const char *tag, const char *message)
 Emit an INFO-level log line with only a tag and a message.
void ra8_log_emit_debug (const char *tag, const char *message)
 Emit a DEBUG-level log line with only a tag and a message.
void ra8_log_emit_error_val (const char *tag, const char *message, uint32_t value)
 Emit an ERROR log line with a uint32_t companion value.
void ra8_log_emit_warn_val (const char *tag, const char *message, uint32_t value)
 Emit a WARN log line with a uint32_t companion value.
void ra8_log_emit_info_val (const char *tag, const char *message, uint32_t value)
 Emit an INFO log line with a uint32_t companion value.
void ra8_log_emit_debug_val (const char *tag, const char *message, int32_t value)
 Emit a DEBUG log line with an int32_t companion value.

Detailed Description

Lightweight Logging Interface for ra8-firmware.

Zero-allocation, tag + message + optional value logging API. The interface is designed so the vast majority of firmware code can call ra8_log_info("TAG", "some message") and the backend decides where the bytes go (SEGGER RTT, UART, null sink).

Design

  • Four levels: error, warn, info, debug. Anything below the compile-time RA8_LOG_LEVEL is a no-op (the call disappears at -O2).
  • Tag + message + optional value: every log line has a short tag identifying the component ("SCI", "CGC", "PID", ...) and a short string message. A numeric companion (uint32_t or int32_t) can be attached via the *_val variants so we never have to call printf/snprintf in hot paths.
  • No varargs: on purpose. Varargs pull in vfprintf (~4 KB), break -Wstack-usage=2200, and make the worst-case stack usage impossible to bound. Formatted output is limited to tag, message, and a single numeric value.
  • Thread safety is a backend concern: the default RTT backend is reentrant (single writer, per-CPU queue). UART backends are protected with an IRQ-masked critical section.
  • [[nodiscard]]-free: log calls are fire-and-forget.

Levels

Level Numeric Usage
k_ra8_log_level_none 0 Compile logging out entirely
k_ra8_log_level_error 1 Unrecoverable or escalated errors
k_ra8_log_level_warn 2 Recoverable issues, degraded mode
k_ra8_log_level_info 3 Significant state transitions
k_ra8_log_level_debug 4 Per-iteration / per-packet tracing

RA8_LOG_LEVEL defaults to k_ra8_log_level_info in Debug builds and k_ra8_log_level_warn in Release builds. Override with -DRA8_LOG_LEVEL=k_ra8_log_level_debug etc.

NASA Power of 10 Compliance

  • Rule 3: no dynamic allocation. Backends use fixed-size static buffers.
  • Rule 8: macros exist only for conditional compilation and level gating. The actual logging functions are real extern entry points so they stay in one compilation unit.
  • Rule 10: compiles clean under -Wall -Wextra -Werror.

Definition in file ra8_log.h.

Macro Definition Documentation

◆ ra8_log_debug

#define ra8_log_debug ( tag,
message )
Value:
((void)0)

RA8 log debug.

Definition at line 376 of file ra8_log.h.

Referenced by internal_emit().

◆ ra8_log_debug_val

#define ra8_log_debug_val ( tag,
message,
value )
Value:
((void)0)

RA8 log debug val.

Definition at line 378 of file ra8_log.h.

◆ ra8_log_error

#define ra8_log_error ( tag,
message )
Value:
ra8_log_emit_error((tag), (message))
void ra8_log_emit_error(const char *tag, const char *message)
Emit an ERROR-level log line with only a tag and a message.
Definition ra8_log.c:502

RA8 log error.

Definition at line 335 of file ra8_log.h.

Referenced by display_init(), display_policy_decide(), display_policy_full_rect(), display_policy_init(), ez_scene_init(), ez_tile_decode(), internal_add_manifest_image(), internal_block_read_pec_check(), internal_bus_init_once(), internal_canfd_clock_block_init(), internal_cfg_extent_ok(), internal_cfg_ladder_ok(), internal_cfg_scratch_ok(), internal_check_link_state(), internal_compile_and_cache(), internal_compute_layout(), internal_crc_stream_validate_args(), internal_downscale_if_needed(), internal_eink_init(), internal_emit(), internal_eswclk_power_on_domain(), internal_eswclk_program_cks(), internal_etha_to_operation(), internal_etha_wait_for_mode(), internal_h_create_mutex(), internal_h_create_queue(), internal_h_create_semaphore(), internal_h_thread_create(), internal_h_timer_start(), internal_handle_line(), internal_lcd_init(), internal_lsm6dso_fifo_check_args(), internal_ns_verify_or_deny(), internal_open_prep(), internal_pll2_program_protected(), internal_prepare_init(), internal_ra8_epaper_validate_load(), internal_ra8_epaper_wait_ready(), internal_ra8_epd_cal_read_record(), internal_read_wdt1_word(), internal_render_ready(), internal_reset_phase_1s(), internal_reset_phase_8d(), internal_sdramc_wait(), internal_tas_learn_entry(), internal_tas_validate(), internal_transcode_image(), internal_unwrap_reject_null(), internal_usb60ckcr_switch_to_pll2p_div4(), internal_usbckcr_switch_to_pll2p_div5(), internal_validate_cfg(), internal_validate_init_cfg(), internal_validate_memory_finalize(), internal_validate_region(), internal_validate_stream_args(), internal_wait_act_set(), internal_wait_tx0_done(), internal_webp_check_output(), internal_xspi_clock_block_init(), mg_reader_check_geometry(), priv_ra8_esp_hosted_rtos_deinit(), priv_ra8_esp_hosted_rtos_init(), priv_ra8_esp_hosted_rtos_pool_deinit(), priv_ra8_esp_hosted_rtos_pool_init(), priv_ra8_esp_hosted_rtos_release(), priv_ra8_esp_hosted_rtos_sync_deinit(), priv_ra8_esp_hosted_rtos_sync_init(), priv_usbhs_phy_bringup(), ra8_adc_read_channel(), ra8_cgc_eswclk_init(), ra8_cgc_usbfs_clock_enable(), ra8_cgc_usbhs_pll_enable(), ra8_cpu1_halt(), ra8_cpu1_release(), ra8_devcfg_get_vcom_mv(), ra8_dma_request(), ra8_doc_set_window(), ra8_doc_window_compare(), ra8_drw_wait_idle(), ra8_epaper_decode_dev_info(), ra8_epaper_display_area(), ra8_epaper_init(), ra8_epaper_set_vcom(), ra8_epd_cal_apply(), ra8_epd_cal_deserialize(), ra8_epd_cal_provision(), ra8_epd_cal_resolve(), ra8_epd_cal_serialize(), ra8_eth_coma_bringup(), ra8_eth_gwca_axi_init(), ra8_eth_gwca_install_linkfix(), ra8_eth_gwca_reload_queue(), ra8_eth_gwca_set_operation_mode(), ra8_eth_mfwd_route_queue(), ra8_eth_write(), ra8_etha_account_traffic(), ra8_etha_attach_handler(), ra8_etha_clear_stats(), ra8_etha_clear_status(), ra8_etha_configure_cbs(), ra8_etha_configure_cut_through(), ra8_etha_deinit(), ra8_etha_descriptor_ring_init(), ra8_etha_disable_irq(), ra8_etha_enable_irq(), ra8_etha_enable_tas(), ra8_etha_enter_stop(), ra8_etha_exit_stop(), ra8_etha_get_cbs_state(), ra8_etha_get_queue_level(), ra8_etha_get_stats(), ra8_etha_get_status(), ra8_etha_init(), ra8_etha_open(), ra8_etha_read_stats(), ra8_etha_read_tas_entry(), ra8_etha_reset(), ra8_etha_set_ipv_remap(), ra8_etha_set_max_frame_size(), ra8_etha_set_mode(), ra8_etha_set_preemption(), ra8_etha_set_queue_arb(), ra8_etha_set_queue_depth(), ra8_etha_set_rx_tag_filter(), ra8_etha_set_tas_schedule(), ra8_etha_set_vlan_mode(), ra8_etha_set_vlan_tag(), ra8_etha_tas_ram_reset(), ra8_fatal_error(), ra8_gfx_dither_gray8_to_gray4(), ra8_i3c_i2c_peripheral_open(), ra8_i3c_i2c_peripheral_receive(), ra8_i3c_i2c_peripheral_send(), ra8_img_decode_blit(), ra8_img_probe_size(), ra8_isr_register(), ra8_lpm_arm_dpsier(), ra8_lpm_clear_dpsifr(), ra8_lpm_get_clock_stop(), ra8_lpm_graphics_power_on(), ra8_lpm_set_clock_stop(), ra8_lpm_set_dpsiegr(), ra8_lpm_set_ldo_standby(), ra8_lpm_wait_for_opccr(), ra8_mipi_csi_set_virtual_channels(), ra8_mipi_dsi_ulps_enter(), ra8_npu_quantize_i8(), ra8_npu_quantize_u8(), ra8_pdm_read(), ra8_pdm_stop(), ra8_pin_validator_claim(), ra8_power_profile_mark_exit(), ra8_psa_crypto_init(), ra8_psa_crypto_random(), ra8_pwr_enter_software_standby(), ra8_rabook_gray4_downscale(), ra8_rabook_gray4_encode(), ra8_rabook_gray8_encode(), ra8_rabook_link_child(), ra8_rabook_link_sibling(), ra8_rabook_set_metadata(), ra8_reset_get_source_mask(), ra8_reset_set_source_mask(), ra8_rmac_attach_handler(), ra8_rmac_clear_status(), ra8_rmac_deinit(), ra8_rmac_enter_stop(), ra8_rmac_exit_stop(), ra8_rmac_get_status(), ra8_rmac_init(), ra8_rmac_mdio_c22_read(), ra8_rmac_mdio_c22_write(), ra8_rmac_mdio_c45_read(), ra8_rmac_mdio_c45_write(), ra8_rmac_phy_auto_neg_start(), ra8_rmac_phy_auto_neg_wait(), ra8_rmac_phy_link_status(), ra8_rmac_phy_reset(), ra8_rmac_phy_set_advertise(), ra8_rmac_read_stats(), ra8_rmac_set_frame_size(), ra8_rmac_set_link(), ra8_rmac_set_loopback(), ra8_rmac_set_lpi(), ra8_rmac_set_mac_address(), ra8_rmac_set_magic_packet(), ra8_rmac_set_pause_frame(), ra8_rmac_set_pfc_group(), ra8_rmac_set_ptp_filter(), ra8_rmac_set_rx_filter(), ra8_rmac_set_vlan_framing(), ra8_rtc_clock_init(), ra8_sdramc_enter_self_refresh(), ra8_sdramc_exit_self_refresh(), ra8_sdramc_init(), ra8_smbus_init(), ra8_smbus_read_byte_data(), ra8_smbus_receive_byte(), ra8_systick_configure(), ra8_systick_reload_for(), ra8_systick_set_reload(), ra8_threadx_systick_reload_for(), ra8_tile_rect_of_pixels(), ra8_time_init(), ra8_tls_global_init(), ra8_tls_handshake(), ra8_tz_ns_signed_body_len(), ra8_tz_secure_boot_jump_ns(), ra8_tz_secure_boot_sau_init(), ra8_wdt_clear_status_blocking(), ra8_wdt_subscribe(), ra8_webp_get_info(), unarch_gzip_unwrap(), unarch_tar_open(), zoom_source_init(), zoom_view_invalidate(), zoom_view_pan(), zoom_view_pan_dir(), zoom_view_present(), zoom_view_rebind(), zoom_view_set_scale(), and zoom_view_window().

◆ ra8_log_error_val

#define ra8_log_error_val ( tag,
message,
value )
Value:
ra8_log_emit_error_val((tag), (message), (value))
void ra8_log_emit_error_val(const char *tag, const char *message, uint32_t value)
Emit an ERROR log line with a uint32_t companion value.
Definition ra8_log.c:538

RA8 log error val.

Definition at line 337 of file ra8_log.h.

Referenced by internal_attach_hardware(), internal_do_bus_transfer(), internal_fill_row(), internal_log_fault_dump(), internal_probe_rdid(), internal_timer_arm(), internal_timer_disarm(), priv_ra8_esp_hosted_gpio_edge_register(), priv_ra8_esp_hosted_spi_open(), ra8_cgc_init(), ra8_cgc_switch_pll1_target(), ra8_cgc_usbfs_clock_enable(), ra8_cgc_usbhs_pll_enable(), ra8_cnecc_verify(), ra8_dma_deinit(), ra8_dma_init(), ra8_dma_release(), ra8_dma_request(), ra8_fatal_error(), ra8_flash_write_block(), ra8_gpio_input_init(), ra8_gpio_output_init(), ra8_mstp_disable(), ra8_mstp_enable(), ra8_mstp_init(), ra8_net_pal_init(), ra8_nsc_periph_init(), ra8_pfs_route_peripheral(), ra8_pwr_clear_wake_source(), ra8_pwr_init(), ra8_pwr_set_wake_source(), ra8_sci_init(), ra8_trustzone_init(), ra8_tz_secure_boot_jump_ns(), ra8_usb_cdc_init(), ra8_usb_composite_close(), ra8_usb_composite_init(), ra8_usb_composite_register_class(), ra8_usb_haud_init(), ra8_usb_hcdc_ecm_init(), ra8_usb_hcdc_init(), ra8_usb_hhid_init(), ra8_usb_hhub_init(), ra8_usb_hmsc_init(), ra8_usb_pal_init(), ra8_usb_paud_init(), ra8_usb_phid_init(), ra8_usb_pmsc_init(), ra8_usb_pprn_init(), ra8_usb_pvnd_init(), and SecureFault_Handler().

◆ ra8_log_info

#define ra8_log_info ( tag,
message )
Value:
((void)0)

RA8 log info.

Definition at line 364 of file ra8_log.h.

Referenced by app_launch_banner(), app_shell_banner(), app_stub_deinit(), app_stub_init(), app_stub_on_enter(), app_stub_on_input(), app_stub_on_leave(), app_stub_render(), display_init(), do_round(), dtc_coh_report(), emit_cycle_verdict(), emit_verdict(), heartbeat_loop(), internal_canfd_clock_block_init(), internal_eink_init(), internal_emit(), internal_emit_pass(), internal_report(), internal_resync_mac_speed(), internal_xspi_clock_block_init(), main(), park_low_power(), ra8_acmphs_init(), ra8_adc_init(), ra8_adc_init_configured(), ra8_bkup_cold_start_init(), ra8_bkup_deinit(), ra8_bkup_init(), ra8_bkup_no_switch_init(), ra8_bkup_tamper_init(), ra8_ble_close(), ra8_ble_open(), ra8_bscan_init(), ra8_cac_init(), ra8_canfd_set_tdc(), ra8_cgc_disable_stop_detection(), ra8_cgc_enable_stop_detection(), ra8_cgc_eswclk_init(), ra8_cgc_init(), ra8_cgc_pll2_enable(), ra8_cgc_usbfs_clock_enable(), ra8_cgc_usbhs_pll_enable(), ra8_cgc_use_hoco(), ra8_cnecc_init(), ra8_dac_b_init(), ra8_dac_b_init_configured(), ra8_dma_init(), ra8_doc_init(), ra8_doc_set_window(), ra8_dotf_init(), ra8_dtc_init(), ra8_elc_init(), ra8_epaper_init(), ra8_eth_coma_bringup(), ra8_eth_coma_init(), ra8_eth_gptp_init(), ra8_eth_gwca_init(), ra8_eth_init(), ra8_eth_mfwd_init(), ra8_eth_open(), ra8_eth_rgmii_select(), ra8_etha_init(), ra8_i3c_init(), ra8_icu_init(), ra8_infrastructure_init(), ra8_isr_init(), ra8_iwdt_init(), ra8_lpm_deinit(), ra8_lpm_graphics_power_on(), ra8_lpm_init(), ra8_mipi_csi_start_receive(), ra8_mipi_csi_stop_receive(), ra8_mipi_dsi_init(), ra8_mipi_phy_deinit(), ra8_mipi_phy_init(), ra8_mstp_init(), ra8_net_pal_init(), ra8_nsc_log_emit(), ra8_nsc_periph_init(), ra8_pdg_init(), ra8_pdm_init(), ra8_pwr_init(), ra8_reset_software_reset(), ra8_rmac_init(), ra8_rsip_init(), ra8_rtc_init(), ra8_sdramc_enter_self_refresh(), ra8_sdramc_exit_self_refresh(), ra8_sdramc_init(), ra8_sram_init(), ra8_tls_global_init(), ra8_touch_open(), ra8_tsn_init(), ra8_ulpt_init(), ra8_usb_cdc_init(), ra8_usb_composite_set_descriptors(), ra8_usb_pal_init(), ra8_usb_pmsc_attach_storage(), ra8_vin_capture_disarm(), ra8_vin_reset(), ra8_vreg_init(), ra8_wdt_deinit(), ra8_wdt_init(), run_mode_switch(), ux_dcd_ra8_usb_initialize(), and ux_hcd_ra8_usb_initialize().

◆ ra8_log_info_val

#define ra8_log_info_val ( tag,
message,
value )
Value:
((void)0)

RA8 log info val.

Definition at line 366 of file ra8_log.h.

Referenced by app_launch_banner(), app_shell_banner(), app_shell_log_menu(), do_round(), heartbeat_loop(), internal_hold_gpio(), internal_probe_rdid(), internal_sdcard_negotiate_width(), main(), park_low_power(), priv_ra8_esp_hosted_spi_open(), ra8_acmphs_channel_enable(), ra8_agt_start_cascade(), ra8_agt_start_free_run(), ra8_agt_start_pulse_output(), ra8_bscan_set_instruction(), ra8_canfd_init(), ra8_canfd_set_bitrate(), ra8_ceu_capture_arm(), ra8_ceu_init(), ra8_ceu_set_dma_buffer(), ra8_cgc_pll2_enable(), ra8_cgc_switch_pll1_target(), ra8_cnecc_compute(), ra8_crc_init(), ra8_dac_b_write(), ra8_dmac_start(), ra8_dotf_enable(), ra8_dotf_install_key(), ra8_dotf_rotate_key(), ra8_dotf_set_region(), ra8_drw_init(), ra8_ether_phy_open(), ra8_flash_init(), ra8_glcdc_gamma_enable(), ra8_glcdc_init(), ra8_glcdc_set_gamma(), ra8_glcdc_set_layer2(), ra8_gpio_attach_irq(), ra8_gpio_detach_irq(), ra8_gpio_input_init(), ra8_gpio_output_init(), ra8_gpt_init(), ra8_gpt_start_free_run(), ra8_gpt_three_phase_open(), ra8_i2c_init(), ra8_i3c_i2c_init(), ra8_i3c_i2c_peripheral_open(), ra8_icu_configure_irq_pin(), ra8_ipc_init(), ra8_layer3_switch_open(), ra8_lpm_enter_sleep(), ra8_lvd_channel_init(), ra8_mipi_csi_init(), ra8_mpc_route_peripheral(), ra8_pfs_route_peripheral(), ra8_pfs_set_drive_strength(), ra8_poeg_init(), ra8_reset_init(), ra8_rmac_phy_open(), ra8_rtc_clock_init(), ra8_rtc_set(), ra8_sci_init(), ra8_sci_lin_init(), ra8_sdcard_init(), ra8_sdhi_init(), ra8_spi_b_target_init(), ra8_spi_init(), ra8_ssie_init(), ra8_threadx_systick_retune(), ra8_time_init(), ra8_ulpt_start(), ra8_usb_composite_init(), ra8_usb_composite_register_class(), ra8_usb_device_init(), ra8_usb_haud_init(), ra8_usb_hcdc_ecm_init(), ra8_usb_hcdc_init(), ra8_usb_hhid_init(), ra8_usb_hhub_init(), ra8_usb_hmsc_init(), ra8_usb_host_init(), ra8_usb_paud_init(), ra8_usb_phid_init(), ra8_usb_pmsc_init(), ra8_usb_pprn_init(), ra8_usb_pvnd_init(), ra8_vin_capture_arm(), ra8_vin_init(), ra8_xspi_init(), and run_handoff_cycle().

◆ RA8_LOG_LEVEL

#define RA8_LOG_LEVEL   RA8_LOG_LEVEL_WARN

RA8 LOG LEVEL.

Definition at line 98 of file ra8_log.h.

◆ RA8_LOG_LEVEL_DEBUG

#define RA8_LOG_LEVEL_DEBUG   (4)

RA8 LOG LEVEL DEBUG.

Definition at line 82 of file ra8_log.h.

◆ RA8_LOG_LEVEL_ERROR

#define RA8_LOG_LEVEL_ERROR   (1)

RA8 LOG LEVEL ERROR.

Definition at line 76 of file ra8_log.h.

◆ RA8_LOG_LEVEL_INFO

#define RA8_LOG_LEVEL_INFO   (3)

RA8 LOG LEVEL INFO.

Definition at line 80 of file ra8_log.h.

◆ RA8_LOG_LEVEL_NONE

#define RA8_LOG_LEVEL_NONE   (0)

Definition at line 74 of file ra8_log.h.

◆ RA8_LOG_LEVEL_WARN

#define RA8_LOG_LEVEL_WARN   (2)

RA8 LOG LEVEL WARN.

Definition at line 78 of file ra8_log.h.

◆ ra8_log_warn

◆ ra8_log_warn_val

#define ra8_log_warn_val ( tag,
message,
value )
Value:
ra8_log_emit_warn_val((tag), (message), (value))
void ra8_log_emit_warn_val(const char *tag, const char *message, uint32_t value)
Emit a WARN log line with a uint32_t companion value.
Definition ra8_log.c:557

RA8 log warn val.

Definition at line 349 of file ra8_log.h.

Referenced by ra8_dotf_set_region().

Typedef Documentation

◆ ra8_log_byte_sink_fn_t

typedef void(* ra8_log_byte_sink_fn_t) (void *ctx, uint8_t byte)

Optional per-byte sink for redirecting log output off ITM.

When a sink is installed with ra8_log_set_byte_sink, every byte the logger would have written to the ITM stimulus port is handed to this callback instead. The ra8_io fabric installs an adapter that forwards the bytes to an ra8_io_stream_t, making the log destination run-time selectable without ra8_core depending on ra8_io.

Parameters
[in]ctxOpaque cookie supplied to ra8_log_set_byte_sink.
[in]byteThe log byte to consume.
Since
0.1.0

Definition at line 144 of file ra8_log.h.

Enumeration Type Documentation

◆ ra8_log_level_t

enum ra8_log_level_t : uint8_t

Compile-time and runtime log level.

Enumerator
k_ra8_log_level_none 

Disable all logging.

k_ra8_log_level_error 

Errors only.

k_ra8_log_level_warn 

Errors + warnings.

k_ra8_log_level_info 

Errors + warnings + info (default for Debug).

k_ra8_log_level_debug 

Everything, including per-iteration traces.

Definition at line 84 of file ra8_log.h.

Function Documentation

◆ ra8_log_emit_debug()

void ra8_log_emit_debug ( const char * tag,
const char * message )

Emit a DEBUG-level log line with only a tag and a message.

Backend entry point for the ra8_log_debug() macro.

Parameters
[in]tagShort component tag; must not be NULL.
[in]messageFree-form ASCII message; must not be NULL.
Precondition
tag and message are NUL-terminated strings.
ra8_log_init() has run.
Postcondition
One log line emitted or dropped.
No caller-visible state modified.
Note
Thread-safety inherited from the backend.
Since
0.1.0

Definition at line 517 of file ra8_log.c.

References internal_emit_line().

◆ ra8_log_emit_debug_val()

void ra8_log_emit_debug_val ( const char * tag,
const char * message,
int32_t value )

Emit a DEBUG log line with an int32_t companion value.

Adds =<signed-decimal> to the line emitted by ra8_log_emit_debug. Signed companion is intentional – debug traces frequently emit deltas.

Parameters
[in]tagShort component tag; must not be NULL.
[in]messageFree-form ASCII message; must not be NULL.
[in]valueSigned numeric companion appended to the line.
Precondition
tag and message are NUL-terminated strings.
ra8_log_init() has run.
Postcondition
One log line emitted or dropped.
No caller-visible state modified.
Note
Thread-safety inherited from the backend.
Since
0.1.0

Emit a DEBUG log line with an int32_t companion value.

Weak default backend. Forwards to internal_emit_line_i with the fixed level string "DEBUG".

Parameters
[in]tagNUL-terminated module tag.
[in]messageNUL-terminated short event description.
[in]valueint32 datum appended as "=NNN" (sign preserved).
Precondition
tag and message are non-NULL, NUL-terminated.
ra8_log_init() has run.
Postcondition
One line is emitted (or dropped).
No internal logger state is modified.
Note
Thread-safety inherited from the active backend.
Since
0.1.0

Definition at line 595 of file ra8_log.c.

References internal_emit_line_i().

◆ ra8_log_emit_error()

void ra8_log_emit_error ( const char * tag,
const char * message )

Emit an ERROR-level log line with only a tag and a message.

Backend entry point for the ra8_log_error() macro.

Parameters
[in]tagShort component tag; must not be NULL.
[in]messageFree-form ASCII message; must not be NULL.
Precondition
tag and message are NUL-terminated strings.
ra8_log_init() has run (otherwise dropped).
Postcondition
One log line emitted or dropped.
No caller-visible state modified.
Note
Thread-safety inherited from the backend.
Since
0.1.0

Emit an ERROR-level log line with only a tag and a message.

Definition at line 502 of file ra8_log.c.

References internal_emit_line(), and priv_rv_diag().

◆ ra8_log_emit_error_val()

void ra8_log_emit_error_val ( const char * tag,
const char * message,
uint32_t value )

Emit an ERROR log line with a uint32_t companion value.

Adds =<decimal> to the line emitted by ra8_log_emit_error.

Parameters
[in]tagShort component tag; must not be NULL.
[in]messageFree-form ASCII message; must not be NULL.
[in]valueUnsigned numeric companion appended to the line.
Precondition
tag and message are NUL-terminated strings.
ra8_log_init() has run.
Postcondition
One log line emitted or dropped.
No caller-visible state modified.
Note
Thread-safety inherited from the backend.
Since
0.1.0

Emit an ERROR log line with a uint32_t companion value.

Weak default backend. Forwards to internal_emit_line_u with the fixed level string "ERROR".

Parameters
[in]tagNUL-terminated module tag (e.g. "ra8_log").
[in]messageNUL-terminated short event description.
[in]valueuint32 datum appended as "=NNN" to the line.
Precondition
tag and message are non-NULL, NUL-terminated.
ra8_log_init() has run (otherwise the line is silently dropped).
Postcondition
One line is emitted to the log backend (or dropped if backend down).
No internal logger state is modified.
Note
Thread-safety inherited from the active backend (ITM by default).
Since
0.1.0

Emit an ERROR log line with a uint32_t companion value.

Definition at line 538 of file ra8_log.c.

References internal_emit_line_u(), priv_rv_diag(), and priv_rv_diag_u64().

◆ ra8_log_emit_info()

void ra8_log_emit_info ( const char * tag,
const char * message )

Emit an INFO-level log line with only a tag and a message.

Backend entry point for the ra8_log_info() macro.

Parameters
[in]tagShort component tag; must not be NULL.
[in]messageFree-form ASCII message; must not be NULL.
Precondition
tag and message are NUL-terminated strings.
ra8_log_init() has run.
Postcondition
One log line emitted or dropped.
No caller-visible state modified.
Note
Thread-safety inherited from the backend.
Since
0.1.0

Definition at line 512 of file ra8_log.c.

References internal_emit_line().

◆ ra8_log_emit_info_val()

void ra8_log_emit_info_val ( const char * tag,
const char * message,
uint32_t value )

Emit an INFO log line with a uint32_t companion value.

Adds =<decimal> to the line emitted by ra8_log_emit_info.

Parameters
[in]tagShort component tag; must not be NULL.
[in]messageFree-form ASCII message; must not be NULL.
[in]valueUnsigned numeric companion appended to the line.
Precondition
tag and message are NUL-terminated strings.
ra8_log_init() has run.
Postcondition
One log line emitted or dropped.
No caller-visible state modified.
Note
Thread-safety inherited from the backend.
Since
0.1.0

Emit an INFO log line with a uint32_t companion value.

Weak default backend. Forwards to internal_emit_line_u with the fixed level string "INFO".

Parameters
[in]tagNUL-terminated module tag.
[in]messageNUL-terminated short event description.
[in]valueuint32 datum appended as "=NNN" to the line.
Precondition
tag and message are non-NULL, NUL-terminated.
ra8_log_init() has run.
Postcondition
One line is emitted (or dropped).
No internal logger state is modified.
Note
Thread-safety inherited from the active backend.
Since
0.1.0

Definition at line 576 of file ra8_log.c.

References internal_emit_line_u().

◆ ra8_log_emit_warn()

void ra8_log_emit_warn ( const char * tag,
const char * message )

Emit a WARN-level log line with only a tag and a message.

Backend entry point for the ra8_log_warn() macro.

Parameters
[in]tagShort component tag; must not be NULL.
[in]messageFree-form ASCII message; must not be NULL.
Precondition
tag and message are NUL-terminated strings.
ra8_log_init() has run.
Postcondition
One log line emitted or dropped.
No caller-visible state modified.
Note
Thread-safety inherited from the backend.
Since
0.1.0

Definition at line 507 of file ra8_log.c.

References internal_emit_line().

◆ ra8_log_emit_warn_val()

void ra8_log_emit_warn_val ( const char * tag,
const char * message,
uint32_t value )

Emit a WARN log line with a uint32_t companion value.

Adds =<decimal> to the line emitted by ra8_log_emit_warn.

Parameters
[in]tagShort component tag; must not be NULL.
[in]messageFree-form ASCII message; must not be NULL.
[in]valueUnsigned numeric companion appended to the line.
Precondition
tag and message are NUL-terminated strings.
ra8_log_init() has run.
Postcondition
One log line emitted or dropped.
No caller-visible state modified.
Note
Thread-safety inherited from the backend.
Since
0.1.0

Emit a WARN log line with a uint32_t companion value.

Weak default backend. Forwards to internal_emit_line_u with the fixed level string "WARN".

Parameters
[in]tagNUL-terminated module tag.
[in]messageNUL-terminated short event description.
[in]valueuint32 datum appended as "=NNN" to the line.
Precondition
tag and message are non-NULL, NUL-terminated.
ra8_log_init() has run.
Postcondition
One line is emitted (or dropped).
No internal logger state is modified.
Note
Thread-safety inherited from the active backend.
Since
0.1.0

Definition at line 557 of file ra8_log.c.

References internal_emit_line_u().

◆ ra8_log_init()

void ra8_log_init ( void )

Initialise the logging backend.

Called exactly once during early boot, before the first log call. The default backend is SEGGER RTT (J-Link on-board debugger) and requires no hardware setup beyond this call. A UART backend is provided as an alternative for boards without a J-Link.

Precondition
SystemInit() has run.
Called exactly once.
Postcondition
Log calls become routable.
No global flag is set – backend readiness is detected per emit.
Note
Log calls made before ra8_log_init() runs are dropped silently – no buffering. Not thread-safe.
Since
0.1.0

Initialise the logging backend.

ITM is enabled by the debugger when it attaches; the firmware does not need to programme any control registers.

Precondition
Called exactly once during early boot.
Build either has a debugger attached or is the off-target host.
Postcondition
Subsequent log calls follow the ITM emit path.
No state modified – the function is intentionally empty.
Note
Thread-safety irrelevant – one-shot init only.
Since
0.1.0

Definition at line 379 of file ra8_log.c.

Referenced by internal_output_init(), main(), and ra8_infrastructure_init().

◆ ra8_log_set_byte_sink()

void ra8_log_set_byte_sink ( ra8_log_byte_sink_fn_t fn,
void * ctx )

Install (or clear) an optional byte sink for log output.

Pass a non-NULL fn to redirect all subsequent log bytes to fn; pass NULL to restore the default ITM backend. Off by default, so existing behaviour is unchanged until a sink is installed.

Parameters
[in]fnByte sink callback, or NULL to restore the ITM default.
[in]ctxOpaque cookie passed back to fn (may be NULL).
Returns
Nothing.
Precondition
None.
fn, when non-NULL, out-lives the redirect.
Postcondition
Subsequent log bytes route to fn (or ITM when fn is NULL).
No log line already in flight is rerouted mid-byte.
Note
Not thread-safe with respect to concurrent logging.
Since
0.1.0

Definition at line 56 of file ra8_log.c.

References s_byte_sink, and s_byte_sink_ctx.

Referenced by internal_output_init(), main(), main(), ra8_io_log_attach(), ra8_io_log_detach(), and ra8_nsc_periph_init().