58typedef enum : uint32_t {
96 __asm__
volatile(
"wfi");
148 buf[idx] = (uint8_t)
'0';
155 buf[idx] = (uint8_t)(
'0' + (uint8_t)(value % (uint32_t)
k_demo_dec_base));
189 if (out_cpuclk_hz ==
nullptr) {
193 uint32_t cpuclk0_hz = 0U;
213 uint32_t reload = 0U;
227 *out_cpuclk_hz = cpuclk0_hz;
252 if (cycles_per_us == 0U) {
259 const uint32_t micros = cycles / cycles_per_us;
283 uint32_t cpuclk0_hz = 0U;
void main(void)
Secure fallback main entry point.
static void demo_setup_or_halt(void)
Bring up CGC + SysTick + the SCI8 console; halt forever on any failure.
static void demo_emit(const uint8_t *data, size_t len)
Write a byte span to the SCI8 console, ignoring flow-control errors.
static const uint8_t k_demo_lbl_reload[]
Label emitted once with the HAL-computed SysTick reload.
hal_timebase_config_t
Compile-time settings for the demo.
@ k_demo_period_ms
Heartbeat + measured-delay period.
@ k_demo_u32_digits
Max decimal digits in a uint32_t.
@ k_demo_hz_per_mhz
Hz per MHz -> cycles-per-us divisor.
@ k_demo_dec_base
Decimal radix for the number emitter.
@ k_demo_tick_hz
1 kHz -> 1 ms SysTick tick.
static const uint8_t k_demo_lbl_us[]
Field separator before the derived microseconds.
static void demo_emit_measurement(uint32_t cpuclk_hz)
Emit one measurement line: DWT-timed length of a 1 s delay.
static const uint8_t k_demo_lbl_cycles[]
Field separator before the DWT cycle count.
static const uint8_t k_demo_crlf[]
Line terminator.
static const uint8_t k_demo_lbl_ms[]
Label opening each per-second measurement line.
static void demo_panic_halt(void)
Halt forever in WFI – used as a panic stop on init failure.
static void demo_emit_u32(uint32_t value)
Emit a uint32_t as decimal ASCII over the console.
Board-support layer for the Renesas EK-RA8D2 v1 evaluation kit.
ra8_err_t ra8_board_led_toggle(ra8_board_led_id_t led)
Toggle led's output state.
ra8_err_t ra8_board_led_init(ra8_board_led_id_t led)
Configure led as a digital output, initial level low (off).
@ k_ra8_board_led1
LED1, BLUE, P600 (jumper E27).
ra8_err_t ra8_board_uart_console_write(const uint8_t *data, size_t len)
Polled blocking write to the J-Link OB VCOM console.
ra8_err_t ra8_board_uart_console_init(uint32_t baud)
Configure SCI8 + PD02/PD03 as the debug-console UART.
Boot entry points shared between a vector table and its startup code.
High-level Clock Generation Circuit driver.
ra8_err_t ra8_cgc_get_clock_hz(ra8_clock_id_t id, uint32_t *out_hz)
Query the current frequency of a clock-tree domain.
@ k_ra8_clock_id_cpuclk0
Cortex-M85 CPUCLK0.
ra8_err_t ra8_cgc_init(void)
Configure the clock tree to a safe default.
Error Code Definitions for ra8-firmware.
@ k_ra8_err_invalid_arg
Invalid function argument.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
NVIC + ICU IELSR allocator.
void ra8_isr_globals_enable(void)
Globally enable maskable interrupts (PRIMASK = 0).
Cortex-M85 SysTick + DWT cycle-counter timebase primitive.
ra8_err_t ra8_systick_reload_for(uint32_t cpu_hz, uint32_t tick_hz, uint32_t *out_reload)
Compute the SysTick reload for a given core clock and tick rate.
void ra8_dwt_cyccnt_reset(void)
Zero the DWT cycle counter (DWT_CYCCNT).
@ k_ra8_systick_clk_cpu
CLKSOURCE = 1: processor (CPU) clock.
ra8_err_t ra8_systick_configure(uint32_t reload, ra8_systick_clock_source_t src, bool tick_irq)
Arm and start SysTick with a reload value and clock source.
uint32_t ra8_dwt_cyccnt_read(void)
Sample the DWT cycle counter (DWT_CYCCNT).
void ra8_dwt_cyccnt_enable(void)
Enable the DWT free-running cycle counter (DWT_CYCCNT).
SysTick-based tick counter, delay and timestamp helpers.
ra8_err_t ra8_time_init(uint32_t cpu_hz)
Initialise SysTick for a 1 kHz tick interrupt.
void ra8_delay_ms(uint32_t ms)
Busy-wait for at least ms milliseconds.