ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_ofs.c File Reference

RA boot-ROM Option Function Select register defaults. More...

#include "ra8_ofs.h"
#include <stdint.h>
Include dependency graph for ra8_ofs.c:

Go to the source code of this file.

Macros

#define BSP_CFG_OPTION_SETTING_OFS0   (0xFFFFFFFFU)
 BSP CFG OPTION SETTING OFS0.
#define BSP_CFG_OPTION_SETTING_OFS1   (0xFFFFFFFFU)
 BSP CFG OPTION SETTING OFS1.
#define BSP_CFG_OPTION_SETTING_OFS2   (0xFFFFFFFFU)
 BSP CFG OPTION SETTING OFS2.
#define BSP_CFG_OPTION_SETTING_OFS3   (0xFFFFFFFFU)
 BSP CFG OPTION SETTING OFS3.
#define BSP_CFG_OPTION_SETTING_SAS   (0xFFFFFFFFU)
 BSP CFG OPTION SETTING SAS.
#define BSP_CFG_OPTION_SETTING_OFS1_SEC   (0xFFFFFFFFU)
 BSP CFG OPTION SETTING OFS1 SEC.
#define BSP_CFG_OPTION_SETTING_OFS1_SEL   (0xFFFFFFFFU)
 BSP CFG OPTION SETTING OFS1 SEL.
#define BSP_CFG_OPTION_SETTING_OFS3_SEC   (0xFFFFFFFFU)
 BSP CFG OPTION SETTING OFS3 SEC.
#define BSP_CFG_OPTION_SETTING_OFS3_SEL   (0xFFFFFFFFU)
 BSP CFG OPTION SETTING OFS3 SEL.
#define BSP_CFG_OPTION_SETTING_BPS   (0xFFFFFFFFU)
 BSP CFG OPTION SETTING BPS.
#define BSP_CFG_OPTION_SETTING_BPS_SEC   (0xFFFFFFFFU)
 BSP CFG OPTION SETTING BPS SEC.
#define BSP_CFG_OPTION_SETTING_OTP_FSBLCTRL0   (0xFFFFFFFFU)
 BSP CFG OPTION SETTING OTP FSBLCTRL0.
#define BSP_CFG_OPTION_SETTING_OTP_FSBLCTRL1   (0xFFFFFFFFU)
 BSP CFG OPTION SETTING OTP FSBLCTRL1.
#define BSP_CFG_OPTION_SETTING_OTP_FSBLCTRL2   (0xFFFFFFFFU)
 BSP CFG OPTION SETTING OTP FSBLCTRL2.
#define BSP_CFG_OPTION_SETTING_OTP_SAMR   (0xFFFFFFFFU)
 BSP CFG OPTION SETTING OTP SAMR.
#define BSP_CFG_OPTION_SETTING_OTP_PBPS   (0xFFFFFFFFU)
 BSP CFG OPTION SETTING OTP PBPS.
#define BSP_CFG_OPTION_SETTING_OTP_PBPS_SEC   (0xFFFFFFFFU)
 BSP CFG OPTION SETTING OTP PBPS SEC.
#define BSP_CFG_OPTION_SETTING_OTP_ZHUK   (0xFFFFFFFFU)
 BSP CFG OPTION SETTING OTP ZHUK.
#define RA8_SECTION(name)
 RA8 SECTION.

Functions

uint8_t ra8_ofs_word_count (void)
 Return the number of option-setting words present on the device.

Variables

static const uint32_t s_ra8_ofs0 = (0xFFFFFFFFU)
static const uint32_t s_ra8_ofs1 = (0xFFFFFFFFU)
static const uint32_t s_ra8_ofs2 = (0xFFFFFFFFU)
static const uint32_t s_ra8_ofs3 = (0xFFFFFFFFU)
static const uint32_t s_ra8_sas = (0xFFFFFFFFU)
static const uint32_t s_ra8_ofs1_sec = (0xFFFFFFFFU)
static const uint32_t s_ra8_ofs1_sel = (0xFFFFFFFFU)
static const uint32_t s_ra8_ofs3_sec = (0xFFFFFFFFU)
static const uint32_t s_ra8_ofs3_sel = (0xFFFFFFFFU)
static const uint32_t s_ra8_bps = (0xFFFFFFFFU)
static const uint32_t s_ra8_bps_sec = (0xFFFFFFFFU)
static const uint32_t s_ra8_otp_fsblctrl0 = (0xFFFFFFFFU)
static const uint32_t s_ra8_otp_fsblctrl1 = (0xFFFFFFFFU)
static const uint32_t s_ra8_otp_fsblctrl2 = (0xFFFFFFFFU)
static const uint32_t s_ra8_otp_samr = (0xFFFFFFFFU)
static const uint32_t s_ra8_otp_pbps = (0xFFFFFFFFU)
static const uint32_t s_ra8_otp_pbps_sec = (0xFFFFFFFFU)
static const uint32_t s_ra8_otp_zhuk = (0xFFFFFFFFU)

