Ai-Thinker-Open_RTL8710BX_A.../docs/ARCHITECTURE.md
2026-08-07 15:15:33 +08:00

82 lines
3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# RTL8710BX SDK 架构说明
本文针对已验证的 `smart_outlet@mk3080` 构建目标说明仓库的主要模块和依赖关系。
## 模块分层
### 1. 产品应用层
路径:`Products/example/smart_outlet/`
包含应用入口、LinkKit 主循环、厂商板级业务、设备状态、工厂模式、属性上报和消息处理。`smart_outlet.mk` 是该目标的源码与组件清单。
### 2. 云与通用框架层
路径:`Living_SDK/framework/`
主要包括 LinkKit SDK/HAL、网络管理、OTA、事件循环、CLI 和公共框架。产品应用通过组件依赖进入最终静态库和固件。
### 3. AliOS 内核与系统服务层
路径:`Living_SDK/kernel/``Living_SDK/utility/`
提供 Rhino 内核、初始化流程、VFS、KV、事件循环、网络协议与 cJSON 等基础能力。`Living_SDK/kernel/init/aos_init.c` 负责从内核初始化过渡到产品入口。
### 4. RTL8710BN 平台层
路径:`Living_SDK/platform/mcu/rtl8710bn/`
包含启动适配、HAL、外设驱动、Wi-Fi 厂商库、链接脚本、镜像处理逻辑和预编译 Realtek 库。`rtl8710bn.mk` 定义平台组件与系统配置。
### 5. MK3080 Board 层
路径:`Living_SDK/board/mk3080/`
`mk3080.mk` 将目标绑定到 Cortex-M4 与 `rtl8710bn` MCU family并提供 Board 源码、Boot/ATE 镜像、设备名称和链接后处理配置。
### 6. 构建与固件打包层
路径:`build.sh``tools/mk3080.sh``Service/version/`
`build.sh` 根据 Board 将 MK3080 路由到 `tools/mk3080.sh`。后者先调用 aos-cube 构建 AliOS 静态库,再构建版本组件与产品应用,最终链接 ELF 并生成 BIN、HEX、OTA 和全分区镜像。
## 初始化流程
```text
Realtek startup / app_start.c
-> rtl8710bn aos.c::main
-> aos_init
-> create sys_init_func task
-> aos_start
-> sys_init_func
-> board and system initialization
-> aos_kernel_init
-> VFS / CLI / KV / framework initialization
-> application_start
-> NetMgr / vendor / diagnosis / OTA initialization
-> register Wi-Fi and cloud event filters
-> Wi-Fi gets IP
-> create linkkit task
-> linkkit_main
-> aos_loop_run
```
## 构建依赖关系
```text
smart_outlet
-> LinkKit SDK and HAL
-> NetMgr / common framework / OTA / cJSON / CLI
-> AliOS kernel initialization and Rhino
-> board_mk3080
-> rtl8710bn platform, HAL and vendor libraries
-> ARM GNU linker scripts and firmware packers
```
最终 MAP 文件包含 `smart_outlet``kernel_init``board_mk3080``rtl8710bn``libiot_sdk``netmgr``ota``rhino` 等模块,可与上述依赖关系交叉验证。
## 架构边界
- 本说明只覆盖 `smart_outlet@mk3080`
- 仓库中的其他 Board、示例、第三方源码和预编译库没有逐一验证。
- 静态架构和构建证据不能替代硬件启动、联网、OTA 与外设测试。