50typedef enum : uint32_t {
62static const uint8_t
k_msg_boot[] =
"bscan-selftest: boot\r\n";
63static const uint8_t
k_msg_fail[] =
"bscan-selftest: FAIL init\r\n";
64static const uint8_t
k_msg_chk[] =
"bscan-selftest: FAIL check\r\n";
70static void bs_print(
const uint8_t* msg, uint32_t len)
79 __asm__
volatile(
"bkpt #0");
81 __asm__
volatile(
"wfi");
115 buf[n] = (uint8_t)(
'0' + (value % (uint32_t)
k_bs_dec_ten));
119 for (uint32_t i = 0U; i < n; i++) {
167 uint32_t cpuclk0_hz = 0U;
196 uint32_t idcode = 0U;
206 __asm__
volatile(
"wfi");
void main(void)
Secure fallback main entry point.
static const uint8_t k_msg_pre[]
static const uint8_t k_msg_ok[]
static const uint8_t k_msg_boot[]
static const uint8_t k_msg_fail[]
static const uint8_t k_msg_mid[]
static void bs_require(bool ok)
Self-check assertion: halt on the FAIL-check banner if ok is false.
static void bs_print(const uint8_t *msg, uint32_t len)
Emit a byte run on the SCI8 console.
static void bs_setup_or_halt(void)
Bring up clocks/MSTP/time + the SCI8 console; halt on failure.
static void bs_print_uint(uint32_t value)
Print a small unsigned integer in decimal.
static const uint8_t k_msg_chk[]
static void bs_print_hex(uint32_t value)
Print a 32-bit value as 8 upper-case hex digits.
bs_consts_t
Console / self-check knobs (no magic numbers).
@ k_bs_uart_baud
Console baud.
@ k_bs_hex_nibbles
Hex digits in a 32-bit value.
@ k_bs_dec_ten
Hex digit / decimal split.
@ k_bs_checks_total
Count of self-checks below.
@ k_bs_nibble_bits
Bits per hex nibble.
@ k_bs_clear_none
Legal clear mask (the only one).
@ k_bs_reserved_op
A reserved JTIR opcode (HUM 50.2.1).
@ k_bs_bad_mask
Illegal non-zero clear mask.
@ k_bs_nibble_mask
Low-nibble mask.
static void bs_panic_halt(const uint8_t *msg, uint32_t len)
Print the fail banner and trap (ra8_emulator halts on the BKPT).
static uint32_t bs_run_checks(uint32_t *out_idcode)
Run the full ra8_bscan CPU-side contract; halt on any failure.
Board-support layer for the Renesas EK-RA8D2 v1 evaluation kit.
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.
JTAG / IEEE-1149.1 Boundary Scan TAP HAL surface.
ra8_err_t ra8_bscan_get_status(ra8_bscan_status_t *out)
Get a snapshot of the driver's TAP bookkeeping state.
ra8_err_t ra8_bscan_clear_status(uint32_t mask)
Clear the recorded last-instruction state (no hardware effect).
ra8_err_t ra8_bscan_set_instruction(ra8_bscan_instr_t instr)
Record the JTIR opcode the external fixture is currently driving.
ra8_err_t ra8_bscan_init(void)
Initialise the firmware-side TAP bookkeeping object.
ra8_err_t ra8_bscan_get_idcode(uint32_t *out)
Get the chip's hardwired JTIDR device ID code.
JTAG / IEEE-1149.1 Boundary Scan TAP constants for the RA8D2.
@ k_ra8_bscan_jtidr_reset
JTIDR fixed device ID.
ra8_bscan_instr_t
JTIR Test Bit Set (TS[3:0]) command codes.
@ k_ra8_bscan_instr_idcode
Read JTIDR (Renesas code).
@ k_ra8_bscan_instr_bypass
Bypass register selected.
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.
@ k_ra8_err_null_ptr
Pointer was NULL where a valid pointer was required.
NVIC + ICU IELSR allocator.
void ra8_isr_globals_enable(void)
Globally enable maskable interrupts (PRIMASK = 0).
Ref-counted Module Stop Control wrapper for the RA8D2.
ra8_err_t ra8_mstp_init(void)
Re-establish the ra8_mstp ref-count table from current hardware state.
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.
Snapshot of the firmware-side TAP bookkeeping object.
uint32_t expected_idcode
JTIDR value the fixture should observe.
ra8_bscan_instr_t last_instruction
Last JTIR opcode reported by the fixture.
bool initialized
True once ra8_bscan_init ran.