|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Headless on-silicon self-test gate for the JTAG boundary-scan TAP bookkeeping driver ra8_bscan (#138). More...
#include <stddef.h>#include <stdint.h>#include "ra8_board_ek_ra8d2.h"#include "ra8_boot_entry.h"#include "ra8_bscan.h"#include "ra8_bscan_regs.h"#include "ra8_cgc.h"#include "ra8_err.h"#include "ra8_isr.h"#include "ra8_mstp.h"#include "ra8_time.h"Go to the source code of this file.
Enumerations | |
| enum | bs_consts_t : uint32_t { k_bs_uart_baud = 115200U , k_bs_reserved_op = 0x02U , k_bs_clear_none = 0x00U , k_bs_bad_mask = 0x01U , k_bs_checks_total = 17U , k_bs_hex_nibbles = 8U , k_bs_nibble_bits = 4U , k_bs_nibble_mask = 0x0FU , k_bs_dec_ten = 10U } |
| Console / self-check knobs (no magic numbers). More... | |
Functions | |
| static void | bs_print (const uint8_t *msg, uint32_t len) |
| Emit a byte run on the SCI8 console. | |
| 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 void | bs_require (bool ok) |
Self-check assertion: halt on the FAIL-check banner if ok is false. | |
| static void | bs_print_hex (uint32_t value) |
| Print a 32-bit value as 8 upper-case hex digits. | |
| static void | bs_print_uint (uint32_t value) |
| Print a small unsigned integer in decimal. | |
| static uint32_t | bs_run_checks (uint32_t *out_idcode) |
| Run the full ra8_bscan CPU-side contract; halt on any failure. | |
| static void | bs_setup_or_halt (void) |
| Bring up clocks/MSTP/time + the SCI8 console; halt on failure. | |
| void | main (void) |
| App entry: run the bscan self-check, print the banner. | |
Variables | |
| static const uint8_t | k_msg_boot [] = "bscan-selftest: boot\r\n" |
| static const uint8_t | k_msg_fail [] = "bscan-selftest: FAIL init\r\n" |
| static const uint8_t | k_msg_chk [] = "bscan-selftest: FAIL check\r\n" |
| static const uint8_t | k_msg_pre [] = "bscan: idcode=" |
| static const uint8_t | k_msg_mid [] = " checks=" |
| static const uint8_t | k_msg_ok [] = " PASS\r\n" |
Headless on-silicon self-test gate for the JTAG boundary-scan TAP bookkeeping driver ra8_bscan (#138).
The RA8D2 boundary-scan TAP (HUM Ch 50, p 3257-3262) is driven by an external IEEE-1149.1 manufacturing-test fixture over the four JTAG pins while RES is held low; its four registers (JTIR/JTIDR/JTBPR/JTBSR) are not CPU-reachable. So the actual scan chain cannot be exercised from firmware – that validation is inherently external-tool-driven.
What firmware can validate is its own contribution to boundary scan: the ra8_bscan bookkeeping object (HUM-sourced IDCODE constant, opcode validation, lifecycle). This app runs that contract end-to-end as a power-on self-test – no panel / SD / touch / JTAG fixture needed – and prints a deterministic banner on the SCI8 J-Link OB console:
bscan: idcode=085DA447 checks=17 PASS
The IDCODE is the chip's hardwired device ID (0x085D_A447, HUM Ch 50.2.2 p 3258) that the external fixture should scan out over TDO; asserting it here is the firmware's authoritative cross-check. Every sub-check (positive and negative API paths) must pass or the app halts on a FAIL banner before reaching the PASS line, so the gate is exact. The banner is identical on host, ra8_emulator, and silicon.
[Ring 7 / App] {World: NS}
Definition in file main.c.
| enum bs_consts_t : uint32_t |
Console / self-check knobs (no magic numbers).
|
static |
Print the fail banner and trap (ra8_emulator halts on the BKPT).
Definition at line 76 of file main.c.
References bs_print().
Referenced by bs_require(), and bs_setup_or_halt().
|
static |
Emit a byte run on the SCI8 console.
Definition at line 70 of file main.c.
References ra8_board_uart_console_write().
Referenced by bs_panic_halt(), bs_print_hex(), bs_print_uint(), and main().
|
static |
Print a 32-bit value as 8 upper-case hex digits.
Definition at line 94 of file main.c.
References bs_print(), k_bs_dec_ten, k_bs_hex_nibbles, k_bs_nibble_bits, and k_bs_nibble_mask.
Referenced by main().
|
static |
Print a small unsigned integer in decimal.
Definition at line 106 of file main.c.
References bs_print(), and k_bs_dec_ten.
Referenced by main().
|
static |
Self-check assertion: halt on the FAIL-check banner if ok is false.
Definition at line 86 of file main.c.
References bs_panic_halt(), and k_msg_chk.
Referenced by bs_run_checks().
|
static |
Run the full ra8_bscan CPU-side contract; halt on any failure.
Exercises every public entry point on both its positive and negative paths: the IDCODE constant cross-check (the firmware's boundary-scan contribution), opcode validation, the clear-mask guard, and the NULL guards. Returns the chip device ID for the banner.
| [out] | out_idcode | Receives the JTIDR device ID read back. |
Definition at line 136 of file main.c.
References bs_require(), ra8_bscan_status_t::expected_idcode, ra8_bscan_status_t::initialized, k_bs_bad_mask, k_bs_checks_total, k_bs_clear_none, k_bs_reserved_op, k_ra8_bscan_instr_bypass, k_ra8_bscan_instr_idcode, k_ra8_bscan_jtidr_reset, k_ra8_err_invalid_arg, k_ra8_err_null_ptr, k_ra8_ok, ra8_bscan_status_t::last_instruction, ra8_bscan_clear_status(), ra8_bscan_get_idcode(), ra8_bscan_get_status(), ra8_bscan_init(), and ra8_bscan_set_instruction().
Referenced by main().
|
static |
Bring up clocks/MSTP/time + the SCI8 console; halt on failure.
Definition at line 165 of file main.c.
References bs_panic_halt(), k_bs_uart_baud, k_msg_fail, k_ra8_clock_id_cpuclk0, k_ra8_ok, ra8_board_uart_console_init(), ra8_cgc_get_clock_hz(), ra8_cgc_init(), ra8_mstp_init(), and ra8_time_init().
Referenced by main().
| void main | ( | void | ) |
App entry: run the bscan self-check, print the banner.
The application entry point Reset_Handler hands control to.
Definition at line 190 of file main.c.
References bs_print(), bs_print_hex(), bs_print_uint(), bs_run_checks(), bs_setup_or_halt(), k_msg_boot, k_msg_mid, k_msg_ok, k_msg_pre, and ra8_isr_globals_enable().
|
static |
|
static |
Definition at line 64 of file main.c.
Referenced by bs_require().
|
static |