Skip to content

Add wolfBoot HAL port for RealTek RTL8735B (AmebaPro2)#797

Draft
dgarske wants to merge 1 commit into
wolfSSL:masterfrom
dgarske:rtl8735b_amebapro2
Draft

Add wolfBoot HAL port for RealTek RTL8735B (AmebaPro2)#797
dgarske wants to merge 1 commit into
wolfSSL:masterfrom
dgarske:rtl8735b_amebapro2

Conversation

@dgarske

@dgarske dgarske commented Jun 15, 2026

Copy link
Copy Markdown
Member

Adds wolfBoot support for the RealTek RTL8735B (Arm Cortex-M33) as used on the AmebaPro2 EVB. wolfBoot runs as a second-stage verified bootloader and A/B firmware-update engine on top of RealTek's secure-boot ROM -- the non-TrustZone "Model A" integration.

How it boots

RealTek ROM -> boot.bin -> wolfBoot (staged into SRAM via a RealTek RAM start-table) -> verifies the application in external SPI NOR (ECDSA P-256 / SHA-256), applies any pending A/B update, copies the verified image into DDR, and jumps. This reuses wolfBoot's existing RAMBOOT path (EXT_FLASH + NO_XIP, src/update_ram.c); no new boot assembly is required.

What's included

  • hal/rtl8735b.c / hal/rtl8735b.ld: single-file HAL -- HAL entry points, ext_flash_* over the RealTek SPI NOR, the RAM start-table + trampoline, cache maintenance, a self-contained DEBUG_UART console, and a reset-reason readout. Flash/UART/cache backend selected by HAL_BACKEND (sdk = default/working; bare = scaffold).
  • config/examples/rtl8735b.config and an arch.mk target block.
  • tools/scripts/rtl8735b_build.sh (compile + SDK-resolved final link) and tools/scripts/amebapro2_package.sh (wrap wolfboot.elf into a flashable flash_ntz.bin).
  • hal/rtl8735b/test-app/: a minimal DDR test application (also demonstrates servicing the vendor watchdog).
  • docs/Targets.md section (build, staging an app, A/B update, watchdog, status/roadmap) and hal/rtl8735b/README.

Verified on the AmebaPro2 EVB

  • DEBUG_UART console and signed boot of an application from the BOOT partition (verify -> copy to DDR -> jump).
  • A/B update (version-based selection), rollback / anti-downgrade fail-safe, and fault-tolerant fallback to a valid redundant image.
  • Reset-reason diagnostic and the vendor-watchdog handoff (the application services it).

Follow-ons (not in this PR)

See the "Status and roadmap" list in the docs/Targets.md section: device-bound encrypted updates bound to the Hardware Unique Key (wolfSSL PR #10677), TrustZone-M "Model B", the no-SDK "bare" backend, and measured boot / DICE.

@dgarske dgarske self-assigned this Jun 15, 2026
Copilot AI review requested due to automatic review settings June 15, 2026 22:42

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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds initial wolfBoot HAL enablement for the RealTek RTL8735B (AmebaPro2) platform, including build integration and packaging support for producing a flashable image using the vendor SDK tooling.

Changes:

  • Introduces a new RTL8735B HAL implementation and linker script for SRAM-staged boot.
  • Adds an SDK shim header to avoid pulling FreeRTOS/CMSIS-OS into the wolfBoot build.
  • Adds build system wiring (arch.mk), example config, and a packaging script to generate flash_ntz.bin.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tools/scripts/amebapro2_package.sh Adds packaging flow to convert wolfboot.elf into a vendor-style flash image.
hal/rtl8735b/sdk-shim/cmsis_os.h Provides CMSIS-OS opaque typedefs to compile SDK headers without FreeRTOS.
hal/rtl8735b/README Documents the RTL8735B HAL design, backends, and SDK integration approach.
hal/rtl8735b.ld Defines SRAM layout, RAM start-table placement, and partition symbols.
hal/rtl8735b.c Implements RTL8735B HAL + RAM start-table/trampoline + SDK-backed ext flash/cache hooks.
config/examples/rtl8735b.config Provides an example configuration for RTL8735B builds and partition layout.
arch.mk Adds TARGET=rtl8735b build integration and SDK include/define wiring.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tools/scripts/amebapro2_package.sh
Comment thread hal/rtl8735b.ld Outdated
Comment thread hal/rtl8735b.c
Comment thread hal/rtl8735b.c Outdated
Comment thread arch.mk Outdated
@dgarske dgarske force-pushed the rtl8735b_amebapro2 branch 3 times, most recently from 5301be9 to 833e5bb Compare June 16, 2026 23:05
@dgarske dgarske requested a review from Copilot June 16, 2026 23:05

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Comment thread tools/scripts/rtl8735b_build.sh
Comment thread tools/scripts/rtl8735b_build.sh Outdated
Comment thread tools/scripts/amebapro2_package.sh
Comment thread docs/Targets.md Outdated

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.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Comment thread hal/rtl8735b.c
Comment on lines +423 to +442
int ext_flash_read(uintptr_t address, uint8_t *data, int len)
{
if (len <= 0) {
return -1;
}
#ifdef HAL_BACKEND_SDK
/* flash_stream_read returns 1 on success; propagate a read failure rather
* than handing potentially-stale data to the verifier. */
if (flash_stream_read(&hal_flash_obj, (uint32_t)address, (uint32_t)len,
data) != 1) {
return -1;
}
return len;
#else
/* TODO(bare): implement via direct SPIC / ROM hal_flash_stream_read. */
(void)address;
(void)data;
return -1;
#endif
}
Comment thread hal/rtl8735b.c
Comment on lines +444 to +462
int ext_flash_write(uintptr_t address, const uint8_t *data, int len)
{
if (len <= 0) {
return -1;
}
#ifdef HAL_BACKEND_SDK
/* flash_stream_write returns 1 on success; propagate a write failure. */
if (flash_stream_write(&hal_flash_obj, (uint32_t)address, (uint32_t)len,
(uint8_t *)data) != 1) {
return -1;
}
return 0;
#else
/* TODO(bare): implement via direct SPIC / ROM hal_flash_burst_write. */
(void)address;
(void)data;
return -1;
#endif
}
Comment thread hal/rtl8735b.c
Comment on lines +390 to +403
int hal_flash_write(uint32_t address, const uint8_t *data, int len)
{
(void)address;
(void)data;
(void)len;
return 0;
}

int hal_flash_erase(uint32_t address, int len)
{
(void)address;
(void)len;
return 0;
}
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.

2 participants