|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
CPU1 (Cortex-M33 secondary core) image: blink LED1 forever. More...
#include <stdint.h>Go to the source code of this file.
Enumerations | |
| enum | m33_port_addr_t : uintptr_t { k_port6_pcntr1_addr = 0x404000C0U } |
| MMIO address of the PORT6 control register driving LED1. More... | |
| enum | m33_blink_const_t : uint32_t { k_led1_pdr_out = 0x00000001U , k_led1_podr_on = 0x00010000U , k_blink_spins = 3000000U } |
| PCNTR1 bit fields for LED1 and the blink-loop delay bound. More... | |
Functions | |
| void | cpu1_reset_handler (void) |
| CPU1 reset handler: minimal C-runtime init, then enter cpu1_main. | |
| static void | cpu1_main (void) |
| CPU1 application loop: blink LED1 (BLUE, P600) forever. | |
| static void | cpu1_fault_handler (void) |
| CPU1 default fault handler: park the core. | |
Variables | |
| uint32_t | g_ra8_ls_cpu1_stack_top |
| CPU1 stack top (slot 0 of the M33 vector table). | |
| uint32_t | g_ra8_ls_cpu1_data_start |
| CPU1 .data run-region start (in SRAM_CPU1). | |
| uint32_t | g_ra8_ls_cpu1_data_end |
| CPU1 .data run-region end. | |
| uint32_t | g_ra8_ls_cpu1_data_load |
| CPU1 .data load image (in MRAM_CPU1). | |
| uint32_t | g_ra8_ls_cpu1_bss_start |
| CPU1 .bss start (in SRAM_CPU1). | |
| uint32_t | g_ra8_ls_cpu1_bss_end |
| CPU1 .bss end. | |
| const uintptr_t | g_cpu1_vector_table [] |
CPU1 (Cortex-M33 secondary core) image: blink LED1 forever.
This is the firmware that runs on the RA8D2's second core, the Cortex-M33. It is compiled as a wholly separate ELF (-mcpu=cortex-m33) and embedded into the M85 ELF as a .cpu1_image blob; the M85 releases this core at runtime via ra8_cpu1_release (HUM Ch 2.9.1 "CPU control registers"), then sleeps.
Its job is intentionally tiny so the dual-core plumbing is what stands out: it drives board LED1 (BLUE, P600 = PORT6 pin 0) high and low forever with a bounded busy-delay between toggles. A blinking LED that the M85 never touches is honest proof the M33 came out of reset and is executing its own code – on silicon and in the ra8_emulator GPIO/LED view alike.
Definition in file cpu1_main.c.
| enum m33_blink_const_t : uint32_t |
PCNTR1 bit fields for LED1 and the blink-loop delay bound.
PCNTR1 packs the direction latch PDR in its low half and the output latch PODR in its high half, so pin 0 is held an output (PDR bit 0) while its level is set by PODR bit 0 (bit 16 of the word).
| Enumerator | |
|---|---|
| k_led1_pdr_out | PCNTR1 PDR pin 0 = output direction. |
| k_led1_podr_on | PCNTR1 PODR pin 0 = drive high (bit 16). |
| k_blink_spins | Bounded busy-delay spins per LED half-cycle. |
Definition at line 69 of file cpu1_main.c.
| enum m33_port_addr_t : uintptr_t |
MMIO address of the PORT6 control register driving LED1.
The EK-RA8D2 LED1 (BLUE) is P600 = PORT6 pin 0. The PORT block base is 0x40400000 with a 0x20 per-port stride, so PORT6 PCNTR1 lives at 0x40400000 + 6 * 0x20 = 0x404000C0 (HUM Ch 20 "I/O Ports").
| Enumerator | |
|---|---|
| k_port6_pcntr1_addr | PORT6 PCNTR1: {PODR[31:16], PDR[15:0]}. |
Definition at line 57 of file cpu1_main.c.
|
static |
CPU1 default fault handler: park the core.
Every M33 exception slot routes here. The core stops making forward progress; on hardware a watchdog (if enabled) eventually resets.
Definition at line 168 of file cpu1_main.c.
|
static |
CPU1 application loop: blink LED1 (BLUE, P600) forever.
Holds PORT6 pin 0 an output via PCNTR1.PDR and toggles its PODR level on each pass, with a bounded busy-delay between toggles so the blink is visible. The M85 never writes this pin, so the transitions prove the M33 is running. See the file header.
Definition at line 94 of file cpu1_main.c.
References k_blink_spins, k_led1_pdr_out, k_led1_podr_on, and k_port6_pcntr1_addr.
| void cpu1_reset_handler | ( | void | ) |
CPU1 reset handler: minimal C-runtime init, then enter cpu1_main.
The M33 boots with uninitialised RAM, so before any C code runs this copies .data from its MRAM_CPU1 load image into SRAM_CPU1 and zeroes .bss. The linker exports the region bounds as g_ra8_ls_cpu1_* symbols.
Definition at line 132 of file cpu1_main.c.
References cpu1_main(), g_ra8_ls_cpu1_bss_end, g_ra8_ls_cpu1_bss_start, g_ra8_ls_cpu1_data_end, g_ra8_ls_cpu1_data_load, and g_ra8_ls_cpu1_data_start.
| const uintptr_t g_cpu1_vector_table[] |
Definition at line 189 of file cpu1_main.c.
|
extern |
CPU1 .bss end.
|
extern |
CPU1 .bss start (in SRAM_CPU1).
|
extern |
CPU1 .data run-region end.
|
extern |
CPU1 .data load image (in MRAM_CPU1).
|
extern |
CPU1 .data run-region start (in SRAM_CPU1).
|
extern |
CPU1 stack top (slot 0 of the M33 vector table).