mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
arch/arm/rtl8721f: add RTL8721F (Green2) chip and EVB board skeleton
Add a P0 skeleton port for the Realtek RTL8721F (SDK codename Green2 /
amebagreen2). Structurally the RTL8721F is a twin of the RTL8720F -- the
AP/host core is km4tz (ARMv8-M.main, TrustZone secure) and the WiFi MAC/PHY
runs on the km4ns network-processor core -- so this port is modelled on the
RTL8720F one and shares the IC-agnostic ameba glue in
arch/arm/src/common/ameba.
This is the "configures and links" skeleton (rtl8721f_evb:nsh builds an
image end to end). Four differences from the RTL8720F template were needed
to make the empty shell link against amebagreen2:
* km4tz has no FPU (cmsis_cpu.h defines __FPU_PRESENT 0), so the chip does
not select ARCH_HAVE_FPU and the image is built soft-float.
* ameba_app_start.c matches amebagreen2's ram_km4tz silicon init: the
nocache MPU map, the non-secure ROM BSS clear, OSC4M (not OSC2M)
calibration gated on EFUSE cut >= B and CHIP_TYPE_ASIC_POSTSIM.
* amebagreen2 ships no lib_rom.a, so the ROM archive whole-archive link is
dropped; the WiFi/OS/non-secure ROM symbols come from the SDK
ameba_rom_symbol_acut{,_wifi,_os}.ld maps appended to the image2 linker
script, exactly as green2's own image2 link does.
* the AP WiFi security lib is lib_wifi_common.a (was lib_wifi_com_sec.a).
The per-chip IRQ vector table (irq.h) and the RAM_START/RAM_SIZE layout
still carry RTL8720F values and are refined in the follow-up bring-up work.
Signed-off-by: dechao_gong <dechao_gong@realsil.com.cn>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
7e2cca2fe9
commit
d584142cf4
33 changed files with 3790 additions and 0 deletions
|
|
@ -2522,6 +2522,14 @@ config ARCH_BOARD_RTL8720F_EVB
|
|||
board featuring the Realtek RTL8720F (km4tz application/host
|
||||
core, Cortex-M33).
|
||||
|
||||
config ARCH_BOARD_RTL8721F_EVB
|
||||
bool "Realtek RTL8721F_EVB"
|
||||
depends on ARCH_CHIP_RTL8721F
|
||||
---help---
|
||||
This options selects support for NuttX on the RTL8721F_EVB
|
||||
board featuring the Realtek RTL8721F (SDK codename Green2;
|
||||
km4tz application/host core, Cortex-M33).
|
||||
|
||||
config ARCH_BOARD_SABRE_6QUAD
|
||||
bool "NXP/Freescale i.MX6 Sabre-6Quad board"
|
||||
depends on ARCH_CHIP_IMX6_6QUAD
|
||||
|
|
@ -3982,6 +3990,7 @@ config ARCH_BOARD
|
|||
default "mps3-an547" if ARCH_BOARD_MPS3_AN547
|
||||
default "pke8721daf" if ARCH_BOARD_PKE8721DAF
|
||||
default "rtl8720f_evb" if ARCH_BOARD_RTL8720F_EVB
|
||||
default "rtl8721f_evb" if ARCH_BOARD_RTL8721F_EVB
|
||||
default "rv32m1-vega" if ARCH_BOARD_RV32M1_VEGA
|
||||
default "rv-virt" if ARCH_BOARD_QEMU_RV_VIRT
|
||||
default "star64" if ARCH_BOARD_JH7110_STAR64
|
||||
|
|
@ -4237,6 +4246,9 @@ endif
|
|||
if ARCH_BOARD_RTL8720F_EVB
|
||||
source "boards/arm/rtl8720f/rtl8720f_evb/Kconfig"
|
||||
endif
|
||||
if ARCH_BOARD_RTL8721F_EVB
|
||||
source "boards/arm/rtl8721f/rtl8721f_evb/Kconfig"
|
||||
endif
|
||||
if ARCH_BOARD_QEMU_ARMV7A
|
||||
source "boards/arm/qemu/qemu-armv7a/Kconfig"
|
||||
endif
|
||||
|
|
|
|||
28
boards/arm/rtl8721f/rtl8721f_evb/CMakeLists.txt
Normal file
28
boards/arm/rtl8721f/rtl8721f_evb/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# ##############################################################################
|
||||
# boards/arm/rtl8721f/rtl8721f_evb/CMakeLists.txt
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# ##############################################################################
|
||||
|
||||
# The vendor-SDK build machinery (SDK libs, image2 ld script, link flags and the
|
||||
# nuttx.bin packaging POSTBUILD / nuttx_post_build target) is wired up from the
|
||||
# shared arch/arm/src/common/ameba/cmake/ameba_board.cmake, included by this
|
||||
# IC's arch CMakeLists. Nothing IC- or board-specific is needed here.
|
||||
|
||||
add_subdirectory(src)
|
||||
7
boards/arm/rtl8721f/rtl8721f_evb/Kconfig
Normal file
7
boards/arm/rtl8721f/rtl8721f_evb/Kconfig
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
if ARCH_BOARD_RTL8721F_EVB
|
||||
endif
|
||||
10
boards/arm/rtl8721f/rtl8721f_evb/ameba_sdk.conf
Normal file
10
boards/arm/rtl8721f/rtl8721f_evb/ameba_sdk.conf
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# User-editable Ameba SDK options for this board (prj.conf-style, diff vs SDK
|
||||
# default). Applied on top of the SDK default when building the NP / bootloader
|
||||
# images; dependents cascade automatically via kconfiglib.
|
||||
#
|
||||
# Edit interactively with `make ameba_menuconfig` (writes the diff back here),
|
||||
# or add CONFIG_* lines by hand. Picked up on the next build.
|
||||
#
|
||||
# Options that MUST stay at a fixed value (e.g. CONFIG_SHELL=n) live in
|
||||
# ameba_sdk_force.conf, which is applied last and re-applied after the TUI
|
||||
# saves -- so they cannot be overridden from here or the menuconfig UI.
|
||||
11
boards/arm/rtl8721f/rtl8721f_evb/ameba_sdk_force.conf
Normal file
11
boards/arm/rtl8721f/rtl8721f_evb/ameba_sdk_force.conf
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# Forced Ameba SDK options for this board (prj.conf-style, diff vs SDK default).
|
||||
#
|
||||
# These are applied LAST -- after the SDK default and the user overlay
|
||||
# (ameba_sdk.conf), on every build AND again after `make ameba_menuconfig`
|
||||
# saves -- so they always win and cannot be turned on from the TUI. Use this
|
||||
# file (not ameba_sdk.conf) for options that MUST stay at a fixed value for the
|
||||
# port to work.
|
||||
#
|
||||
# CONFIG_SHELL: the SDK's NP-side shell conflicts with NuttX owning the
|
||||
# LOG-UART console, so it must stay disabled.
|
||||
CONFIG_SHELL=n
|
||||
90
boards/arm/rtl8721f/rtl8721f_evb/configs/nsh/defconfig
Normal file
90
boards/arm/rtl8721f/rtl8721f_evb/configs/nsh/defconfig
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_DEBUG_WARN is not set
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="rtl8721f_evb"
|
||||
CONFIG_ARCH_BOARD_RTL8721F_EVB=y
|
||||
CONFIG_ARCH_CHIP="rtl8721f"
|
||||
CONFIG_ARCH_CHIP_RTL8721F=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_ARMV8M_SYSTICK=y
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEBUG_ASSERTIONS=y
|
||||
CONFIG_DEBUG_FEATURES=y
|
||||
CONFIG_DEBUG_FULLOPT=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_DEFAULT_TASK_STACKSIZE=4096
|
||||
CONFIG_DRIVERS_IEEE80211=y
|
||||
CONFIG_DRIVERS_WIRELESS=y
|
||||
CONFIG_EXAMPLES_DHCPD=y
|
||||
CONFIG_EXAMPLES_HELLO=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_FS_TMPFS=y
|
||||
CONFIG_IDLETHREAD_STACKSIZE=4096
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_IOB_BUFSIZE=512
|
||||
CONFIG_IOB_NBUFFERS=100
|
||||
CONFIG_IOB_NCHAINS=36
|
||||
CONFIG_IOB_THROTTLE=40
|
||||
CONFIG_LIBC_MEMFD_ERROR=y
|
||||
CONFIG_MM_DEFAULT_ALIGNMENT=32
|
||||
CONFIG_NET=y
|
||||
CONFIG_NETDB_DNSCLIENT=y
|
||||
CONFIG_NETDEV_LATEINIT=y
|
||||
CONFIG_NETDEV_WIRELESS_IOCTL=y
|
||||
CONFIG_NETINIT_DHCPC=y
|
||||
CONFIG_NETINIT_THREAD=y
|
||||
CONFIG_NETINIT_WAPI_PASSPHRASE="YOUR_WIFI_PASSWORD"
|
||||
CONFIG_NETINIT_WAPI_SSID="YOUR_WIFI_SSID"
|
||||
CONFIG_NETUTILS_DHCPD=y
|
||||
CONFIG_NETUTILS_DHCPD_ROUTERIP=0xc0a80401
|
||||
CONFIG_NETUTILS_DHCPD_STARTIP=0xc0a80402
|
||||
CONFIG_NETUTILS_IPERF=y
|
||||
CONFIG_NET_ARP_IPIN=y
|
||||
CONFIG_NET_BROADCAST=y
|
||||
CONFIG_NET_ETH_PKTSIZE=1514
|
||||
CONFIG_NET_ICMP_SOCKET=y
|
||||
CONFIG_NET_RECV_BUFSIZE=10000
|
||||
CONFIG_NET_SEND_BUFSIZE=16384
|
||||
CONFIG_NET_TCP=y
|
||||
CONFIG_NET_TCP_DELAYED_ACK=y
|
||||
CONFIG_NET_TCP_KEEPALIVE=y
|
||||
CONFIG_NET_TCP_NOTIFIER=y
|
||||
CONFIG_NET_TCP_OUT_OF_ORDER=y
|
||||
CONFIG_NET_TCP_OUT_OF_ORDER_BUFSIZE=10000
|
||||
CONFIG_NET_TCP_WRITE_BUFFERS=y
|
||||
CONFIG_NET_UDP=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_DISABLE_VCONFIG=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
CONFIG_RAM_SIZE=262144
|
||||
CONFIG_RAM_START=0x30008000
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_RTL8721F_FLASH_FS=y
|
||||
CONFIG_RTL8721F_WIFI=y
|
||||
CONFIG_SCHED_HPWORK=y
|
||||
CONFIG_SCHED_HPWORKPRIORITY=192
|
||||
CONFIG_SCHED_LPWORK=y
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_STACK_COLORATION=y
|
||||
CONFIG_START_DAY=16
|
||||
CONFIG_START_MONTH=6
|
||||
CONFIG_START_YEAR=2026
|
||||
CONFIG_SYSTEM_DHCPC_RENEW=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_SYSTEM_NSH_STACKSIZE=2500
|
||||
CONFIG_SYSTEM_PING=y
|
||||
CONFIG_TIMER=y
|
||||
CONFIG_TIMER_ARCH=y
|
||||
CONFIG_USEC_PER_TICK=1000
|
||||
CONFIG_WIRELESS=y
|
||||
CONFIG_WIRELESS_WAPI=y
|
||||
CONFIG_WIRELESS_WAPI_CMDTOOL=y
|
||||
66
boards/arm/rtl8721f/rtl8721f_evb/include/board.h
Normal file
66
boards/arm/rtl8721f/rtl8721f_evb/include/board.h
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/rtl8721f/rtl8721f_evb/include/board.h
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_ARM_RTL8721F_RTL8721F_EVB_INCLUDE_BOARD_H
|
||||
#define __BOARDS_ARM_RTL8721F_RTL8721F_EVB_INCLUDE_BOARD_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* The SysTick/core clock is taken from the SDK's SystemCoreClock global at
|
||||
* runtime (see arch/arm/src/rtl8721f/ameba_timerisr.c), so no board-level
|
||||
* clock constant is needed here.
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARDS_ARM_RTL8721F_RTL8721F_EVB_INCLUDE_BOARD_H */
|
||||
22
boards/arm/rtl8721f/rtl8721f_evb/prebuilt/.gitignore
vendored
Normal file
22
boards/arm/rtl8721f/rtl8721f_evb/prebuilt/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# Realtek RTL8721F vendor blobs and build artefacts.
|
||||
#
|
||||
# These are NOT NuttX source and must never be committed upstream (vendor
|
||||
# blobs are kept out of the NuttX tree). They are vendor outputs from the
|
||||
# ameba-rtos SDK, placed here by the integrator:
|
||||
#
|
||||
# libs/*.a pre-compiled chip archives (fwlib/hal/swlib/misc/...)
|
||||
# km4ns_image2_all.bin prebuilt NP (WiFi/LP core, km4ns) image2 blob
|
||||
# platform_autoconf.h regenerated each build from the SDK menuconfig by
|
||||
# ameba_gen_autoconf.sh (single source of truth)
|
||||
# config_km4 / config_fw vendored SDK kconfig snapshots for axf2bin packaging
|
||||
#
|
||||
# Generated at build time:
|
||||
#
|
||||
# ld.script.gen[.tmp] combined image2 linker script
|
||||
# project_km4tz/ staged include dir for ld preprocessing
|
||||
# pkg/ axf2bin / firmware_package staging area
|
||||
#
|
||||
# Everything in this directory is ignored.
|
||||
|
||||
*
|
||||
!.gitignore
|
||||
33
boards/arm/rtl8721f/rtl8721f_evb/scripts/Make.defs
Normal file
33
boards/arm/rtl8721f/rtl8721f_evb/scripts/Make.defs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
############################################################################
|
||||
# boards/arm/rtl8721f/rtl8721f_evb/scripts/Make.defs
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
# All RTL8721F board-build definitions (SDK include sets, fwlib/WiFi source
|
||||
# lists, image2 linker-script generation, PREBUILD/POSTBUILD) live in the
|
||||
# shared per-IC fragment so every board on this IC uses one copy. This board's
|
||||
# own paths (prebuilt/ staging) derive from $(BOARD_DIR) inside it.
|
||||
|
||||
include $(TOPDIR)/arch/arm/src/rtl8721f/ameba_board.mk
|
||||
|
||||
# Flashing via the SDK AmebaFlash.py (make flash AMEBA_PORT=/dev/ttyUSB0)
|
||||
|
||||
AMEBA_FLASH_PROFILE = RTL8721F
|
||||
include $(TOPDIR)/tools/ameba/Config.mk
|
||||
28
boards/arm/rtl8721f/rtl8721f_evb/src/CMakeLists.txt
Normal file
28
boards/arm/rtl8721f/rtl8721f_evb/src/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# ##############################################################################
|
||||
# boards/arm/rtl8721f/rtl8721f_evb/src/CMakeLists.txt
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# ##############################################################################
|
||||
|
||||
set(SRCS rtl8721f_boot.c rtl8721f_bringup.c)
|
||||
|
||||
target_sources(board PRIVATE ${SRCS})
|
||||
|
||||
# LD_SCRIPT is not set here: the Ameba image2 linker script is generated
|
||||
# (prebuilt/ld.script.gen) and published by the shared ameba_board.cmake.
|
||||
27
boards/arm/rtl8721f/rtl8721f_evb/src/Makefile
Normal file
27
boards/arm/rtl8721f/rtl8721f_evb/src/Makefile
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
############################################################################
|
||||
# boards/arm/rtl8721f/rtl8721f_evb/src/Makefile
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include $(TOPDIR)/Make.defs
|
||||
|
||||
CSRCS = rtl8721f_boot.c rtl8721f_bringup.c
|
||||
|
||||
include $(TOPDIR)/boards/Board.mk
|
||||
69
boards/arm/rtl8721f/rtl8721f_evb/src/rtl8721f_boot.c
Normal file
69
boards/arm/rtl8721f/rtl8721f_evb/src/rtl8721f_boot.c
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/rtl8721f/rtl8721f_evb/src/rtl8721f_boot.c
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "rtl8721f_rtl8721f_evb.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rtl8721f_boardinitialize
|
||||
*
|
||||
* Description:
|
||||
* All RTL8721F architectures must provide the following entry point.
|
||||
* This entry point is called early in the initialization -- after all
|
||||
* memory has been configured and mapped but before any devices have been
|
||||
* initialized.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void rtl8721f_boardinitialize(void)
|
||||
{
|
||||
/* Board-specific early initialization. Nothing to do here. */
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_initialize
|
||||
*
|
||||
* Description:
|
||||
* If CONFIG_BOARD_EARLY_INITIALIZE is selected, then an additional
|
||||
* initialization call will be performed in the boot-up sequence to a
|
||||
* function called board_initialize().
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_BOARD_EARLY_INITIALIZE
|
||||
void board_early_initialize(void)
|
||||
{
|
||||
rtl8721f_boardinitialize();
|
||||
}
|
||||
#endif
|
||||
203
boards/arm/rtl8721f/rtl8721f_evb/src/rtl8721f_bringup.c
Normal file
203
boards/arm/rtl8721f/rtl8721f_evb/src/rtl8721f_bringup.c
Normal file
|
|
@ -0,0 +1,203 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/rtl8721f/rtl8721f_evb/src/rtl8721f_bringup.c
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "rtl8721f_rtl8721f_evb.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/* SDK ROM inter-core IPC-semaphore RTOS hooks. rtos_* come from the NuttX
|
||||
* os_wrapper (ameba_os_wrap.c); IPC_* are SDK ROM symbols.
|
||||
*/
|
||||
|
||||
extern void rtos_critical_enter(uint32_t component_id);
|
||||
extern void rtos_critical_exit(uint32_t component_id);
|
||||
extern void rtos_time_delay_ms(uint32_t ms);
|
||||
extern void IPC_patch_function(void (*enter)(uint32_t),
|
||||
void (*leave)(uint32_t), uint32_t lock_id);
|
||||
extern void IPC_SEMDelayStub(void (*delay)(uint32_t));
|
||||
|
||||
/* RTOS_CRITICAL_SEMA in the SDK os_wrapper_critical.h enum. Our
|
||||
* rtos_critical_enter/exit ignore the component id, so the value is only
|
||||
* passed through to satisfy the ROM signature.
|
||||
*/
|
||||
|
||||
#define AMEBA_RTOS_CRITICAL_SEMA 9
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rtl8721f_bringup
|
||||
*
|
||||
* Description:
|
||||
* Bring up board features
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int rtl8721f_bringup(void)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
/* Mount the procfs file system */
|
||||
|
||||
ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FS_TMPFS
|
||||
/* Mount the tmp file system */
|
||||
|
||||
ret = nx_mount(NULL, CONFIG_LIBC_TMPDIR, "tmpfs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to mount tmpfs at /tmp: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RTL8721F_FLASH_FS
|
||||
/* Mount the persistent data filesystem (littlefs on the SPI NOR VFS1
|
||||
* partition) at /data before WiFi, so the WiFi KV store is available.
|
||||
*/
|
||||
|
||||
/* The SDK flash erase/program path IPC-pauses the NP (km4ns) while the AP
|
||||
* writes the shared XIP flash, so the IPC transport must be up first.
|
||||
*/
|
||||
|
||||
ameba_ipc_initialize();
|
||||
|
||||
ret = ameba_flash_fs_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: ameba_flash_fs_initialize failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RTL8721F_WIFI
|
||||
/* Bring up the KM4 IPC transport and start the WHC host WiFi stack. */
|
||||
|
||||
ret = rtl8721f_wifi_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: rtl8721f_wifi_initialize failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Install the inter-core HW IPC-semaphore RTOS hooks LAST -- after all the
|
||||
* flash / WHC bring-up above, and just before this (board_late_initialize)
|
||||
* path returns and nx_start() hands off to the init task.
|
||||
*
|
||||
* The shared-flash / WHC paths take the hardware IPC semaphore to
|
||||
* serialize against the NP; the ROM semaphore code then calls an RTOS
|
||||
* critical-section pair plus a delay callback while a contended waiter
|
||||
* waits. That delay callback rtos_time_delay_ms() blocks, so it is only
|
||||
* safe from a real task. Registering it here means the bring-up flash
|
||||
* access above (which runs in this pre-task context) uses the ROM default
|
||||
* (busy-spin, no callback), while every runtime IPC-semaphore user that
|
||||
* follows runs in a task and yields properly.
|
||||
*/
|
||||
|
||||
IPC_patch_function(rtos_critical_enter, rtos_critical_exit,
|
||||
AMEBA_RTOS_CRITICAL_SEMA);
|
||||
IPC_SEMDelayStub(rtos_time_delay_ms);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_app_initialize
|
||||
*
|
||||
* Description:
|
||||
* Perform application specific initialization. This function is never
|
||||
* called directly from application code, but only indirectly via the
|
||||
* (non-standard) boardctl() interface using the command BOARDIOC_INIT.
|
||||
*
|
||||
* Input Parameters:
|
||||
* arg - The boardctl() argument is passed to the board_app_initialize()
|
||||
* implementation without modification. The argument has no
|
||||
* meaning to NuttX; the meaning of the argument is a contract
|
||||
* between the board-specific initialization logic and the
|
||||
* matching application logic. The value could be such things as a
|
||||
* mode enumeration value, a set of DIP switch settings, a
|
||||
* pointer to configuration data read from a file or serial FLASH,
|
||||
* or whatever you would like to do with it. Every implementation
|
||||
* should accept zero/NULL as a default configuration.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||
* any failure to indicate the nature of the failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_BOARDCTL
|
||||
int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
#ifndef CONFIG_BOARD_LATE_INITIALIZE
|
||||
/* Perform board initialization */
|
||||
|
||||
return rtl8721f_bringup();
|
||||
#else
|
||||
return OK;
|
||||
#endif
|
||||
}
|
||||
#endif /* CONFIG_BOARDCTL */
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_late_initialize
|
||||
*
|
||||
* Description:
|
||||
* If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
|
||||
* initialization call will be performed in the boot-up sequence to a
|
||||
* function called board_late_initialize(). board_late_initialize() will
|
||||
* be called immediately after up_initialize() is called and just before
|
||||
* the initial application is started. This additional initialization
|
||||
* phase may be used, for example, to initialize board-specific device
|
||||
* drivers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_BOARD_LATE_INITIALIZE
|
||||
void board_late_initialize(void)
|
||||
{
|
||||
/* Perform board initialization */
|
||||
|
||||
rtl8721f_bringup();
|
||||
}
|
||||
#endif /* CONFIG_BOARD_LATE_INITIALIZE */
|
||||
100
boards/arm/rtl8721f/rtl8721f_evb/src/rtl8721f_rtl8721f_evb.h
Normal file
100
boards/arm/rtl8721f/rtl8721f_evb/src/rtl8721f_rtl8721f_evb.h
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/rtl8721f/rtl8721f_evb/src/rtl8721f_rtl8721f_evb.h
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_ARM_RTL8721F_RTL8721F_EVB_SRC_RTL8721F_RTL8721F_EVB_H
|
||||
#define __BOARDS_ARM_RTL8721F_RTL8721F_EVB_SRC_RTL8721F_RTL8721F_EVB_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rtl8721f_boardinitialize
|
||||
*
|
||||
* Description:
|
||||
* Perform board-specific early initialization.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void rtl8721f_boardinitialize(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rtl8721f_bringup
|
||||
*
|
||||
* Description:
|
||||
* Bring up board features.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int rtl8721f_bringup(void);
|
||||
|
||||
#ifdef CONFIG_RTL8721F_WIFI
|
||||
/****************************************************************************
|
||||
* Name: rtl8721f_wifi_initialize
|
||||
*
|
||||
* Description:
|
||||
* Bring up the KM4 IPC transport and start the WHC host WiFi stack
|
||||
* (arch/arm/src/rtl8721f/ameba_wifi_init.c).
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int rtl8721f_wifi_initialize(void);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8721F_FLASH_FS) || defined(CONFIG_RTL8721F_WIFI)
|
||||
/****************************************************************************
|
||||
* Name: ameba_ipc_initialize
|
||||
*
|
||||
* Description:
|
||||
* Bring up the km4tz<->km4ns IPC transport once (idempotent). Required by
|
||||
* the SDK flash erase/program path (inter-core XIP pause) and by WiFi
|
||||
* (arch/arm/src/rtl8721f/ameba_ipc.c).
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void ameba_ipc_initialize(void);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RTL8721F_FLASH_FS
|
||||
/****************************************************************************
|
||||
* Name: ameba_flash_fs_initialize
|
||||
*
|
||||
* Description:
|
||||
* Register the on-chip SPI NOR data partition as an MTD device and mount
|
||||
* a littlefs filesystem on it at /data
|
||||
* (arch/arm/src/rtl8721f/ameba_flash_mtd.c).
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int ameba_flash_fs_initialize(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARDS_ARM_RTL8721F_RTL8721F_EVB_SRC_RTL8721F_RTL8721F_EVB_H */
|
||||
Loading…
Add table
Add a link
Reference in a new issue