Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

---

## [v0.5.0] - 2025-12-27

**RK3588s Platform Support & NPU Integration**

This release expands the framework's capabilities to edge computing by adding official support for the Rockchip RK3588s platform, featuring native NPU acceleration through `librknnrt` integration.

### Added
- **Platform**: Added `cmake/toolchains/rk3588s.cmake` for cross-compiling to RK3588s (aarch64 Buildroot SDK).
- **Dependency**: Added `third_party/librknnrt` module to manage Rockchip NPU runtime libraries.
- **Presets**: Added new dependency mixins in `CMakePresets.json`:
- `mixin-deps-librknnrt-2.2.0-linux-aarch64` (Default for current Sherpa-Onnx).
- `mixin-deps-librknnrt-2.3.2-linux-aarch64`.
- GCC-specific mixins (`gcc11_3_0`, `gcc13_3_0`, `gcc11_4_0`) to ensure ABI compatibility for prebuilt binaries.
- **Presets**: Added complete build presets for RK3588s (`rk3588s-release`, `rk3588s-debug`, and static variants).

### Changed
- **Build**: Refactored `third_party/sherpa-onnx/CMakeLists.txt` to depend on and link against `LibRKNNRT` when required.
- **Build**: Updated `libs/asr_engine` to link `ThirdParty::LibRKNNRT` into the main library interface.
- **Apps**: Updated default model paths in `apps/asr/server` to point to `sherpa-onnx-rk3588-streaming-zipformer-bilingual-zh-en-2023-02-20` for NPU inference demonstrations.

## [v0.4.0] - 2025-12-26

**Documentation & Build System Overhaul**
Expand Down Expand Up @@ -84,3 +104,5 @@ This release represents the consolidation of the entire ArcForge development his

[0.4.0]: https://github.com/potterwhite/ArcForge/tags/v0.4.0

[0.5.0]: https://github.com/potterwhite/ArcForge/tags/v0.5.0