Detailed Description

RA boot-ROM Option Function Select register defaults.

Emits 32-bit constants into the .option_setting_* linker sections defined in src/linker_script.ld. The RA8D2 boot ROM reads these regions directly out of MRAM before the Cortex-M85 reset vector runs, so they configure:

  • OFS0: IWDT auto-start, brown-out reset, HOCO post-reset, security MPU, TrustZone boundaries.
  • OFS1: LVD0 reset / VCC voltage monitoring.
  • OFS2: extended oscillator settings, DPFPU.
  • OFS3: RA8-family extended settings + M33-side WDT1. RA8D2 only – see the device-gating note below.
  • SAS: secure/non-secure attribution for the entire flash address space.
  • OFS1_SEC/SEL, OFS3_SEC/SEL: TrustZone secure-attribute selectors.
  • BPS, BPS_SEC: block-protection configuration.
  • OTP_*: one-time-programmable anti-rollback and boot-secure fields.

Every entry here is defined as 0xFFFFFFFF which is the "erased / default / permissive" value – exactly what a freshly erased MRAM part would contain. This means:

  • IWDT disabled (OFS0 default)
  • LVD0 disabled (OFS1 default)
  • Full flash / TrustZone access (SAS default)
  • No OTP anti-rollback (OTP_* defaults)

Safe for bring-up, NOT appropriate for production. A real deployment should override each of these with a vetted value in a tamper-resistant build step.

OFS3 is NOT device-gated: both parts have it

The OFS3 word – plus its OFS3_SEC / OFS3_SEL TrustZone selectors – carries the M33-side (CPU1) WDT1 auto-start fields, and is present on BOTH supported parts at the same addresses with the same bit fields: RA8D2 HUM R01UH1065EJ0130 Ch 7.2.6 p 287 / Ch 7.2.7 p 289, and RA8P1 HUM R01UH1064EJ0130 Ch 7.2.6 p 288 / Ch 7.2.7 p 290. The whole OFS3 family is therefore emitted unconditionally.

Issue #223 previously gated these three emissions out of RA8P1 builds behind RA8_HAS_OFS3, on the strength of FSP's BSP_FEATURE_BSP_HAS_OFS3 == 0 for ra8p1 – a value that contradicts Renesas' own RA8P1 manual. The effect was an RA8P1 image with no OFS3 word at all, leaving WDT1's boot-latched configuration unprogrammed. Removed in #516; see ra8_ofs.h.

Overriding

The easy way: #define BSP_CFG_OPTION_SETTING_OFS0 (0x12345678U) before including this file from another translation unit. For compile-time programming, define the same macros via -D in CMakeLists.txt.

Placement

Each entry uses __attribute__((section(".option_setting_xxx"))) matching the section names in src/linker_script.ld. The used attribute prevents the linker from discarding the constants even though nothing references them from C.

Since
0.1.0

Definition in file ra8_ofs.c.

Macro Definition Documentation

◆ BSP_CFG_OPTION_SETTING_BPS

#define BSP_CFG_OPTION_SETTING_BPS   (0xFFFFFFFFU)

BSP CFG OPTION SETTING BPS.

Definition at line 120 of file ra8_ofs.c.

◆ BSP_CFG_OPTION_SETTING_BPS_SEC

#define BSP_CFG_OPTION_SETTING_BPS_SEC   (0xFFFFFFFFU)

BSP CFG OPTION SETTING BPS SEC.

Definition at line 124 of file ra8_ofs.c.

◆ BSP_CFG_OPTION_SETTING_OFS0

#define BSP_CFG_OPTION_SETTING_OFS0   (0xFFFFFFFFU)

BSP CFG OPTION SETTING OFS0.

Definition at line 84 of file ra8_ofs.c.

◆ BSP_CFG_OPTION_SETTING_OFS1

#define BSP_CFG_OPTION_SETTING_OFS1   (0xFFFFFFFFU)

BSP CFG OPTION SETTING OFS1.

