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

Option Function Select (OFS) boot-map inventory for the active RA8 device. More...

#include <stdint.h>
Include dependency graph for ra8_ofs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  ra8_ofs_word_t : uint8_t {
  k_ra8_ofs_word_ofs0 = 0U ,
  k_ra8_ofs_word_ofs1 = 1U ,
  k_ra8_ofs_word_ofs2 = 2U ,
  k_ra8_ofs_word_ofs3 = 3U ,
  k_ra8_ofs_word_count = 4U
}
 Ordinal identity of each option-setting word present on this device. More...
enum  ra8_ofs_addr_t : uintptr_t {
  k_ra8_ofs0_addr = 0x02C9F040UL ,
  k_ra8_ofs3_addr = 0x12C9F4C4UL ,
  k_ra8_ofs3_sec_addr = 0x02C9F0C4UL ,
  k_ra8_ofs3_sel_addr = 0x02C9F124UL
}
 Runtime-readable addresses of the option-setting words. More...

Functions

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

Detailed Description

Option Function Select (OFS) boot-map inventory for the active RA8 device.

Tag
[Ring 3 / HAL] {World: S}

The RA8 boot ROM latches a fixed set of "option-setting" words out of a dedicated config-flash region before the Cortex-M85 reset vector runs. The writable side of those words is emitted by ra8_ofs.c into the .option_setting_* linker sections; ra8_ofs_addr_t below names the same cells for the read-back direction, so this header is the single C-side home for both.

This header is the single C-side source of truth for which OFS words the RA8 parts carry. Both supported parts carry the identical OFS0 / OFS1 / OFS2 / OFS3 quartet, so the inventory is device-invariant:

  • RA8D2 – HUM R01UH1065EJ0130 Ch 7 "Option-Setting Memory", Figure 7.1 p 279; OFS3 at Ch 7.2.6 p 287, OFS3_SEL at Ch 7.2.7 p 289.
  • RA8P1 – HUM R01UH1064EJ0130 Ch 7 "Option-Setting Memory"; OFS3 at Ch 7.2.6 p 288, OFS3_SEL at Ch 7.2.7 p 290. Same addresses, same WDT1 bit fields (WDT1STRT / WDT1TOPS / WDT1CKS / WDT1RPES / WDT1RPSS / WDT1RSTIRQS / WDT1STPCTL) as the RA8D2.

OFS3 holds the M33-side (CPU1) WDT1 auto-start fields, and both parts have the WDT1 it configures (RA8P1 datasheet R01DS0439EJ0130: "Watchdog Timer (WDT) x 2", WDT1 at 0x4020_2600).

Warning
Issue #223 previously gated OFS3 out of RA8P1 builds behind an RA8_HAS_OFS3 macro, on the strength of Renesas FSP's BSP_FEATURE_BSP_HAS_OFS3 == 0 for ra8p1. That FSP value contradicts Renesas' own RA8P1 manual and drives no open FSP source; a RASC-generated RA8P1 project emits the OFS3 sections. The gating was removed in #516 – do not reintroduce it without a primary-source citation showing the word is absent.
Note
Host-friendly: compile-time constants only, touches no hardware, so it builds unchanged under RA8_OFF_TARGET and in the host unit tests.
See also
ra8_device.h RA8D2/RA8P1 compile-time device switch.
ra8_ofs.c Emits the writable option-setting words into flash.
Since
0.1.0

Definition in file ra8_ofs.h.

Enumeration Type Documentation

◆ ra8_ofs_addr_t

enum ra8_ofs_addr_t : uintptr_t

Runtime-readable addresses of the option-setting words.

These are the addresses a running image loads from to recover what the boot ROM latched. The option-setting words live in the extra-MRAM "Configuration setting area", which is ordinary addressable memory – HUM Ch 7.1 Figure 7.1 "Option-setting memory area" p 279 maps the whole region, and #315 proved on the bench that extra-MRAM cells read back with valid ECC.

Each constant is the address the HUM prints in that register's own section:

Word Address Region Section RA8D2 p RA8P1 p
OFS0 0x02C9_F040 Secure 7.2.1 280 280
OFS3 0x12C9_F4C4 Non-secure 7.2.6 287 288
OFS3_SEC 0x02C9_F0C4 Secure 7.2.6 287 288
OFS3_SEL 0x02C9_F124 Secure 7.2.7 289 290

Both supported parts place them identically; only the page numbers shift.

Note
Alias, not drift. BASE_MC is 0x0200_0000 (Secure) or 0x1200_0000 (Non-secure) – HUM Ch 59 Table 59.16 – so 0x02.. and 0x12.. address the same cell through the two TrustZone aliases. OPTION_SETTING_ADDR in scripts/checks/check_linker_scripts.py normalises every word to the secure alias because it governs programming; OFS3 therefore reads 0x02C9F4C4 there and 0x12C9_F4C4 here. Both are correct for their direction. See #543, which tracks whether the programming side should move to the non-secure alias the HUM prints.
Warning
OFS0, OFS3_SEC and OFS3_SEL are all in the Secure region (Figure 7.1 p 279), so a non-secure load from them does not return garbage – it faults. Non-secure callers must reach them through a veneer; ra8_wdt_ofs_reader_set() is the injection seam for that.
Invariant
Every value lies inside the extra-MRAM option-setting region and never in the 0x0300_0000..0x07FF_FFFF Reserved window.
Example:
uint32_t ofs0 = *(const volatile uint32_t*)k_ra8_ofs0_addr;
@ k_ra8_ofs0_addr
OFS0 – IWDT + WDT0 fields (Secure).
Definition ra8_ofs.h:138
See also
ra8_ofs_word_t Ordinal identity of the same words.
ra8_wdt_ofs_get() Decodes the WDT view of OFS0 / OFS3.
Since
0.1.0
Enumerator
k_ra8_ofs0_addr 

OFS0 – IWDT + WDT0 fields (Secure).

k_ra8_ofs3_addr 

OFS3 – WDT1 fields (Non-secure alias).

k_ra8_ofs3_sec_addr 

OFS3_SEC – WDT1 fields (Secure).

k_ra8_ofs3_sel_addr 

OFS3_SEL – per-field S/NS selector.

Definition at line 136 of file ra8_ofs.h.

◆ ra8_ofs_word_t

enum ra8_ofs_word_t : uint8_t

Ordinal identity of each option-setting word present on this device.

The values are contiguous ordinals (0, 1, 2, ...), NOT flash addresses – they name the OFS words the active device exposes so runtime code can iterate or select without a magic-number literal. The programming addresses live in each app's linker_script.ld; the runtime-read addresses live in ra8_ofs_addr_t below.

The quartet is the same on every part this tree supports, so no member is device-conditional.

Invariant
k_ra8_ofs_word_count equals the number of OFS words the device has – 4 on both RA8D2 and RA8P1.
See also
ra8_ofs_word_count()
Since
0.1.0
Enumerator
k_ra8_ofs_word_ofs0 

OFS0: IWDT/BOR/HOCO/security/TrustZone (both parts).

k_ra8_ofs_word_ofs1 

OFS1: LVD0 reset / VCC monitor (both parts).

k_ra8_ofs_word_ofs2 

OFS2: extended oscillator settings (both parts).

k_ra8_ofs_word_ofs3 

OFS3: M33-side (CPU1) WDT1 fields (both parts).

k_ra8_ofs_word_count 

OFS word count: 4 on both parts.

Definition at line 79 of file ra8_ofs.h.

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().