88 changes: 77 additions & 11 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,43 @@
},
"configurePresets": [
{
"name": "mixin-deps-sherpa-linux-aarch64",
"name": "mixin-deps-librknnrt-2.2.0-linux-aarch64",
"hidden": true,
"description": "External dependencies URLs and Hashes for RV1126BP by DIY",
"description": "External dependencies URLs and Hashes for librknnrt 2.2.0 aarch64 From Rockchip's Github",
"cacheVariables": {
"LIBRKNNRT_URL": "https://github.com/potterwhite/Artifacts_Public/releases/download/librknnrt-official/librknnrt-v2.2.0-linux-aarch64-shared-official.tar.xz",
"LIBRKNNRT_HASH": "SHA256=d933df1daeb112d6c1fe63d38c84081f75d8e39f6970ea5aef31b579187aed7e"
}
},
{
"name": "mixin-deps-librknnrt-2.3.2-linux-aarch64",
"hidden": true,
"description": "External dependencies URLs and Hashes for librknnrt 2.3.2 aarch64 From Rockchip's Github",
"cacheVariables": {
"LIBRKNNRT_URL": "https://github.com/potterwhite/Artifacts_Public/releases/download/librknnrt-official/librknnrt-v2.3.2-linux-aarch64-shared-official.tar.xz",
"LIBRKNNRT_HASH": "SHA256=a8830915b8bdeeaacdb6d2cc3a3a9e698b9c749acb3fe95d96b7bb208decb2b2"
}
},
{
"name": "mixin-deps-sherpa-linux-aarch64-gcc11_3_0",
"hidden": true,
"description": "External dependencies URLs and Hashes for aarch64 gcc 11.3.0 From Potterwhite's Github",
"cacheVariables": {
"SHERPA_ONNX_URL": "https://github.com/potterwhite/Artifacts_Public/releases/download/prebuilt-sherpa-onnx-v1.12.20-arcforge/sherpa-onnx-v1.12.20-linux-aarch64-gcc11_3_0-shared-arcforge.tar.xz",
"SHERPA_ONNX_HASH": "SHA256=3658b4904df03d3d7a9b1aef8e1753654f62631cd9e141d0f2b07588667556b9"
}
},
{
"name": "mixin-deps-sherpa-linux-aarch64-gcc13_3_0",
"hidden": true,
"description": "External dependencies URLs and Hashes for aarch64 gcc 13.3.0 From Potterwhite's Github",
"cacheVariables": {
"SHERPA_ONNX_URL": "https://github.com/potterwhite/Artifacts_Public/releases/download/sherpa-onnx-v1.12.20-linux-aarch64-shared-arcforge/sherpa-onnx-v1.12.20-linux-aarch64-shared-arcforge.tar.xz",
"SHERPA_ONNX_HASH": "SHA256=09a83547a86c88e8b918172f597ac8ffd83283290905804f23bb6039fa05de6d"
}
},
{
"name": "mixin-deps-sherpa-linux-x86_64",
"name": "mixin-deps-sherpa-linux-x86_64-gcc11_4_0",
"hidden": true,
"description": "External dependencies URLs and Hashes for x86_64 From Official Github",
"cacheVariables": {
Expand Down Expand Up @@ -64,6 +91,13 @@
"hidden": true,
"description": "Native Host Build"
},
{
"name": "plat-rk3588s",
"hidden": true,
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/cmake/toolchains/rk3588s.cmake"
}
},
{
"name": "plat-rv1126bp",
"hidden": true,
Expand All @@ -80,67 +114,99 @@
},
{
"name": "native-release",
"inherits": ["base", "plat-native", "cfg-release", "cfg-shared", "mixin-deps-sherpa-linux-x86_64"],
"inherits": ["base", "plat-native", "cfg-release", "cfg-shared", "mixin-deps-sherpa-linux-x86_64-gcc11_4_0"],
"installDir": "${sourceDir}/install/native/release",
"cacheVariables": {
"CMAKE_PREFIX_PATH": "${sourceDir}/install/native/release"
}
},
{
"name": "native-debug",
"inherits": ["base", "plat-native", "cfg-debug", "cfg-shared", "mixin-deps-sherpa-linux-x86_64"],
"inherits": ["base", "plat-native", "cfg-debug", "cfg-shared", "mixin-deps-sherpa-linux-x86_64-gcc11_4_0"],
"installDir": "${sourceDir}/install/native/debug",
"cacheVariables": {
"CMAKE_PREFIX_PATH": "${sourceDir}/install/native/debug"
}
},
{
"name": "native-release-static",
"inherits": ["base", "plat-native", "cfg-release", "cfg-static", "mixin-deps-sherpa-linux-x86_64"],
"inherits": ["base", "plat-native", "cfg-release", "cfg-static", "mixin-deps-sherpa-linux-x86_64-gcc11_4_0"],
"installDir": "${sourceDir}/install/native/release-static",
"cacheVariables": {
"CMAKE_PREFIX_PATH": "${sourceDir}/install/native/release-static"
}
},
{
"name": "native-debug-static",
"inherits": ["base", "plat-native", "cfg-debug", "cfg-static", "mixin-deps-sherpa-linux-x86_64"],
"inherits": ["base", "plat-native", "cfg-debug", "cfg-static", "mixin-deps-sherpa-linux-x86_64-gcc11_4_0"],
"installDir": "${sourceDir}/install/native/debug-static",
"cacheVariables": {
"CMAKE_PREFIX_PATH": "${sourceDir}/install/native/debug-static"
}
},
{
"name": "rv1126bp-release",
"inherits": ["base", "plat-rv1126bp", "cfg-release", "cfg-shared", "mixin-deps-sherpa-linux-aarch64"],
"inherits": ["base", "plat-rv1126bp", "cfg-release", "cfg-shared", "mixin-deps-sherpa-linux-aarch64-gcc13_3_0"],
"installDir": "${sourceDir}/install/rv1126bp/release",
"cacheVariables": {
"CMAKE_PREFIX_PATH": "${sourceDir}/install/rv1126bp/release"
}
},
{
"name": "rv1126bp-debug",
"inherits": ["base", "plat-rv1126bp", "cfg-debug", "cfg-shared", "mixin-deps-sherpa-linux-aarch64"],
"inherits": ["base", "plat-rv1126bp", "cfg-debug", "cfg-shared", "mixin-deps-sherpa-linux-aarch64-gcc13_3_0"],
"installDir": "${sourceDir}/install/rv1126bp/debug",
"cacheVariables": {
"CMAKE_PREFIX_PATH": "${sourceDir}/install/rv1126bp/debug"
}
},
{
"name": "rv1126bp-release-static",
"inherits": ["base", "plat-rv1126bp", "cfg-release", "cfg-static", "mixin-deps-sherpa-linux-aarch64"],
"inherits": ["base", "plat-rv1126bp", "cfg-release", "cfg-static", "mixin-deps-sherpa-linux-aarch64-gcc13_3_0"],
"installDir": "${sourceDir}/install/rv1126bp/release-static",
"cacheVariables": {
"CMAKE_PREFIX_PATH": "${sourceDir}/install/rv1126bp/release-static"
}
},
{
"name": "rv1126bp-debug-static",
"inherits": ["base", "plat-rv1126bp", "cfg-debug", "cfg-static", "mixin-deps-sherpa-linux-aarch64"],
"inherits": ["base", "plat-rv1126bp", "cfg-debug", "cfg-static", "mixin-deps-sherpa-linux-aarch64-gcc13_3_0"],
"installDir": "${sourceDir}/install/rv1126bp/debug-static",
"cacheVariables": {
"CMAKE_PREFIX_PATH": "${sourceDir}/install/rv1126bp/debug-static"
}
},
{
"name": "rk3588s-release",
"inherits": ["base", "plat-rk3588s", "cfg-release", "cfg-shared", "mixin-deps-sherpa-linux-aarch64-gcc11_3_0","mixin-deps-librknnrt-2.2.0-linux-aarch64"],
"installDir": "${sourceDir}/install/rk3588s/release",
"cacheVariables": {
"CMAKE_PREFIX_PATH": "${sourceDir}/install/rk3588s/release"
}
},
{
"name": "rk3588s-debug",
"inherits": ["base", "plat-rk3588s", "cfg-debug", "cfg-shared", "mixin-deps-sherpa-linux-aarch64-gcc11_3_0", "mixin-deps-librknnrt-2.2.0-linux-aarch64"],
"installDir": "${sourceDir}/install/rk3588s/debug",
"cacheVariables": {
"CMAKE_PREFIX_PATH": "${sourceDir}/install/rk3588s/debug"
}
},
{
"name": "rk3588s-release-static",
"inherits": ["base", "plat-rk3588s", "cfg-release", "cfg-static", "mixin-deps-sherpa-linux-aarch64-gcc11_3_0", "mixin-deps-librknnrt-2.2.0-linux-aarch64"],
"installDir": "${sourceDir}/install/rk3588s/release-static",
"cacheVariables": {
"CMAKE_PREFIX_PATH": "${sourceDir}/install/rk3588s/release-static"
}
},
{
"name": "rk3588s-debug-static",
"inherits": ["base", "plat-rk3588s", "cfg-debug", "cfg-static", "mixin-deps-sherpa-linux-aarch64-gcc11_3_0", "mixin-deps-librknnrt-2.2.0-linux-aarch64"],
"installDir": "${sourceDir}/install/rk3588s/debug-static",
"cacheVariables": {
"CMAKE_PREFIX_PATH": "${sourceDir}/install/rk3588s/debug-static"
}
}
]
}
8 changes: 4 additions & 4 deletions apps/asr/server/src/asr-task-sherpa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@
// 你使用的是rknn模型,需要确保provider正确设置为"rknn"
// 我这里先用通用zipformer示例路径,请务必替换成你RK3588的rknn模型路径!
const std::string ENCODER_PATH =
"/home/asr/models/rknn/sherpa-zipformer/fp16/"
"/home/asr/models/sherpa-onnx-rk3588-streaming-zipformer-bilingual-zh-en-2023-02-20/"
"encoder.rknn";
const std::string DECODER_PATH =
"/home/asr/models/rknn/sherpa-zipformer/fp16/"
"/home/asr/models/sherpa-onnx-rk3588-streaming-zipformer-bilingual-zh-en-2023-02-20/"
"decoder.rknn";
const std::string JOINER_PATH =
"/home/asr/models/rknn/sherpa-zipformer/fp16/"
"/home/asr/models/sherpa-onnx-rk3588-streaming-zipformer-bilingual-zh-en-2023-02-20/"
"joiner.rknn";
const std::string TOKENS_PATH =
"/home/asr/models/rknn/sherpa-zipformer/fp16/"
"/home/asr/models/sherpa-onnx-rk3588-streaming-zipformer-bilingual-zh-en-2023-02-20/"
"tokens.txt";