Definition at line 88 of file ra8_ofs.c.

◆ BSP_CFG_OPTION_SETTING_OFS1_SEC

#define BSP_CFG_OPTION_SETTING_OFS1_SEC   (0xFFFFFFFFU)

BSP CFG OPTION SETTING OFS1 SEC.

Definition at line 104 of file ra8_ofs.c.

◆ BSP_CFG_OPTION_SETTING_OFS1_SEL

#define BSP_CFG_OPTION_SETTING_OFS1_SEL   (0xFFFFFFFFU)

BSP CFG OPTION SETTING OFS1 SEL.

Definition at line 108 of file ra8_ofs.c.

◆ BSP_CFG_OPTION_SETTING_OFS2

#define BSP_CFG_OPTION_SETTING_OFS2   (0xFFFFFFFFU)

BSP CFG OPTION SETTING OFS2.

Definition at line 92 of file ra8_ofs.c.

◆ BSP_CFG_OPTION_SETTING_OFS3

#define BSP_CFG_OPTION_SETTING_OFS3   (0xFFFFFFFFU)

BSP CFG OPTION SETTING OFS3.

Definition at line 96 of file ra8_ofs.c.

◆ BSP_CFG_OPTION_SETTING_OFS3_SEC

#define BSP_CFG_OPTION_SETTING_OFS3_SEC   (0xFFFFFFFFU)

BSP CFG OPTION SETTING OFS3 SEC.

Definition at line 112 of file ra8_ofs.c.

◆ BSP_CFG_OPTION_SETTING_OFS3_SEL

#define BSP_CFG_OPTION_SETTING_OFS3_SEL   (0xFFFFFFFFU)

BSP CFG OPTION SETTING OFS3 SEL.

Definition at line 116 of file ra8_ofs.c.

◆ BSP_CFG_OPTION_SETTING_OTP_FSBLCTRL0

#define BSP_CFG_OPTION_SETTING_OTP_FSBLCTRL0   (0xFFFFFFFFU)

BSP CFG OPTION SETTING OTP FSBLCTRL0.

Definition at line 128 of file ra8_ofs.c.

◆ BSP_CFG_OPTION_SETTING_OTP_FSBLCTRL1

#define BSP_CFG_OPTION_SETTING_OTP_FSBLCTRL1   (0xFFFFFFFFU)

BSP CFG OPTION SETTING OTP FSBLCTRL1.

Definition at line 132 of file ra8_ofs.c.

◆ BSP_CFG_OPTION_SETTING_OTP_FSBLCTRL2

#define BSP_CFG_OPTION_SETTING_OTP_FSBLCTRL2   (0xFFFFFFFFU)

BSP CFG OPTION SETTING OTP FSBLCTRL2.

Definition at line 136 of file ra8_ofs.c.

◆ BSP_CFG_OPTION_SETTING_OTP_PBPS

#define BSP_CFG_OPTION_SETTING_OTP_PBPS   (0xFFFFFFFFU)

BSP CFG OPTION SETTING OTP PBPS.

Definition at line 144 of file ra8_ofs.c.

◆ BSP_CFG_OPTION_SETTING_OTP_PBPS_SEC

#define BSP_CFG_OPTION_SETTING_OTP_PBPS_SEC   (0xFFFFFFFFU)

BSP CFG OPTION SETTING OTP PBPS SEC.

Definition at line 148 of file ra8_ofs.c.

◆ BSP_CFG_OPTION_SETTING_OTP_SAMR

#define BSP_CFG_OPTION_SETTING_OTP_SAMR   (0xFFFFFFFFU)

BSP CFG OPTION SETTING OTP SAMR.

Definition at line 140 of file ra8_ofs.c.

◆ BSP_CFG_OPTION_SETTING_OTP_ZHUK

#define BSP_CFG_OPTION_SETTING_OTP_ZHUK   (0xFFFFFFFFU)

BSP CFG OPTION SETTING OTP ZHUK.

Definition at line 152 of file ra8_ofs.c.

◆ BSP_CFG_OPTION_SETTING_SAS

#define BSP_CFG_OPTION_SETTING_SAS   (0xFFFFFFFFU)

BSP CFG OPTION SETTING SAS.

Definition at line 100 of file ra8_ofs.c.

◆ RA8_SECTION

#define RA8_SECTION ( name)
Value:
[[gnu::used, gnu::section(name)]]

RA8 SECTION.

Definition at line 169 of file ra8_ofs.c.

Function Documentation

