ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
main.c
Go to the documentation of this file.
1
36
37#include <stddef.h>
38#include <stdint.h>
39
40#include "ra8_attributes.h"
42#include "ra8_boot_entry.h"
43#include "ra8_cgc.h"
44#include "ra8_dual_core.h"
45#include "ra8_err.h"
46#include "ra8_log.h"
47
49extern uint32_t g_ra8_ls_cpu1_mram_start;
51extern uint32_t g_ra8_ls_cpu1_stack_top;
52
61typedef enum : uint32_t {
64
78static const uint8_t s_blink_m33_pass_banner[] = "blink_m33: m33 released PASS\r\n";
79
104{
105 if (ra8_cgc_init() != k_ra8_ok) {
106 return false;
107 }
109 return false;
110 }
111 return true;
112}
113
138
156[[noreturn]] RA8_INTERNAL static void internal_park_forever(void)
157{
158 while (1) {
159 __asm volatile("nop");
160 }
161}
162
182[[noreturn]] RA8_INTERNAL static void internal_idle_forever(void)
183{
184 while (1) {
185 __asm volatile("wfi");
186 }
187}
188
203void main(void)
204{
205 ra8_log_init();
206 ra8_log_info("M85", "==== RA8D2 dual-core blink template ====");
207 ra8_log_info("M85", "Cortex-M85 primary core online");
208
209 /* Bring up the VCOM console so the post-release success path can emit the HIL
210 * banner. Best-effort: a failure is narrated over ITM and the demo continues. */
211 if (!internal_console_init()) {
212 ra8_log_info("M85", "VCOM console init failed -- HIL banner unavailable");
213 }
214
215 ra8_log_info("M85", "releasing Cortex-M33 secondary core ...");
216
218 ra8_log_info_val("M85", "ra8_cpu1_release rc (0 = ok)", (uint32_t)err);
219 if (err != k_ra8_ok) {
220 ra8_log_info("M85", "release FAILED -- halting");
222 }
223
224 ra8_log_info("M85", "M33 released -- it now blinks LED1 (BLUE, P600)");
225 /* Additive HIL banner: the M33 has been released (its blink is visually
226 * confirmed on the bench); mirror the verdict to VCOM for uart_scrape. */
228 ra8_log_info("M85", "M85 entering WFI idle -- low-power co-processor model");
230}
void main(void)
Secure fallback main entry point.
Definition main.c:37
uint32_t g_ra8_ls_cpu1_mram_start
uint32_t g_ra8_ls_cpu1_stack_top
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
I/O-expander, USB, camera, external-memory, MIPI-DSI, UART console, and Ethernet portion of the EK-RA...
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.
ra8_err_t ra8_board_uart_console_flush(void)
Block until every byte queued on the J-Link OB VCOM console has finished clocking out on the wire.
Boot entry points shared between a vector table and its startup code.
High-level Clock Generation Circuit driver.
ra8_err_t ra8_cgc_init(void)
Configure the clock tree to a safe default.
Definition ra8_cgc.c:727
Dual-core (CPU0 / CPU1) lifecycle helper – public API.
ra8_err_t ra8_cpu1_release(void *entry, void *sp)
Release CPU1 (Cortex-M33) from reset and start it executing.
Error Code Definitions for ra8-firmware.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
Definition ra8_err.h:119
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Lightweight Logging Interface for ra8-firmware.
void ra8_log_init(void)
Initialise the logging backend.
Definition ra8_log.c:379
#define ra8_log_info_val(tag, message, value)
RA8 log info val.
Definition ra8_log.h:366
#define ra8_log_info(tag, message)
RA8 log info.
Definition ra8_log.h:364