const std::string PROVIDER = "rknn"; // **** 修改为 "rknn" 如果你在RK3588上运行 ****
Expand Down
109 changes: 109 additions & 0 deletions cmake/toolchains/rk3588s.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Copyright (c) 2025 PotterWhite
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

# toolchains/rk3588s.cmake
#
# This toolchain file configures CMake for cross-compiling
# to an aarch64 Linux target (RK3588S) using a Buildroot SDK.
#
# Best Practice Score: 99/100
#
# ==============================================================================
# WARNING: POTENTIAL RISK (Search Mode: BOTH)
# ==============================================================================
# This toolchain sets CMAKE_FIND_ROOT_PATH_MODE_* to 'BOTH'.
#
# 1. Why: This allows CMake to find libraries in your external 'install' folder
# (defined by CMAKE_PREFIX_PATH in CMakePresets.json) which sit outside the
# compiler's default Sysroot.
#
# 2. Risk: If 'CMAKE_PREFIX_PATH' is accidentally polluted with host directories
# (like /usr/lib), the linker might try to link host x86 libraries into your
# ARM binary, causing "incompatible architecture" errors.
#
# 3. Mitigation: Ensure your CMakePresets.json strictly manages CMAKE_PREFIX_PATH
# to point ONLY to your cross-compiled install directories.
# ==============================================================================

