Introduction to SDK
SDK consists of the following components:
SDK west top-level directory
├── .west west locates the top-level west.yml based on ./west/config
├── manifests contains the west-managed manifest file west.yml
├── modules essential modules, including Ameba peripheral driver libraries, crypto/mbedtls libraries, etc.
├── nuwa.py -> tools/meta_tools/nuwa.py symbolic link, a wrapper around west commands provided by SDK
├── tools contains .py scripts for meta boot and binary concatenation, as well as the imagetool download utility
└── zephyr main Zephyr directory, including the Zephyr OS kernel, board support packages, sample applications, and test cases
SDK Directory Structure
The Zephyr directory is synchronized from the open-source real-time operating system Zephyr OS on GitHub (currently using Zephyr kernel version v4.1.0). Its source tree structure is as follows:
SDK/zephyr
├── arch CPU architecture-specific code, e.g., ARM/RISC-V
├── boards board-specific definitions, such as various Ameba EVB development boards
├── cmake CMake configuration files and scripts required to build Zephyr applications
├── doc official Zephyr documentation (offline copy)
├── drivers device driver code, e.g., Ameba SPI driver
├── dts DeviceTree source files (hardware initialization configurations for SoCs)
├── include public Zephyr API header files
├── kernel Zephyr OS kernel source code
├── lib library code, including a minimal standard C library
├── misc miscellaneous utility modules
├── modules directory for third-party modules integrated into Zephyr (non-West modules), providing Kconfig definitions
├── samples official Zephyr sample applications
├── scripts scripts used for building and testing
├── share architecture-independent auxiliary data, currently includes the Zephyr CMake package
├── soc SoC-level definitions and default configurations
├── subsys Zephyr subsystem implementations, e.g., USB Device Stack, File System, etc.
└── tests official Zephyr test suites
boards
Currently, SDK provides board support for three EVB development boards, structured as follows:
SDK/zephyr/boards
├── realtek
├── rtl8721f_evb
├── rtl872xda_evb
└── rtl872xd_evb
For more details on Ameba board configuration, refer to: Zephyr Board Configuration Guide (TODO).
drivers
The Zephyr driver structure adapted in SDK is as follows:
SDK/zephyr/drivers
├── adc
├── audio
├── can (TOOD)
├── clock_control
├── console
├── counter
├── display
├── dma
├── entropy
├── ethernet (TOOD)
├── flash
├── gpio
├── hwinfo
├── i2c
├── i2s
├── input (captouch)
├── led_strip
├── mdio (TOOD)
├── mipi_dbi
├── pinctrl
├── pwm
├── rtc
├── sdhc
├── sensor (thermal)
├── serial
├── spi
├── usb
├── watchdog
└── wifi
dts
The DeviceTree initialization configuration structure in SDK is as follows:
SDK/zephyr/dts
├── arm
│ └── realtek
│ ├── amebad hardware initialization configuration for rtl872xd_evb
│ ├── amebadplus hardware initialization configuration for rtl872xda_evb
│ └── amebaG2 hardware initialization configuration for rtl8721f_evb
├── bindings contains .yaml files describing the meaning of properties in each DeviceTree node
For more information about DeviceTree, refer to: Devicetree Configuration section in the Zephyr Configuration System Guide (TODO).
samples
SDK provides official sample source code for drivers and applications, structured as follows:
SDK/zephyr/samples
├── basic basic example applications
├── drivers peripheral driver-related examples
├── hello_world the classic Zephyr "Hello World" example
└── subsys examples for Zephyr subsystems (e.g., USB)
Taking hello_world as an example:
hello_world
├── CMakeLists.txt CMake build script
├── prj.conf project configuration file
├── README.rst project documentation
└── src
└── main.c application source code
For more details on examples, refer to: AMEBA Example Introduction (TODO).
tests
SDK provides test suites for Zephyr APIs, structured as follows:
SDK/zephyr/tests
├── benchmarks performance benchmark tests for OS kernel APIs
├── drivers API tests for peripheral drivers
├── kernel API tests for the OS kernel
└── subsys API tests for Zephyr subsystems (e.g., power management, storage)
modules Directory Structure
The modules directory is a product of West’s multi-repository management system. It contains all external modules (external modules) required by the main Zephyr project. These modules are independent Git repositories defined in the west.yml manifest file.
It includes third-party or Zephyr community-maintained standalone subsystems such as hal_* (Hardware Abstraction Layer), lib/mbedtls, fs/fatfs, etc. The structure is as follows:
SDK/modules
├── crypto
│ └── mbedtls mbedtls cryptographic library
├── fs
│ └── littlefs littlefs file system
└── hal
├── cmsis CMSIS library
└── realtek Realtek peripheral driver library
The hal_realtek module contains peripheral driver libraries for the Ameba series of chips. Files under the Ameba directory originate from ameba-rtos and are periodically synchronized into Zephyr’s hal_realtek repository.
Its structure is as follows:
SDK/modules/hal/realtek
├── ameba
│ ├── amebaxxx
│ │ ├── bin firmware images (image2 and bootloader) for CPUs other than KM4; KM4’s image2 is built using Zephyr OS
│ │ ├── include common header files such as platform_autoconf.h
│ │ ├── ld linker scripts for KM4
│ │ ├── lib proprietary static libraries tightly coupled with hardware
│ │ └── source all other source code (open-source, except for contents in the lib folder above)
│ ├── common
│ │ ├── bluetooth Bluetooth protocol stack source code
│ │ ├── include common Ameba header files
│ │ ├── os_wrapper OS abstraction layer code
│ │ ├── rtk_coex Bluetooth and Wi-Fi coexistence source code
│ │ ├── usb USB device stack source code
│ │ └── wifi Wi-Fi protocol stack source code
│ └── usrcfg
│ ├── amebaxxx default configuration files for various Ameba chip models
│ └── common common Ameba configuration files
└── zephyr
└── module.yml module description file informing Zephyr’s build system (CMake) how to locate, include, and compile this specific module