SDK Introduction

Overview

The SDK consists of the following three parts:

SDK
  ├── component                   Components such as FreeRTOS, SoC, mbed API, Wi-Fi, network, etc.
  ├── example                     Application examples, including audio, network, ota, usb, peripherals, etc.
  ├── tools                       Tools
  └── cmake                       Compilation abstraction layer

component

This directory contains the core functional components of the SDK, which are called by upper-layer applications. Common components are listed in the following table:

Item

Description

at_cmd

AT command support module

audio

Audio codec driver, supports: alc5616/alc5640/alc5651/alc5660/alc5679/alc5680/sgtl5000

bluetooth

Bluetooth protocol stack source code and related library files

file_system

File system implementation, includes: fatfs, littlefs, ftl, kv, vfs, etc.

lwip

LWIP protocol stack APIs and source code

network

Network protocol support, includes:

  • cJSON

  • CoAP

  • DHCP

  • HTTP/2

  • HTTP Client (httpc)

  • HTTP Server (httpd)

  • mDNS

  • MQTT

  • Ping

  • iPerf

  • SNTP

  • WebSocket

  • XML

os

FreeRTOS real-time operating system source code and OS APIs wrapper layer implementation

soc

SoC-related core modules, includes:

  • app: System monitoring and Shell tools

  • loader: Bootloader and GDB Loader

  • cmsis: Arm header files defining CPU registers and basic operation APIs

  • cmsis-dsp: Arm CMSIS-DSP digital signal processing library

  • fwlib: Low-level drivers such as Audio Codec, SPORTS, UART, I2C, SPI, Timer, PWM, etc.

  • img3: Trustzone support (may not be enabled)

  • hal: Mbed APIs encapsulated based on Raw APIs

  • main: main program entry

  • misc: Other miscellaneous functions such as crashdump, OTA, PMU, etc.

  • project: entry of build and configure

  • swlib: Standard software library functions provided by ROM, such as _memcpy, _memcmp, etc.

  • usrcfg: User-defined configuration files

ssl

Secure communication protocol stack, implemented based on mbed TLS

usb

USB class drivers and verification code

utils

Utility modules, includes:

  • IPC (Inter-Processor Communication)

  • Ringbuffer

  • Unit Test Framework

wifi

Wi-Fi functional module, provides the following interfaces:

  • Wi-Fi NIC mode: Used as a traditional Wi-Fi card

  • R-mesh: Realtek Wi-Fi Mesh

  • CSI: Wi-Fi sensing

  • KVR: Wi-Fi roaming

  • WPS: Wi-Fi Protected Setup

  • MCC: Wi-Fi multi-channel coexistence

  • Promisc: Wi-Fi promiscuous mode, capable of receiving all packets on current channel

  • Fast connect: Rapid connection after Wi-Fi restart

Under the soc directory, each SoC has a main subdirectory, which serves as the main program entry point for that SoC. As an SoC may contain multiple MCUs, each MCU is assigned its own independent subdirectory.

component/soc/xxx/main
  ├── {mcu1}/                           Private main program directory for each MCU
  └── {mcu2}/                           Private main program directory for each MCU
     ├── inc/                           Header files (e.g., ``FreeRTOSConfig.h``, ``build_info.h``)
     └── src/                           Main program source code

Under the soc directory, each SoC has a project subdirectory, including Kconfig, CMake and layout files, which serves as the compilation entry point for that SoC. For each MCU within the SoC, there is a corresponding project_xx subdirectory containing linker scripts, as well as CMake configuration files for building the Bootloader and Application Image.

component/soc/xxx/project
  ├── project_{mcu1}/                   Private configuration directory for each MCU
  └── project_{mcu2}/                   Private configuration directory for each MCU; there will be multiple directories if the SoC contains multiple MCUs
     ├── ld/                            Linker scripts
     ├── lib/                           Library files
     └── make/                          CMake scripts used for compiling images

tools

This directory contains tools required during IC development.

Item

Description

TraceTool

Used for printing logs and sending commands Trace Tool

ImageTool

Used for downloading firmware Image Tool

DownloadServer

Socket-based OTA server program

DownloadServer (HTTP)

HTTP-based OTA server program

iperf

Used for Wi-Fi throughput testing

littlefs

Generates the littlefs file system

meta_tools

VS Code extension SDK-side adaptation toolset

Critical Header Files

The following table lists some key header files in the SDK and their descriptions:

Item

Description

Location