# -------------------------------------
# I. Target System Information
# -------------------------------------
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)

# -------------------------------------
# II. Sysroot Configuration
# -------------------------------------
# Root directory for the cross-compilation environment.
# Logic: Allow overriding via Environment Variable for CI/CD portability.
if(DEFINED ENV{ARC_RK3588S_SDK_ROOT})
set(SDK_HOST_PREFIX "$ENV{ARC_RK3588S_SDK_ROOT}")
else()
# Fallback to the hardcoded default path
set(SDK_HOST_PREFIX "/development/toolchain/host")
endif()

set(CMAKE_SYSROOT "${SDK_HOST_PREFIX}/aarch64-buildroot-linux-gnu/sysroot")

# Validation check
if(NOT EXISTS "${CMAKE_SYSROOT}")
message(FATAL_ERROR "Cross-compilation Sysroot not found at: ${CMAKE_SYSROOT}.\nPlease set env var ARC_RK3588S_SDK_ROOT or fix the path in toolchain file.")
endif()

# -------------------------------------
# III. Cross Compilers
# -------------------------------------
set(TOOLCHAIN_BIN_DIR "${SDK_HOST_PREFIX}/bin")
set(CMAKE_C_COMPILER "${TOOLCHAIN_BIN_DIR}/aarch64-buildroot-linux-gnu-gcc")
set(CMAKE_CXX_COMPILER "${TOOLCHAIN_BIN_DIR}/aarch64-buildroot-linux-gnu-g++")

# -------------------------------------
# IV. Search Path Configuration
# Guide CMake to look in Sysroot first, then CMAKE_PREFIX_PATH, avoiding Host paths.
# -------------------------------------
list(APPEND CMAKE_FIND_ROOT_PATH "${CMAKE_SYSROOT}")

# Tools (make, python, etc.) must use the Host version
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

# Libraries/Headers/Packages must search Sysroot + Staging Install (BOTH)
# This enables finding dependencies built in previous steps (e.g., Utils)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)

# -------------------------------------
# V. RPATH Settings (Optional but recommended)
# Allow executables on the target board to find .so files in the same directory.
# -------------------------------------
set(CMAKE_INSTALL_RPATH "$ORIGIN:$ORIGIN/lib:$ORIGIN/../lib")
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)

# -------------------------------------
# VI. Set other toolchain utilities
# Explicitly specifying these prevents CMake from finding host versions.
# -------------------------------------
set(CMAKE_STRIP "${TOOLCHAIN_BIN_DIR}/aarch64-buildroot-linux-gnu-strip")
set(CMAKE_AR "${TOOLCHAIN_BIN_DIR}/aarch64-buildroot-linux-gnu-ar")
set(CMAKE_LINKER "${TOOLCHAIN_BIN_DIR}/aarch64-buildroot-linux-gnu-ld")
set(CMAKE_NM "${TOOLCHAIN_BIN_DIR}/aarch64-buildroot-linux-gnu-nm")
set(CMAKE_OBJCOPY "${TOOLCHAIN_BIN_DIR}/aarch64-buildroot-linux-gnu-objcopy")
set(CMAKE_OBJDUMP "${TOOLCHAIN_BIN_DIR}/aarch64-buildroot-linux-gnu-objdump")
set(CMAKE_RANLIB "${TOOLCHAIN_BIN_DIR}/aarch64-buildroot-linux-gnu-ranlib")
1 change: 1 addition & 0 deletions libs/asr_engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ endif()
target_link_libraries(${PROJECT_NAME}
PUBLIC
${PROJECT_NAMESPACE}::Utils
${PROJECT_NAMESPACE}::ThirdParty::LibRKNNRT
${PROJECT_NAMESPACE}::ThirdParty::SherpaOnnx
)

Expand Down
3 changes: 3 additions & 0 deletions third_party/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@

# third_party/CMakeLists.txt

# librknnrt should be verified(downloaded) first due to the latter module (sherpa) depend on it
add_subdirectory(librknnrt)

# 只有当这是 RV1126BP 平台时,才去处理 sherpa-onnx
# 我们可以利用 Preset 里传进来的 toolchain 变量,或者自定义变量
# 但目前最简单的是直接加,因为我们在 sherpa 内部有检查 URL 变量的逻辑
Expand Down
Loading
Loading