|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Bring the RA8D2 + ThreadX esp-hosted port up against the ESP32-C6. More...
#include <stdint.h>#include "c6_hosted.h"#include "ra8_board_ek_ra8d2.h"#include "ra8_boot_entry.h"#include "ra8_cgc.h"#include "ra8_err.h"#include "ra8_esp_hosted_port.h"#include "ra8_isr.h"#include "ra8_mstp.h"#include "ra8_time.h"#include "tx_api.h"Go to the source code of this file.
Functions | |
| static void | c6_hosted_panic_halt (void) |
| Park the CPU forever after an unrecoverable bring-up failure. | |
| static void | c6_hosted_setup_or_halt (void) |
| Bring clocks, module-stop state, SysTick and the console up. | |
| static void | c6_hosted_heartbeat (void) |
| Print heartbeat lines forever, never returning. | |
| static void | c6_hosted_worker_entry (ULONG thread_input) |
| Worker thread: report the init, exercise the link, then heartbeat. | |
| void | tx_application_define (void *first_unused_memory) |
| ThreadX define hook: bring the port up and start the worker. | |
| void | main (void) |
| Application entry: clocks, console, banner, then ThreadX. | |
Variables | |
| static uint32_t | s_c6_hosted_cpuclk_hz |
| Cached CPUCLK0 rate, used to programme SysTick. | |
| static uint32_t | s_c6_hosted_pclka_hz |
| Cached PCLKA rate, the SCI baud-clock source the port divides. | |
| static ra8_err_t | s_c6_hosted_init_err = k_ra8_err_not_initialized |
| Exact result of ra8_esp_hosted_port_init. | |
| static TX_THREAD | s_c6_hosted_worker |
| Control block of the single application thread. | |
| static CHAR | s_c6_hosted_worker_name [] = "c6_hosted_init" |
| Thread name handed to ThreadX. | |
| static UCHAR | s_c6_hosted_worker_stack [k_c6_hosted_worker_stack] |
| Stack backing s_c6_hosted_worker. | |
Bring the RA8D2 + ThreadX esp-hosted port up against the ESP32-C6.
First application to consume port/esp-hosted/ – the first-party RA8D2 + ThreadX port of the vendored esp-hosted host driver. It is the port's buildable consumer and its bring-up harness: it initialises the port, states the pin map and interrupt routing the port resolved, reads both side-band lines through the OS-abstraction vtable, clocks exactly one full-duplex transaction, decodes the frame the co-processor returned and prints one PASS/FAIL verdict line.
This file holds the bring-up sequence only; the reporting, the console formatters and the frame work live in src/ behind c6_hosted.h.
The pin map comes from the probe examples/ek_ra8d2/hw_validated/c6/c6_spi_probe, which scope-qualified every J26 hole on 2026-07-27 at SPI mode 3 / 1 MHz with zero bad checksums.
That first run also found a defect in this application rather than in the port: its verdict demanded a payload-header offset of twelve from a frame that legitimately carries zero, so it reported FAIL at a healthy link. The idle filler is now a pass in its own right – see src/c6_hosted_frame.c.
Definition in file main.c.
|
static |
Print heartbeat lines forever, never returning.
Definition at line 200 of file main.c.
References c6_hosted_event_count(), c6_hosted_put_u32(), c6_hosted_puts(), c6_hosted_report_sideband(), k_c6_hosted_heartbeat_ms, ra8_esp_hosted_port_is_ready(), and tx_thread_sleep.
Referenced by c6_hosted_worker_entry().
|
static |
Park the CPU forever after an unrecoverable bring-up failure.
Definition at line 146 of file main.c.
Referenced by c6_hosted_setup_or_halt(), and main().
|
static |
Bring clocks, module-stop state, SysTick and the console up.
Definition at line 166 of file main.c.
References c6_hosted_panic_halt(), k_c6_hosted_uart_baud, k_ra8_clock_id_cpuclk0, k_ra8_clock_id_pclka, k_ra8_ok, ra8_board_uart_console_init(), ra8_cgc_get_clock_hz(), ra8_cgc_init(), ra8_mstp_init(), ra8_time_init(), s_c6_hosted_cpuclk_hz, and s_c6_hosted_pclka_hz.
Referenced by main().
|
static |
Worker thread: report the init, exercise the link, then heartbeat.
| [in] | thread_input | ThreadX entry argument; unused. |
Definition at line 233 of file main.c.
References c6_hosted_heartbeat(), c6_hosted_puts(), c6_hosted_report_sideband(), c6_hosted_run_transaction(), k_c6_hosted_boot_wait_ms, k_ra8_ok, ra8_delay_ms(), ra8_err_to_str(), ra8_esp_hosted_mem_dump(), and s_c6_hosted_init_err.
Referenced by tx_application_define().
| void main | ( | void | ) |
Application entry: clocks, console, banner, then ThreadX.
The application entry point Reset_Handler hands control to.
Definition at line 308 of file main.c.
References c6_hosted_panic_halt(), c6_hosted_print_banner(), c6_hosted_print_pin_map(), c6_hosted_puts(), c6_hosted_setup_or_halt(), ra8_isr_globals_enable(), s_c6_hosted_cpuclk_hz, and s_c6_hosted_pclka_hz.
| void tx_application_define | ( | void * | first_unused_memory | ) |
ThreadX define hook: bring the port up and start the worker.
| [in] | first_unused_memory | Free RAM handed over by the ThreadX port; unused, every object here is static. |
Definition at line 268 of file main.c.
References c6_hosted_on_event(), c6_hosted_puts(), c6_hosted_worker_entry(), k_c6_hosted_edge_poll_ms, k_c6_hosted_sck_hz, k_c6_hosted_worker_prio, k_ra8_board_pmod1_sci_channel, k_ra8_ok, ra8_esp_hosted_port_init(), ra8_esp_hosted_port_set_event_cb(), s_c6_hosted_init_err, s_c6_hosted_pclka_hz, s_c6_hosted_worker, s_c6_hosted_worker_name, s_c6_hosted_worker_stack, TX_AUTO_START, TX_NO_TIME_SLICE, TX_SUCCESS, and tx_thread_create.
|
static |
Cached CPUCLK0 rate, used to programme SysTick.
Read once during bring-up, before ThreadX starts.
Definition at line 76 of file main.c.
Referenced by c6_hosted_setup_or_halt(), and main().
|
static |
Exact result of ra8_esp_hosted_port_init.
Recorded in tx_application_define and reported verbatim by the worker, which is the first context that can print after the init.
Definition at line 100 of file main.c.
Referenced by c6_hosted_worker_entry(), and tx_application_define().
|
static |
Cached PCLKA rate, the SCI baud-clock source the port divides.
Handed to the port as ra8_esp_hosted_port_cfg_t::pclk_hz; a stale value silently mis-programs the SPI bit rate, so it is read from the CGC rather than assumed.
Definition at line 88 of file main.c.
Referenced by c6_hosted_setup_or_halt(), main(), and tx_application_define().
|
static |
Control block of the single application thread.
ThreadX requires statically allocated control blocks, as does NASA Power of 10 Rule 3.
Definition at line 111 of file main.c.
Referenced by tx_application_define().
|
static |
Thread name handed to ThreadX.
A mutable array rather than a string literal: ThreadX takes a non-const CHAR*, and casting the qualifier away would trip the project's -Wcast-qual.
Definition at line 123 of file main.c.
Referenced by tx_application_define().
|
static |
Stack backing s_c6_hosted_worker.
Sized by k_c6_hosted_worker_stack; the deepest call the worker makes is a formatter with a small on-stack digit array.
Definition at line 134 of file main.c.
Referenced by tx_application_define().