Skip to content

Add Renesas RX71M support - #942

Open
yosuke-wolfssl wants to merge 5 commits into
wolfSSL:masterfrom
yosuke-wolfssl:feat/rx71m
Open

yosuke-wolfssl wants to merge 5 commits into
wolfSSL:masterfrom
yosuke-wolfssl:feat/rx71m

Conversation

@yosuke-wolfssl

@yosuke-wolfssl yosuke-wolfssl commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds wolfBoot support for the Renesas RX71M (RSK+ RX71M, R5F571MLCDFC: 4 MB code flash, 512 KB RAM, no TSIP), using software crypto only. It builds with GCC for Renesas RX 14.2 (Makefile, USE_GCC=0) and with CC-RX V3.08 (e2 studio projects).

Changes (hal/renesas-rx.c)

  • Target wiring: config/examples/renesas-rx71m.config, hal/rx71m.ld and arch.mk checks. NVM_FLASH_WRITEONCE=1 is required; PKA=1 and DELTA_UPDATES=1 are rejected.
  • Boot tables (src/boot_renesas.c): the RXv2 fault vectors go to INT_Fault. RomCodeArea[] keeps ROMCODE (0xFFFFFF9C) at 0xFFFFFFFF, so ROM code protection stays off. The option-setting memory is written only with the opt-in WOLFBOOT_RENESAS_OSM.
  • Clock, UART, LED: 24 MHz crystal × 10 gives 240 MHz (RX_MAIN_XTAL_HZ sets the crystal for other boards). The console is on SCI7 (P90/P92), and LED0 is on P03. Before starting the app, hal_prepare_boot() switches back to the LOCO and stops the PLL and main oscillator (WOLFBOOT_RESTORE_CLOCK).
  • Code flash driver:
    • copies the FCU firmware to FCURAM at init
    • programs 256-byte units, each at most once per erase (FLASH_ERR_NOT_BLANK otherwise)
    • runs from RAM with interrupts masked during each program and erase, with timeouts and FSTATR error checks
    • GCC: #error unless RAM_CODE and __WOLFBOOT are defined. CC-RX: #pragma section FRAM, copied to RAM by copyfuncs() in hal_flash_init(); FPCKAR follows the BSP clock settings
  • Shared RX changes: uart_write() waits for TEND after the last character. The test app calls hal_init() before printing, and its printPart() reads the state through wolfBoot_get_partition_state(). test-app/RENESAS_RX.ld places .ramcode in RAM, so the RX65N/RX72N test apps now run the flash driver from RAM too (build-tested only).
  • CC-RX e2 studio projects (IDE/Renesas/e2studio/RX71M): wolfBoot and app_RenesasRX01 with Smart Configurator r_bsp 7.71 settings, the same flash layout, header and partition flags as the GCC config, and a Readme. make_images.sh copies only code flash sections, so the option-setting memory that the BSP puts in every CC-RX output never reaches an image. Console output goes to the e2 studio virtual console (BSP stdio).
  • CI: two RX71M build jobs (little endian; big endian with OSM), plus a check that ROMCODE in wolfboot.bin is 0xFFFFFFFF.
  • Docs: a Renesas RX71M section in docs/Targets.md (layout, flashing with rfp-cli, update wear, OSM and endianness) and an RX71M entry in docs/Renesas.md.

Verification

On the RSK+ RX71M with an E2 Lite:

  • GCC: boot and signature check, wolfBoot_success() across reset, update to v2, rollback, confirm, and an update interrupted twice by reset all pass. One 3-sector update made 144 erases, all returning 0; PSW.I is masked during program/erase and restored after.
  • CC-RX: boot and signature check, wolfBoot_success(), update to v2 and confirm pass (e2 studio virtual console). Both projects build with 0 errors, and every flash driver function links into RAM.
  • The CC-RX changes leave the GCC images byte-identical. CI builds GCC only (CC-RX needs a commercial licence); big endian and OSM are build-tested in CI only.

@yosuke-wolfssl yosuke-wolfssl self-assigned this Oct 16, 2026
Copilot AI balanced review requested due to automatic review settings October 16, 2026 06:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Flash timeout handling can continue writing to a full buffer or resume execution before code flash is readable.

2 open findings
What changed in this PR

Adds Renesas RX71M support to wolfBoot using software cryptography and the GNU RX toolchain.

Changes:

  • Adds target configuration, linker layout, boot vectors, and board initialization.
  • Implements RAM-resident flash programming and erase operations.
  • Adds build coverage, ROMCODE checks, and setup documentation.