basic_types.h

  • RTK_SUCCESS/RTK_FAIL

  • TRUE/FALSE

  • ENABLE/DISABLE

  • ON/OFF

  • NULL

  • u8/u16/u32/u64

  • BOOL

  • BIT x

component/soc/amebaxxx/fwlib/include

section_config.h

Definitions of various sections in the linker script:

  • BOOT_RAM_DATA_SECTION

  • IMAGE2_RAM_TEXT_SECTION

ameba_soc.h

Provides Raw APIs for low-level drivers (recommended to use)

Compared to mbed APIs, Raw APIs offer more flexible, rich, and efficient hardware configuration interfaces

mbed API headers

High-level encapsulation interfaces based on Raw APIs, providing relatively simplified functionality

component/soc/amebaxxx/hal

SDK License

Layer

Item

Version

License

Application

cJSON

n/a

MIT License

https://github.com/DaveGamble/cJSON

NetWork

Lwip

v2.1.2

BSD License

https://savannah.nongnu.org/projects/lwip

GmSSL

v3.1.1

Apache-2.0

https://github.com/guanzhi/GmSSL

mbedTLS

v3.6.2

v3.6.5

Apache-2.0

https://tls.mbed.org

Wi-Fi

wpa_supplicant

n/a

BSD License

https://w1.fi/wpa_supplicant

https://w1.fi/releases

https://w1.fi/cgit/hostap/plain/wpa_supplicant/README

BT

LC3 Codec (BT audio codec lib)

n/a

Apache-2.0

http://www.apache.org/licenses/LICENSE-2.0

SBC Codec (BT audio codec lib)

n/a

Apache-2.0

http://www.apache.org/licenses/LICENSE-2.0

AES-CMAC

n/a

No License, free to use

https://tools.ietf.org/html/rfc4493#appendix-A

CCMS

n/a

Apache-2.0

http://www.apache.org/licenses/LICENSE-2.0

https://tls.mbed.org

ECC (Kenneth MacKay)

n/a

BSD 2-Clause License

https://github.com/kmackay/micro-ecc

SHA256 (Colin Percival)

n/a

BSD 2-Clause License

File System

FatFs

n/a

BSD Licenses

https://elm-chan.org/fsw/ff/

LittleFS

n/a

BSD 3-Clause License

https://github.com/littlefs-project/littlefs

OS

FreeRTOS

v10.2.1

v10.4.3

v10.5.1

MIT License

https://www.freertos.org/

Audio

Audio effect

n/a

For audio effects

Apache-2.0

sonic

n/a

For audio speed

Apache-2.0

FLAC (Free Lossless

Audio Codec) decoder

n/a

For decoding FLAC

v2 or any later version

LGPL

haac

n/a

For decoding haac

The contents of this file, and the files included with this file, are subject to the current version of the RealNetworks Public Source License Version 1.0 (the “RPSL”) unless you have licensed the file under the RealNetworks Community Source License Version 1.0 (the “RCSL”), in which case the RCSL will apply.

gsm610

v1.0.19

For playing sound in ekho

Any use of this software is permitted provided that this notice is not removed and that neither the authors nor the Technische Universitaet Berlin are deemed to have made any representations as to the suitability of this software for any purpose nor are held responsible for any defects of this software.

libopus

n/a

For decode opus

Contributions to the collaboration shall not be considered confidential.

Each contributor represents and warrants that it has the right and authority to license copyright in its contributions to the collaboration.

Each contributor agrees to license the copyright in the contributions under the Modified (2-clause or 3-clause) BSD License or the Clear BSD License.

Please see the IPR statements submitted to the IETF for the complete patent licensing details:

speexdsp

v1.2.1

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

tremolo

v0.07

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Ui

lvgl

v8.3

v9.3

MIT license

Copyright(c) 2021 LVGL Kft

jpeg

v62

libjpeg-turbo is covered by three compatible BSD-style open source licenses:

  • The IJG (Independent JPEG Group) License, which is listed in [README.ijg](README.ijg).

    This license applies to the libjpeg API library and associated programs (any code inherited from libjpeg, and any modifications to that code).

  • The Modified (3-clause) BSD License, which is listed below:

    This license covers the TurboJPEG API library and associated programs.

  • The zlib License, which is listed below:

    This license is a subset of the other two, and it covers the libjpeg-turbo SIMD extensions.

png

v1.6.34

libpng License

zlib

v1.2.11

zlib License

AIVoice

tflite_micro

n/a

Apache-2.0

https://github.com/tensorflow/tflite-micro