How seeed-studio/sscma-example-sg200x works
Project type and purpose
• This is an embedded-oriented, cross-compilation framework for the ReCamera “SG200X” platform. It provides:
• A CMake-based build system and toolchain integration (RISC-V Linux musl).
• A set of hardware abstraction components (audio, video, common IPC).
• An SSCMA-Micro portability layer (MQTT, RTSP, file, WebSocket transports).
• Several “solutions” (sample applications) that consume those components: audio demos, HelloWorld, device control, model execution, node agent, supervisor daemon + web UI, video demo.
File structure
• Top-level directories:
• cmake/ – build scripts, toolchain definitions, packaging.
• components/ – divided into:
sophgo/ – low-level audio/video drivers and plugin.
sscma-micro/ – portable SSCMA runtime API and hardware porting.
• solutions/ – per-application CMake projects for various use cases:
helloworld, audio-plugin, audio, device, sscma-model, sscma-node, supervisor (daemon + web front end), video_demo.
• docs/, scripts/, test/, tools/ – supporting material.
README for additional insights
• Describes dependency on ReCamera-OS SDK and cross-toolchain.
• Of build → CMake → cmake/ → binaries → cpack into .deb → deploy on device → run.
a. Main components:
• Host Build Environment
– CMake + toolchain (RISC-V GCC)
– ReCamera-OS SDK (headers, libraries)
• Build Artifacts
– .deb packages (per solution)
• Target Device (SG200X)
– Linux/musl runtime
– Hardware Modules: Sophgo SoC with audio/video peripherals
– Device Drivers (components/sophgo/audio, /video)
– SSCMA-Micro Port layer (components/sscma-micro)
– Applications (solutions/*):
· Supervisor daemon (flows engine, HTTP API)
· Supervisor web UI (React/Vite)
· SSCMA-Node (camera agent, gRPC/MQTT/RTSP)
· SSCMA-Model runner (embedded inference)
· Audio plugin (ALSA plugin)
· Video demo (RTSP streaming)
· Device control, HelloWorld, Audio demo
• External Clients / Services
– Browser/UI talking to supervisor HTTP endpoints
– MQTT/RTSP/WebSocket clients for SSCMA-Node
b. Relationships / interactions:
• Build phase: Host → CMake scripts (cmake/) → compile components + solutions → produce .deb
• Deploy: Transfer & install .deb on device → each application installed under /usr or /opt
• Runtime on device:
– Supervisor daemon loads “flows” definitions and CVI models → orchestrates pipelines via SSCMA-Micro → communicates with hardware drivers.
– Web UI (static assets served by supervisor or separate web server) → calls Supervisor HTTP API.
– SSCMA-Node acts as autonomous agent interfacing camera and models → may publish to MQTT or RTSP.
– Audio plugin registers with ALSA → applications open ALSA device for audio I/O.
– Video demo opens V4L2/ISP via components/sophgo/video → streams out via RTSP.
c. Architectural patterns / design principles:
• Layered architecture:
Hardware drivers → portability layer → application logic → presentation/UI.
• Modular plugin design: audio_plugin splits core audio I/O and ALSA plugin.
• Microservices/daemons: SSCMA-Node and Supervisor as separate services communicating over network or IPC.
• CMake-driven build and packaging → reproducible cross-compile.
d. Key technologies / frameworks / libraries:
• C/C++ with CMake, custom macros under cmake/
• RISC-V musl GCC toolchain (via toolchain file)
• ALSA (audio), V4L2 or ISP APIs (video) from Sophgo SDK
• SSCMA-Micro SDK (components/sscma-micro)
• React + TypeScript + Vite (supervisor/www)
• MQTT, RTSP, WebSocket transports in SSCMA-Node
Detail advice
• Break the project into as many logical components as possible (build system, SDK, drivers, middleware, apps, UI).
• Cross-toolchain interactions and how each solution depends on the common components.
• Packaging and deployment steps to show end-to-end flow from code to running on SG200X.