File Description
test-app/​RENESAS_RX.ld Places flash routines in RAM.
test-app/​Makefile Enables RAM execution for the RX71M driver.
test-app/​app_renesas_rx.c Reads partition state through the public API.
src/​boot_renesas.c Adds RX71M fault vectors and protection settings.
hal/​rx71m.ld Defines RX71M memory and section layout.
hal/​rx71m.c Identifies the shared HAL implementation.
hal/​renesas-rx.h Adds RX71M registers and flash constants.
hal/​renesas-rx.c Implements board initialization and flash operations.
docs/​Targets.md Documents RX71M setup and limitations.
docs/​Renesas.md Lists RX71M support.
config/​examples/​renesas-rx71m.config Supplies the example target configuration.
arch.mk Adds target checks and build flags.
.github/​workflows/​test-configs.yml Adds RX71M build variants.
.github/​workflows/​test-build-renesas-rx.yml Checks the ROMCODE protection word.
.github/​docker/​renesas-rx/​README.md Lists RX71M among supported configurations.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread hal/renesas-rx.c Outdated
Comment thread hal/renesas-rx.c Outdated

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #942

Scan targets checked: wolfboot-src, wolfboot-bugs
Not reviewed (no scan target covers them): .github/docker/renesas-rx/README.md, .github/workflows/test-build-renesas-rx.yml, .github/workflows/test-configs.yml, arch.mk, config/examples/renesas-rx71m.config, docs/Renesas.md, docs/Targets.md, hal/renesas-rx.h, hal/rx71m.ld, test-app/Makefile, test-app/RENESAS_RX.ld
Coverage: 3 of 4 in-scope changed file(s) opened by the reviewer; not opened: hal/rx71m.c

Fenrir result: Approved ✅

No new issues found in the changed files.

Advisory only — this automated result does not count as a GitHub approval.

Review tier: Lite

- renesas-rx71m.config, rx71m.ld, rx71m.c: RSK+ RX71M layout with
  NVM_FLASH_WRITEONCE=1, .romcode at 0xFFFFFF80 and .ofs_rx71m at
  0x00120040.
- arch.mk: reject PKA, DELTA_UPDATES and NVM_FLASH_WRITEONCE other
  than 1 for rx71m; build with -misa=v2; drop .ofs_rx71m from
  wolfboot.bin and fill gaps with 0xFF.
- renesas-rx.h: rx71m clock, flash, FACI and MPC values;
  hal_clk_init() sets SYS_MEMWAIT.
- boot_renesas.c: INT_Fault for the rx71m fault vectors,
  RomCodeArea[] with ROMCODE 0xFFFFFFFF, and the option-setting
  array under WOLFBOOT_RENESAS_OSM.
- hal_clk_init(): rx71m runs the main crystal (RX_MAIN_XTAL_HZ,
  default 24MHz) through the PLL to 240MHz.
- hal_prepare_boot(): under WOLFBOOT_RESTORE_CLOCK, switch to the
  LOCO and stop the PLL and main oscillator on rx71m.
- uart_init(): SCI7 on P90/P92 by default; uart_write() waits for
  TEND. hal_led_on()/hal_led_off(): LED0 on P03.
- renesas-rx.c: TARGET_rx71m flash driver run from RAM, with #error
  unless RAM_CODE and __WOLFBOOT are defined. It copies the FCU
  firmware at init, programs 256-byte units at most once per erase,
  and masks interrupts with timeouts and FSTATR checks for each
  program and erase.
- renesas-rx.h: PSW, FASTAT and FAEINT bits and the new flash
  error codes.
- renesas-rx71m.config: commented RX_MAIN_XTAL_HZ line.
- test-app: link .ramcode into RAM and build renesas-rx.o with
  RAM_CODE and __WOLFBOOT for rx71m.
- app_renesas_rx.c: printPart() takes the partition id and reads the
  state through wolfBoot_get_partition_state(); the trailer line
  prints BOOT or none.
- main() calls hal_init() before printing.
- test-configs.yml: RX71M build jobs, little endian and
  BIG_ENDIAN=1 with WOLFBOOT_RENESAS_OSM.
- test-build-renesas-rx.yml: check that ROMCODE in wolfboot.bin is
  0xFFFFFFFF for rx71m.
- Targets.md: Renesas RX71M section; Renesas.md and the CI image
  README list RX71M.

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #942

Scan targets checked: wolfboot-src, wolfboot-bugs
Not reviewed (no scan target covers them): .github/docker/renesas-rx/README.md, .github/workflows/test-build-renesas-rx.yml, .github/workflows/test-configs.yml, arch.mk, config/examples/renesas-rx71m.config, docs/Renesas.md, docs/Targets.md, hal/renesas-rx.h, hal/rx71m.ld, test-app/Makefile, test-app/RENESAS_RX.ld
Coverage: 1 of 2 in-scope changed file(s) opened by the reviewer; not opened: test-app/app_renesas_rx.c

Fenrir result: Approved ✅

No new issues found in the changed files.

Advisory only — this automated result does not count as a GitHub approval.

Review tier: Lite

- hal/renesas-rx.c builds the RX71M flash driver with CC-RX: the
  driver runs from RAM through #pragma section FRAM and copyfuncs(),
  and FPCKAR follows the BSP clock settings.
- IDE/Renesas/e2studio/RX71M holds the wolfBoot and app_RenesasRX01
  CC-RX projects, their headers, make_images.sh and a Readme.
- docs/Renesas.md and docs/Targets.md point to the new projects, and
  .gitignore lists their build and generated folders.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants