ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_device.h
Go to the documentation of this file.
1
55
56#pragma once
57
58#ifdef __cplusplus
59extern "C" {
60#endif
61
62#include <stdint.h>
63
64/* -------------------------------------------------------------------------- */
65/* Device selection */
66/* -------------------------------------------------------------------------- */
67
68/*
69 * Exactly one device must be selected. Default to RA8D2 when the compile
70 * command names neither, so pre-existing RA8D2 firmware builds and the
71 * host unit-test build (which pass no -DRA8_DEVICE_* flag) keep the RA8D2
72 * behaviour they have today, with zero source churn.
73 */
74#if !defined(RA8_DEVICE_RA8D2) && !defined(RA8_DEVICE_RA8P1)
76#define RA8_DEVICE_RA8D2 (1)
77#endif
78
79#if defined(RA8_DEVICE_RA8D2) && defined(RA8_DEVICE_RA8P1)
80#error "ra8_device.h: define at most one of RA8_DEVICE_RA8D2 / RA8_DEVICE_RA8P1"
81#endif
82
99typedef enum : uint16_t {
102#ifdef RA8_DEVICE_RA8P1
104#else
106#endif
108
109/* -------------------------------------------------------------------------- */
110/* Feature-presence flags */
111/* -------------------------------------------------------------------------- */
112
113/*
114 * Build-configuration flags (an explicitly-allowed macro use: they gate
115 * conditional compilation, not integer arithmetic). Prefer these semantic
116 * names over `#if defined(RA8_DEVICE_RA8P1)` in feature-guarded code so the
117 * intent ("this chip has an NPU") survives the arrival of a future part.
118 *
119 * The delta set below is the COMPLETE list of hardware differences found from
120 * primary sources; every other peripheral, base address, and memory region is
121 * identical across the two parts.
122 *
123 * NOTE (issue #224): an earlier draft of this delta set listed a "legacy
124 * ETHERC/EDMAC MAC at 0x40354000" as an RA8P1-only addition. That was a misread
125 * and is deliberately absent here. The RA8P1 Hardware User's Manual
126 * (R01UH1064EJ0130) and datasheet (R01DS0439EJ0130) contain no ETHERC block,
127 * none of the classic ETHERC/EDMAC registers (ECMR / EDMR / ...), and nothing
128 * based at 0x40354000 (that window is USBHS 0x40351000 / SCI 0x40358000 /
129 * SPI 0x4035C000). The token "EDMAC" appears only in the Buses chapter, where
130 * BOTH manuals state verbatim that "EDMAC ... means the GWCA function of ESWM"
131 * -- the descriptor-DMA bus initiator of the shared R-Switch, which the RA8D2
132 * has too. The RA8P1's only Ethernet is the same R-Switch / ESWM subsystem as
133 * the RA8D2 (identical HUM chapters 30-36 and register bases), so there is no
134 * ETHERC feature flag. Do not re-add one without a primary-source register map.
135 *
136 * NOTE (issue #516): an earlier draft also listed "OFS3 / WDT1 option register"
137 * as RA8D2-only, behind an `RA8_HAS_OFS3` flag. That was a misread of Renesas
138 * FSP metadata and is deliberately absent here. BOTH parts have OFS3: RA8P1 HUM
139 * R01UH1064EJ0130 Ch 7.2.6 "OFS3, OFS3_SEC : Option Function Select Register 3"
140 * p 288 and Ch 7.2.7 "OFS3_SEL ... for Security" p 290 document the same word,
141 * at the same addresses and with the same WDT1 bit fields, as RA8D2 HUM
142 * R01UH1065EJ0130 Ch 7.2.6 p 287 / Ch 7.2.7 p 289. The RA8P1 likewise has the
143 * WDT1 that OFS3 configures (datasheet R01DS0439EJ0130: "Watchdog Timer (WDT)
144 * x 2"; WDT1 at 0x4020_2600). FSP's `BSP_FEATURE_BSP_HAS_OFS3` is 0 for ra8p1,
145 * which contradicts Renesas' own manual and has no consumer in open FSP source;
146 * it is not evidence. Do not re-add an OFS3 feature flag.
147 */
148#ifdef RA8_DEVICE_RA8P1
150#define RA8_HAS_NPU \
151 (1)
154#define RA8_HAS_NPUCLK (1)
155#else
156/* RA8_HAS_NPU / RA8_HAS_NPUCLK intentionally undefined (NPU is RA8P1-only). */
157#endif
158
174typedef enum : uint8_t {
175#ifdef RA8_DEVICE_RA8P1
176 k_ra8_feat_npu = 1U,
177 k_ra8_feat_npuclk = 1U,
178#else
181#endif
183
184/* -------------------------------------------------------------------------- */
185/* Memory map */
186/* -------------------------------------------------------------------------- */
187
206typedef enum : uintptr_t {
207 k_ra8_mem_mram_base = 0x02000000U,
208 k_ra8_mem_itcm_base = 0x00000000U,
209 k_ra8_mem_dtcm_base = 0x20000000U,
210 k_ra8_mem_sram_base = 0x22000000U,
211 k_ra8_mem_sdram_base = 0x68000000U,
215
232typedef enum : uint32_t {
233 k_ra8_mem_mram_size = 0x00100000U,
234 k_ra8_mem_sram_size = 0x001A0000U,
235 k_ra8_mem_itcm_size = 0x00010000U,
236 k_ra8_mem_dtcm_size = 0x00010000U,
238
239#ifdef __cplusplus
240}
241#endif
ra8_device_mem_base_t
Base addresses of the on-chip / external memory regions.
Definition ra8_device.h:206
@ k_ra8_mem_sram_base
On-chip system SRAM (ECC), 1664 KB.
Definition ra8_device.h:210
@ k_ra8_mem_ospi_cs0_base
OSPI/xSPI CS0 XIP window.
Definition ra8_device.h:212
@ k_ra8_mem_ospi_cs1_base
OSPI/xSPI CS1 XIP window.
Definition ra8_device.h:213
@ k_ra8_mem_itcm_base
M85 instruction TCM window.
Definition ra8_device.h:208
@ k_ra8_mem_dtcm_base
M85 data TCM window.
Definition ra8_device.h:209
@ k_ra8_mem_mram_base
Code MRAM (non-volatile), 1 MB.
Definition ra8_device.h:207
@ k_ra8_mem_sdram_base
External SDRAM data window (EK: 64 MB).
Definition ra8_device.h:211
ra8_device_mem_size_t
Sizes (bytes) of the on-chip memory regions for the current device.
Definition ra8_device.h:232
@ k_ra8_mem_itcm_size
64 KB ITCM (linker floor; see
Definition ra8_device.h:235
@ k_ra8_mem_mram_size
1 MB code MRAM (both parts).
Definition ra8_device.h:233
@ k_ra8_mem_sram_size
1664 KB system SRAM (both parts).
Definition ra8_device.h:234
@ k_ra8_mem_dtcm_size
64 KB DTCM (linker floor; see
Definition ra8_device.h:236
ra8_device_feature_t
Runtime-readable (0/1) mirror of the RA8_HAS_* presence flags.
Definition ra8_device.h:174
@ k_ra8_feat_npu
Ethos-U55 NPU: absent on RA8D2.
Definition ra8_device.h:179
@ k_ra8_feat_npuclk
NPUCLK clock domain: absent on RA8D2.
Definition ra8_device.h:180
ra8_device_id_t
Stable numeric identity of each supported RA8 device.
Definition ra8_device.h:99
@ k_ra8_device_ra8p1
Renesas RA8P1, R7KA8P1KFLCAC (HUM R01UH1064EJ).
Definition ra8_device.h:101
@ k_ra8_device_current
Device selected by this build.
Definition ra8_device.h:105
@ k_ra8_device_ra8d2
Renesas RA8D2, R7KA8D2KFLCAC (HUM R01UH1065EJ).
Definition ra8_device.h:100