arch/arm: add Realtek RTL8721Dx and RTL8720F (Ameba WHC) support

Add the ARM architecture-level support and build system for the Realtek
Ameba WHC (Wi-Fi Host Controller) dual-core SoCs:

  - RTL8721Dx (KM4 Cortex-M33 host + KM0 NP)
  - RTL8720F  (KM4TZ Cortex-M33 secure host + KM4NS NP)

New directories under arch/arm/src/:
  - common/ameba/   -- IC-agnostic glue (os_wrapper, netdev, KV store,
                       flash MTD, WHC Wi-Fi, SDK bootstrap)
  - rtl8721dx/      -- RTL8721Dx register-level drivers
  - rtl8720f/       -- RTL8720F register-level drivers

New directories under arch/arm/include/:
  - rtl8721dx/      -- RTL8721Dx IRQ and chip headers
  - rtl8720f/       -- RTL8720F IRQ and chip headers

Also includes tools/nxstyle.c white-list entries for the Realtek SDK
CamelCase symbols and tools/ameba/Config.mk for the make flash target.

Signed-off-by: raul_chen <raul_chen@realsil.com.cn>
This commit is contained in:
raul_chen 2026-07-01 16:04:59 +08:00 committed by Alan C. Assis
parent cded268559
commit 6574028920
57 changed files with 10307 additions and 35 deletions

74
tools/ameba/Config.mk Normal file
View file

@ -0,0 +1,74 @@
############################################################################
# tools/ameba/Config.mk
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
#
# Realtek Ameba WHC flashing support.
#
# Including this fragment in a board's scripts/Make.defs (after
# ameba_board.mk) adds the `flash` target. Usage:
#
# make flash AMEBA_PORT=/dev/ttyUSB0 [ AMEBA_BAUD=1500000 ]
#
# The board must set AMEBA_FLASH_PROFILE to the profile base name
# (e.g. "RTL8721Dx" or "RTL8720F") before including this file.
#
# AMEBA_PORT -- serial port (required)
# AMEBA_BAUD -- baud rate (default 1500000)
#
# Dependencies:
# The ameba-rtos SDK must already be fetched (auto-fetched on first
# build) and its python venv or dep-ful system python must be on PATH
# so that AmebaFlash.py (from the SDK) can import its dependencies.
# AMEBA_BAUD -- serial baud rate (default 1500000)
AMEBA_BAUD ?= 1500000
# FLASH -- Download the built images via the SDK's AmebaFlash.py
define FLASH
$(Q) if [ -z "$(AMEBA_PORT)" ]; then \
echo "FLASH error: Missing serial port device argument."; \
echo "USAGE: make flash AMEBA_PORT=/dev/ttyUSB0 [ AMEBA_BAUD=$(AMEBA_BAUD) ]"; \
exit 1; \
fi
$(Q) AMEBAPY="$$(cat $(AMEBA_SDK)/.amebapy/bindir 2>/dev/null)/python"; \
if [ ! -x "$$AMEBAPY" ]; then \
AMEBAPY="python3"; \
fi; \
SCRIPT="$(AMEBA_SDK)/tools/ameba/Flash/AmebaFlash.py"; \
if [ ! -f "$$SCRIPT" ]; then \
echo "FLASH error: AmebaFlash.py not found at $$SCRIPT"; \
echo " Has the ameba-rtos SDK been fetched? Run make first."; \
exit 1; \
fi; \
PROFILE="$(AMEBA_SDK)/tools/ameba/Flash/Devices/Profiles/$(AMEBA_FLASH_PROFILE).rdev"; \
if [ ! -f "$$PROFILE" ]; then \
echo "FLASH error: profile not found: $$PROFILE"; \
echo " Set AMEBA_FLASH_PROFILE in the board's Make.defs."; \
exit 1; \
fi; \
$$AMEBAPY "$$SCRIPT" \
--download \
--profile "$$PROFILE" \
--image-dir "$(TOPDIR)" \
--port "$(AMEBA_PORT)" \
--baudrate "$(or $(AMEBA_BAUD),1500000)" \
--log-level info
endef

View file

@ -257,6 +257,32 @@ static const char *g_white_prefix[] =
*/
"uxrCustom", /* uxrCustomTransport */
/* Ref: arch/arm/src/common/ameba, arch/arm/src/rtl8721dx,
* arch/arm/src/rtl8720f and the matching boards.
* Realtek Ameba SDK ROM/HAL symbols and ARM CMSE intrinsics referenced
* by the port; renaming them would break linkage against the vendor blob.
*/
"ADC_",
"APBPeriph_",
"BOOT_",
"BOR_",
"Cache_",
"DCache_",
"ChipInfo_",
"FLASH_",
"IPC_",
"LOGUART_",
"OSC2M_",
"OSC4M_",
"OSC131K_",
"RCC_",
"RTCIO_",
"SYSCFG_",
"SYSTIMER_",
"SystemCoreClock", /* SystemCoreClock, SystemCoreClockUpdate */
"cmse_", /* ARM CMSE TrustZone intrinsics (arm_cmse.h) */
NULL
};
@ -291,6 +317,17 @@ static const char *g_white_content_list[] =
"NativeSymbol",
"RuntimeInitArgs",
/* Ref: arch/arm/src/common/ameba, arch/arm/src/rtl8721dx,
* arch/arm/src/rtl8720f. Standalone Realtek Ameba SDK ROM symbols.
*/
"DelayUs",
"DiagPrintf",
"Img2EntryFun0",
"NewVectorTable",
"RomVectorTable",
"PutChar",
/* Ref: gnu_unwind_find_exidx.c */
"__EIT_entry",
@ -378,41 +415,6 @@ static const char *g_white_content_list[] =
"SEGGER_RTT",
/* Ref:
* drivers/crypto/pnt/pnt_se05x_api.c
*/
"smStatus_t",
"Se05xSession_t",
"SE05x_ECSignatureAlgo_t",
"kSE05x_ECSignatureAlgo_NA",
"kSE05x_ECSignatureAlgo_PLAIN",
"kSE05x_ECSignatureAlgo_SHA",
"kSE05x_ECSignatureAlgo_SHA_224",
"kSE05x_ECSignatureAlgo_SHA_256",
"kSE05x_ECSignatureAlgo_SHA_384",
"kSE05x_ECSignatureAlgo_SHA_512",
"kSE05x_ECCurve_NIST_P256"
"SE05x_Result_t",
"kSE05x_Result_NA",
"kSE05x_Result_SUCCESS",
"kSE05x_INS_NA",
"kSE05x_KeyPart_Pair",
"kSE05x_KeyPart_Public",
"pScp03_enc_key",
"pScp03_mac_key",
"pScp03_dek_key",
"Se05x_API_SessionOpen",
"Se05x_API_SessionClose",
"Se05x_API_CheckObjectExists",
"Se05x_API_ReadObject",
"Se05x_API_WriteECKey",
"Se05x_API_WriteBinary",
"Se05x_API_ReadSize",
"Se05x_API_DeleteSecureObject",
"Se05x_API_ECDHGenerateSharedSecret",
"Se05x_API_ECDSAVerify",
/* Ref:
* fs/nfs/rpc.h
* fs/nfs/nfs_proto.h