ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_ofs.c
Go to the documentation of this file.
1
72
73#include "ra8_ofs.h" /* OFS word inventory. */
74
75#include <stdint.h>
76
77/* =============================================================================
78 * Defaults (override by defining the macro before including this file)
79 * =============================================================================
80 */
81
82#ifndef BSP_CFG_OPTION_SETTING_OFS0
84#define BSP_CFG_OPTION_SETTING_OFS0 (0xFFFFFFFFU)
85#endif
86#ifndef BSP_CFG_OPTION_SETTING_OFS1
88#define BSP_CFG_OPTION_SETTING_OFS1 (0xFFFFFFFFU)
89#endif
90#ifndef BSP_CFG_OPTION_SETTING_OFS2
92#define BSP_CFG_OPTION_SETTING_OFS2 (0xFFFFFFFFU)
93#endif
94#ifndef BSP_CFG_OPTION_SETTING_OFS3
96#define BSP_CFG_OPTION_SETTING_OFS3 (0xFFFFFFFFU)
97#endif
98#ifndef BSP_CFG_OPTION_SETTING_SAS
100#define BSP_CFG_OPTION_SETTING_SAS (0xFFFFFFFFU)
101#endif
102#ifndef BSP_CFG_OPTION_SETTING_OFS1_SEC
104#define BSP_CFG_OPTION_SETTING_OFS1_SEC (0xFFFFFFFFU)
105#endif
106#ifndef BSP_CFG_OPTION_SETTING_OFS1_SEL
108#define BSP_CFG_OPTION_SETTING_OFS1_SEL (0xFFFFFFFFU)
109#endif
110#ifndef BSP_CFG_OPTION_SETTING_OFS3_SEC
112#define BSP_CFG_OPTION_SETTING_OFS3_SEC (0xFFFFFFFFU)
113#endif
114#ifndef BSP_CFG_OPTION_SETTING_OFS3_SEL
116#define BSP_CFG_OPTION_SETTING_OFS3_SEL (0xFFFFFFFFU)
117#endif
118#ifndef BSP_CFG_OPTION_SETTING_BPS
120#define BSP_CFG_OPTION_SETTING_BPS (0xFFFFFFFFU)
121#endif
122#ifndef BSP_CFG_OPTION_SETTING_BPS_SEC
124#define BSP_CFG_OPTION_SETTING_BPS_SEC (0xFFFFFFFFU)
125#endif
126#ifndef BSP_CFG_OPTION_SETTING_OTP_FSBLCTRL0
128#define BSP_CFG_OPTION_SETTING_OTP_FSBLCTRL0 (0xFFFFFFFFU)
129#endif
130#ifndef BSP_CFG_OPTION_SETTING_OTP_FSBLCTRL1
132#define BSP_CFG_OPTION_SETTING_OTP_FSBLCTRL1 (0xFFFFFFFFU)
133#endif
134#ifndef BSP_CFG_OPTION_SETTING_OTP_FSBLCTRL2
136#define BSP_CFG_OPTION_SETTING_OTP_FSBLCTRL2 (0xFFFFFFFFU)
137#endif
138#ifndef BSP_CFG_OPTION_SETTING_OTP_SAMR
140#define BSP_CFG_OPTION_SETTING_OTP_SAMR (0xFFFFFFFFU)
141#endif
142#ifndef BSP_CFG_OPTION_SETTING_OTP_PBPS
144#define BSP_CFG_OPTION_SETTING_OTP_PBPS (0xFFFFFFFFU)
145#endif
146#ifndef BSP_CFG_OPTION_SETTING_OTP_PBPS_SEC
148#define BSP_CFG_OPTION_SETTING_OTP_PBPS_SEC (0xFFFFFFFFU)
149#endif
150#ifndef BSP_CFG_OPTION_SETTING_OTP_ZHUK
152#define BSP_CFG_OPTION_SETTING_OTP_ZHUK (0xFFFFFFFFU)
153#endif
154
155/* =============================================================================
156 * Section-placed constants
157 * =============================================================================
158 *
159 * The `used` attribute prevents the linker from discarding the
160 * constants even though nothing references them from C. The linker
161 * script pins each section to a fixed MRAM address.
162 */
163
164#if defined(UNIT_TEST) || defined(RA8_OFF_TARGET) || defined(__APPLE__)
166#define RA8_SECTION(name) [[gnu::used]]
167#else
169#define RA8_SECTION(name) [[gnu::used, gnu::section(name)]]
170#endif
171
172RA8_SECTION(".option_setting_ofs0") static const uint32_t s_ra8_ofs0 = BSP_CFG_OPTION_SETTING_OFS0;
173
174RA8_SECTION(".option_setting_ofs1") static const uint32_t s_ra8_ofs1 = BSP_CFG_OPTION_SETTING_OFS1;
175
176RA8_SECTION(".option_setting_ofs2") static const uint32_t s_ra8_ofs2 = BSP_CFG_OPTION_SETTING_OFS2;
177
178RA8_SECTION(".option_setting_ofs3") static const uint32_t s_ra8_ofs3 = BSP_CFG_OPTION_SETTING_OFS3;
179
180RA8_SECTION(".option_setting_sas") static const uint32_t s_ra8_sas = BSP_CFG_OPTION_SETTING_SAS;
181
182RA8_SECTION(".option_setting_ofs1_sec")
184
185RA8_SECTION(".option_setting_ofs1_sel")
187
188/* OFS3_SEC / OFS3_SEL are the TrustZone secure-attribution selectors for OFS3,
189 * present on both parts alongside it. */
190RA8_SECTION(".option_setting_ofs3_sec")
192
193RA8_SECTION(".option_setting_ofs3_sel")
195
196RA8_SECTION(".option_setting_bps") static const uint32_t s_ra8_bps = BSP_CFG_OPTION_SETTING_BPS;
197
198RA8_SECTION(".option_setting_bps_sec")
200
201RA8_SECTION(".option_setting_otp_fsblctrl0")
203
204RA8_SECTION(".option_setting_otp_fsblctrl1")
206
207RA8_SECTION(".option_setting_otp_fsblctrl2")
209
210RA8_SECTION(".option_setting_otp_samr")
212
213RA8_SECTION(".option_setting_otp_pbps")
215
216RA8_SECTION(".option_setting_otp_pbps_sec")
218
219RA8_SECTION(".option_setting_otp_zhuk")
221
222/* =============================================================================
223 * OFS boot-map inventory -- contract in ra8_ofs.h
224 * =============================================================================
225 *
226 * Gives the rest of the firmware a runtime-callable, host-testable view of the
227 * compile-time OFS layout. A pure function of a compile-time constant.
228 */
229
231{
232 return (uint8_t)k_ra8_ofs_word_count;
233}
#define BSP_CFG_OPTION_SETTING_OTP_FSBLCTRL2
BSP CFG OPTION SETTING OTP FSBLCTRL2.
Definition ra8_ofs.c:136
#define BSP_CFG_OPTION_SETTING_OFS3_SEL
BSP CFG OPTION SETTING OFS3 SEL.
Definition ra8_ofs.c:116
static const uint32_t s_ra8_ofs3
Definition ra8_ofs.c:178
static const uint32_t s_ra8_sas
Definition ra8_ofs.c:180
static const uint32_t s_ra8_otp_zhuk
Definition ra8_ofs.c:220
static const uint32_t s_ra8_ofs1_sec
Definition ra8_ofs.c:183
static const uint32_t s_ra8_bps_sec
Definition ra8_ofs.c:199
#define BSP_CFG_OPTION_SETTING_SAS
BSP CFG OPTION SETTING SAS.
Definition ra8_ofs.c:100
static const uint32_t s_ra8_ofs0
Definition ra8_ofs.c:172
static const uint32_t s_ra8_otp_fsblctrl0
Definition ra8_ofs.c:202
#define BSP_CFG_OPTION_SETTING_OFS3
BSP CFG OPTION SETTING OFS3.
Definition ra8_ofs.c:96
static const uint32_t s_ra8_otp_fsblctrl1
Definition ra8_ofs.c:205
#define BSP_CFG_OPTION_SETTING_OTP_FSBLCTRL0
BSP CFG OPTION SETTING OTP FSBLCTRL0.
Definition ra8_ofs.c:128
#define BSP_CFG_OPTION_SETTING_OFS2
BSP CFG OPTION SETTING OFS2.
Definition ra8_ofs.c:92
#define BSP_CFG_OPTION_SETTING_OTP_PBPS
BSP CFG OPTION SETTING OTP PBPS.
Definition ra8_ofs.c:144
#define BSP_CFG_OPTION_SETTING_OFS0
BSP CFG OPTION SETTING OFS0.
Definition ra8_ofs.c:84
#define BSP_CFG_OPTION_SETTING_OTP_ZHUK
BSP CFG OPTION SETTING OTP ZHUK.
Definition ra8_ofs.c:152
static const uint32_t s_ra8_otp_samr
Definition ra8_ofs.c:211
#define BSP_CFG_OPTION_SETTING_OTP_SAMR
BSP CFG OPTION SETTING OTP SAMR.
Definition ra8_ofs.c:140
#define BSP_CFG_OPTION_SETTING_OFS1
BSP CFG OPTION SETTING OFS1.
Definition ra8_ofs.c:88
static const uint32_t s_ra8_bps
Definition ra8_ofs.c:196
#define BSP_CFG_OPTION_SETTING_BPS
BSP CFG OPTION SETTING BPS.
Definition ra8_ofs.c:120
#define RA8_SECTION(name)
RA8 SECTION.
Definition ra8_ofs.c:169
static const uint32_t s_ra8_ofs1
Definition ra8_ofs.c:174
static const uint32_t s_ra8_ofs2
Definition ra8_ofs.c:176
static const uint32_t s_ra8_ofs1_sel
Definition ra8_ofs.c:186
static const uint32_t s_ra8_otp_pbps_sec
Definition ra8_ofs.c:217
#define BSP_CFG_OPTION_SETTING_OFS1_SEC
BSP CFG OPTION SETTING OFS1 SEC.
Definition ra8_ofs.c:104
static const uint32_t s_ra8_otp_fsblctrl2
Definition ra8_ofs.c:208
static const uint32_t s_ra8_ofs3_sel
Definition ra8_ofs.c:194
#define BSP_CFG_OPTION_SETTING_BPS_SEC
BSP CFG OPTION SETTING BPS SEC.
Definition ra8_ofs.c:124
#define BSP_CFG_OPTION_SETTING_OFS3_SEC
BSP CFG OPTION SETTING OFS3 SEC.
Definition ra8_ofs.c:112
#define BSP_CFG_OPTION_SETTING_OFS1_SEL
BSP CFG OPTION SETTING OFS1 SEL.
Definition ra8_ofs.c:108
#define BSP_CFG_OPTION_SETTING_OTP_PBPS_SEC
BSP CFG OPTION SETTING OTP PBPS SEC.
Definition ra8_ofs.c:148
static const uint32_t s_ra8_otp_pbps
Definition ra8_ofs.c:214
static const uint32_t s_ra8_ofs3_sec
Definition ra8_ofs.c:191
#define BSP_CFG_OPTION_SETTING_OTP_FSBLCTRL1
BSP CFG OPTION SETTING OTP FSBLCTRL1.
Definition ra8_ofs.c:132
Option Function Select (OFS) boot-map inventory for the active RA8 device.
@ k_ra8_ofs_word_count
OFS word count: 4 on both parts.
Definition ra8_ofs.h:84
uint8_t ra8_ofs_word_count(void)
Return the number of option-setting words present on the device.
Definition ra8_ofs.c:230