Add wolfBoot HAL port for RealTek RTL8735B (AmebaPro2)#797
Draft
dgarske wants to merge 1 commit into
Draft
Conversation
Contributor
There was a problem hiding this comment.
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.
5301be9 to
833e5bb
Compare
e1989c6 to
fcce147
Compare
Comment on lines
+32
to
+41
| # Compile all objects. The default link of wolfboot.elf is expected to fail here | ||
| # (unresolved SDK/ROM symbols); capture the object list from its [LD] line. | ||
| make TARGET=rtl8735b 2>/tmp/rtl8735b_make_err.txt \ | ||
| | grep -A1 '\[LD\] wolfboot.elf' | tail -1 > /tmp/rtl8735b_objs.txt || true | ||
| OBJS="$(cat /tmp/rtl8735b_objs.txt)" | ||
| if ! echo "$OBJS" | grep -q 'hal/rtl8735b.o'; then | ||
| echo "error: object compile failed (no hal/rtl8735b.o in link line). make stderr:" >&2 | ||
| tail -8 /tmp/rtl8735b_make_err.txt >&2 | ||
| exit 1 | ||
| fi |
Comment on lines
+43
to
+51
| # Make the ROM symbol table visible to the linker. | ||
| grep -q 'romsym_is.so' config/target.ld || \ | ||
| sed -i '1i INCLUDE "romsym_is.so"' config/target.ld | ||
|
|
||
| "$CC" -mcpu=cortex-m33 -mthumb -mfpu=fpv5-sp-d16 -mfloat-abi=softfp \ | ||
| -ffreestanding -nostartfiles --specs=nosys.specs \ | ||
| -T config/target.ld \ | ||
| -L "$SDKREL/ROM/GCC" -L "$SDKREL/application/output" \ | ||
| $OBJS \ |
Comment on lines
+12
to
+21
| # Override via environment: | ||
| # AMEBA_SDK RealTek ameba-rtos-pro2 checkout | ||
| # ASDK_PATH ASDK 10.3.0 toolchain bin dir | ||
| # OUTDIR work/output dir (default /tmp/wolfboot_amebapro2_pkg) | ||
| set -e | ||
|
|
||
| WOLFBOOT_ELF="${1:-wolfboot.elf}" | ||
| AMEBA_SDK="${AMEBA_SDK:-$HOME/GitHub/ameba-rtos-pro2}" | ||
| ASDK_PATH="${ASDK_PATH:-$HOME/ameba-pro2-workspace/asdk/asdk-10.3.0/linux/newlib/bin}" | ||
| OUTDIR="${OUTDIR:-/tmp/wolfboot_amebapro2_pkg}" |
| tools/scripts/amebapro2_package.sh wolfboot.elf | ||
| ``` | ||
|
|
||
| For the default `sdk` backend, `make TARGET=rtl8735b` compiles every wolfBoot object (including the RealTek SDK driver chain folded into `hal/rtl8735b.o`), but the final `wolfboot.elf` link must resolve the SDK SoC libraries (`liboutsrc.a`, `libsoc_ntz.a`) and the ROM symbol table (`romsym_is.so`), which live in the SDK build tree. `tools/scripts/rtl8735b_build.sh` runs that compile-then-SDK-resolved-link, and `tools/scripts/amebapro2_package.sh` then packages wolfBoot (in `PT_FW1`) with the RealTek partition table, boot, and certs via `elf2bin` into `flash_ntz.bin`. Both honor `AMEBA_SDK`/`ASDK_PATH`. See `hal/rtl8735b/README`. |
fcce147 to
0e6c1f1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-containedDEBUG_UARTconsole, and a reset-reason readout. Flash/UART/cache backend selected byHAL_BACKEND(sdk= default/working;bare= scaffold).config/examples/rtl8735b.configand anarch.mktarget block.tools/scripts/rtl8735b_build.sh(compile + SDK-resolved final link) andtools/scripts/amebapro2_package.sh(wrapwolfboot.elfinto a flashableflash_ntz.bin).hal/rtl8735b/test-app/: a minimal DDR test application (also demonstrates servicing the vendor watchdog).docs/Targets.mdsection (build, staging an app, A/B update, watchdog, status/roadmap) andhal/rtl8735b/README.Verified on the AmebaPro2 EVB
DEBUG_UARTconsole and signed boot of an application from the BOOT partition (verify -> copy to DDR -> jump).Follow-ons (not in this PR)
See the "Status and roadmap" list in the
docs/Targets.mdsection: 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.