Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions arch.mk
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,61 @@ ifeq ($(ARCH),ARM)
CFLAGS+=-I$(PICO_SDK_PATH)/src/common/pico_stdlib_headers/include
endif

ifeq ($(TARGET),rtl8735b)
# RealTek RTL8735B SoC (Cortex-M33), e.g. the AmebaPro2 EVB. wolfBoot is
# staged into SRAM by the RealTek bootloader and copies the verified app
# from external SPI NOR into DDR before jumping (src/update_ram.c RAMBOOT).
CORTEX_M33=1
CFLAGS+=-Ihal
# ASDK 10.3.0 toolchain (system arm-none-eabi-gcc clashes on newlib/lwip).
CROSS_COMPILE:=$(ASDK_PATH)/arm-none-eabi-
UPDATE_OBJS:=src/update_ram.o
CFLAGS+=-DWOLFBOOT_DUALBOOT
CFLAGS+=-ffunction-sections -fdata-sections
LDFLAGS+=-Wl,--gc-sections
# Flash/UART/cache backend: "sdk" (default, RealTek SDK drivers) or "bare"
# (smaller, no SDK dependency -- not yet implemented). See hal/rtl8735b.c.
HAL_BACKEND?=sdk
ifeq ($(HAL_BACKEND),sdk)
CFLAGS+=-DHAL_BACKEND_SDK
# The SDK backend folds the RealTek SDK driver chain into hal/rtl8735b.o.
# Its objects.h pulls the SDK's "hal.h" (defines flash_t,
# hal_audio_adapter_t, ...); wolfBoot also ships "hal.h". hal/rtl8735b.c
# does not include wolfBoot's hal.h, and the SDK dirs are passed with
# -iquote (searched before the global -I for quoted includes) so the SDK
# objects.h "hal.h" resolves to the SDK one for THIS object only. sdk-shim
# supplies a stub cmsis_os.h so the chain does not pull CMSIS-OS/FreeRTOS
# (wolfBoot never calls it). The CONFIG_* defines mirror the bare-metal
# bootloader build; -mcmse satisfies the SDK cache header (SCB_NS). The
# rest of wolfBoot stays plain M33.
HAL_SDK_IQUOTE=-iquote $(WOLFBOOT_ROOT)/hal/rtl8735b/sdk-shim \
-iquote $(AMEBA_SDK)/component/mbed/hal_ext \
-iquote $(AMEBA_SDK)/component/mbed/hal \
-iquote $(AMEBA_SDK)/component/mbed/api \
-iquote $(AMEBA_SDK)/component/mbed/targets/hal/rtl8735b \
-iquote $(AMEBA_SDK)/component/soc/8735b/fwlib/rtl8735b/include \
-iquote $(AMEBA_SDK)/component/soc/8735b/fwlib/rtl8735b/lib/include \
-iquote $(AMEBA_SDK)/component/soc/8735b/cmsis/rtl8735b/include \
-iquote $(AMEBA_SDK)/component/soc/8735b/cmsis/rtl8735b/lib/include \
-iquote $(AMEBA_SDK)/component/soc/8735b/cmsis/cmsis-core/include \
-iquote $(AMEBA_SDK)/component/soc/8735b/app/rtl_printf/include \
-iquote $(AMEBA_SDK)/component/soc/8735b/app/stdio_port \
-iquote $(AMEBA_SDK)/component/soc/8735b/misc/utilities/include \
-iquote $(AMEBA_SDK)/component/os/os_dep/include
# The same dirs as plain -I too, so angle-bracket includes (e.g. some
# CMSIS-Core headers) resolve; -iquote only covers quoted includes.
HAL_SDK_INC=$(patsubst -iquote,-I,$(HAL_SDK_IQUOTE))
HAL_SDK_DEFS=-DCONFIG_PLATFORM_8735B -DCONFIG_RTL8735B_PLATFORM=1 \
-DCONFIG_BUILD_RAM=1
hal/rtl8735b.o: CFLAGS += $(HAL_SDK_IQUOTE) $(HAL_SDK_INC) $(HAL_SDK_DEFS) -mcmse -Wno-error
# Final link also needs the SDK fwlib + ROM symbol table; point at the
# prebuilt SDK lib/objects and ROM symbol linker file during bring-up:
# make TARGET=rtl8735b LIBS+=... LDFLAGS_EXTRA="-T<rom_symbol.ld>"
else
CFLAGS+=-DHAL_BACKEND_BARE
endif
endif

ifeq ($(TARGET),sama5d3)
CORTEX_A5=1
UPDATE_OBJS:=src/update_ram.o
Expand Down
58 changes: 58 additions & 0 deletions config/examples/rtl8735b.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
ARCH?=ARM
TARGET?=rtl8735b
SIGN?=ECC256
HASH?=SHA256

# ECC256 + SHA256 header fits in 256 bytes
IMAGE_HEADER_SIZE?=256

# Cortex-M33 (single, non-TrustZone secure world for Model A)
CORTEX_M33?=1
TZEN?=0
VTOR?=1
NO_MPU?=1

# wolfBoot is staged into SRAM by the RealTek bootloader (not XIP). It reads the
# BOOT/UPDATE/SWAP partitions from external SPI NOR and copies the verified
# application into DDR before jumping (src/update_ram.c RAMBOOT path).
NO_XIP?=1
EXT_FLASH?=1
SPI_FLASH?=0
WOLFBOOT_DUALBOOT?=1

# wolfBoot runs entirely from SRAM, so RAM_CODE relocation is unnecessary.
RAM_CODE?=0

DEBUG?=0
DEBUG_UART?=1
V?=0
SPMATH?=1
ALLOW_DOWNGRADE?=0
NVM_FLASH_WRITEONCE?=0

WOLFBOOT_VERSION?=1

# 4 KB SPI NOR sector (flash_erase_sector granularity)
WOLFBOOT_SECTOR_SIZE?=0x1000

# DDR base the verified application is copied to and launched from. Must match
# the application's vector-table link address (Risk: confirm valid DDR base).
WOLFBOOT_LOAD_ADDRESS?=0x70000000

# External SPI NOR partition layout. These are raw NOR byte offsets addressed
# only by ext_flash_*; they must not overlap the RealTek partition table
# (PARTBL/cert/boot/PT_FW1=wolfBoot/ISP/VOE). PT_FW1 holds wolfBoot itself.
# NOTE: placeholders -- confirm against the EVB amebapro2_partitiontable.json
# before flashing so they land in genuinely free NOR.
WOLFBOOT_PARTITION_SIZE?=0x180000
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x1000000
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x1180000
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x1300000

# Flash/UART/cache backend: "sdk" (default, RealTek SDK drivers) or "bare"
# (smaller, no SDK dependency -- not yet implemented).
HAL_BACKEND?=sdk

# RealTek SDK + ASDK toolchain locations (override on the command line).
AMEBA_SDK?=$(HOME)/GitHub/ameba-rtos-pro2
ASDK_PATH?=$(HOME)/ameba-pro2-workspace/asdk/asdk-10.3.0/linux/newlib/bin
Loading
Loading