◆ ra8_ofs_word_count()

uint8_t ra8_ofs_word_count ( void )

Return the number of option-setting words present on the device.

Yields k_ra8_ofs_word_count – 4 (OFS0..OFS3) on both RA8D2 and RA8P1. Lets device-agnostic tooling size an OFS iteration without a magic literal.

There is deliberately no companion ra8_ofs_has_ofs3(): both supported parts carry OFS3 (see the file header for the per-part HUM citations), so such a predicate could only ever return true and would assert nothing.

Returns
The OFS word count for the build target.
Return values
4OFS0, OFS1, OFS2, OFS3 – the quartet both parts implement.
Precondition
The device selection in ra8_device.h resolved to exactly one part.
k_ra8_ofs_word_count is defined by ra8_ofs_word_t.
Postcondition
No hardware or global state is modified.
Return value is 4 – never zero.
Note
Thread-safe: pure function of a compile-time constant, no shared state.
See also
ra8_ofs_word_t
Since
0.1.0

Definition at line 230 of file ra8_ofs.c.

References k_ra8_ofs_word_count, and ra8_ofs_word_count().

Referenced by ra8_ofs_word_count().

Variable Documentation

◆ s_ra8_bps

const uint32_t s_ra8_bps = (0xFFFFFFFFU)
static

Definition at line 196 of file ra8_ofs.c.

◆ s_ra8_bps_sec

const uint32_t s_ra8_bps_sec = (0xFFFFFFFFU)
static

Definition at line 199 of file ra8_ofs.c.

◆ s_ra8_ofs0

const uint32_t s_ra8_ofs0 = (0xFFFFFFFFU)
static

Definition at line 172 of file ra8_ofs.c.

◆ s_ra8_ofs1

const uint32_t s_ra8_ofs1 = (0xFFFFFFFFU)
static

Definition at line 174 of file ra8_ofs.c.

◆ s_ra8_ofs1_sec

const uint32_t s_ra8_ofs1_sec = (0xFFFFFFFFU)
static

Definition at line 183 of file ra8_ofs.c.

◆ s_ra8_ofs1_sel

const uint32_t s_ra8_ofs1_sel = (0xFFFFFFFFU)
static

Definition at line 186 of file ra8_ofs.c.

◆ s_ra8_ofs2

const uint32_t s_ra8_ofs2 = (0xFFFFFFFFU)
static

Definition at line 176 of file ra8_ofs.c.

◆ s_ra8_ofs3

const uint32_t s_ra8_ofs3 = (0xFFFFFFFFU)
static

Definition at line 178 of file ra8_ofs.c.

◆ s_ra8_ofs3_sec

const uint32_t s_ra8_ofs3_sec = (0xFFFFFFFFU)
static

Definition at line 191 of file ra8_ofs.c.

◆ s_ra8_ofs3_sel

const uint32_t s_ra8_ofs3_sel = (0xFFFFFFFFU)
static

Definition at line 194 of file ra8_ofs.c.

◆ s_ra8_otp_fsblctrl0

const uint32_t s_ra8_otp_fsblctrl0 = (0xFFFFFFFFU)
static

Definition at line 202 of file ra8_ofs.c.

◆ s_ra8_otp_fsblctrl1

const uint32_t s_ra8_otp_fsblctrl1 = (0xFFFFFFFFU)
static

Definition at line 205 of file ra8_ofs.c.

◆ s_ra8_otp_fsblctrl2

const uint32_t s_ra8_otp_fsblctrl2 = (0xFFFFFFFFU)
static

Definition at line 208 of file ra8_ofs.c.

◆ s_ra8_otp_pbps

const uint32_t s_ra8_otp_pbps = (0xFFFFFFFFU)
static

Definition at line 214 of file ra8_ofs.c.

◆ s_ra8_otp_pbps_sec

const uint32_t s_ra8_otp_pbps_sec = (0xFFFFFFFFU)
static

Definition at line 217 of file ra8_ofs.c.

◆ s_ra8_otp_samr

const uint32_t s_ra8_otp_samr = (0xFFFFFFFFU)
static

Definition at line 211 of file ra8_ofs.c.

◆ s_ra8_otp_zhuk

const uint32_t s_ra8_otp_zhuk = (0xFFFFFFFFU)
static

Definition at line 220 of file ra8_ofs.c.

◆ s_ra8_sas

const uint32_t s_ra8_sas = (0xFFFFFFFFU)
static

Definition at line 180 of file ra8_ofs.c.