How nuclei-software/nuclei-sdk works
Main Components
• Build System and Infrastructure:
• The “Build” folder contains multiple Makefiles (e.g., Makefile.core, Makefile.components, Makefile.rtos, etc.) which orchestrate the build of SDK components.
• The root Makefile and SConscript serve as entry points to build and debug applications across multiple platforms.
• Application Layers:
• The “application” directory is divided into subdirectories for various deployment models: baremetal, FreeRTOS, UCOSII, RTThread, and ThreadX.
• Each type represents a specific flavor of application built on top of the same SDK infrastructure.
• SoC and Board Abstraction:
• The “SoC” directory holds support packages for different processors and boards. It includes folders like evalsoc, gd32vf103, and gd32vw55x.
• Each SoC design contains a “Common” and “Board” layer: the Common subfolder contains device drivers and system-level code (including the mandatory “nuclei_sdk_soc.h”), while each board directory provides hardware abstraction (with “nuclei_sdk_hal.h”).
• NMSIS and DSP/NN Library:
• The “NMSIS” directory (including Core, DSP, NN, and Library subdirectories) provides the peripheral and core definitions. The SDK is built on this foundation so it is critical to show its central role.
• OS Packages:
• The “OS” directory includes RTOS implementations that are integrated in the SDK. Each OS (FreeRTOS, UCOSII, ThreadX, RTThread) can be shown as separate building blocks that supply kernel services to corresponding application projects.
• Supporting Tools and Documentation:
• Tools for benchmarking, configuration, testing, and the IDE support (Nuclei Studio, PlatformIO integration via package.json, etc.) appear within directories like “tools”, “ideprojects”, and “doc”. These are essential for both development and evaluation.
Relationships and Interactions
• A layered model:
– At the bottom, show the Hardware and SoC/Board Abstraction layer, including both custom SoC hardware support and board initialization (the HAL provided via “nuclei_sdk_soc.h” and “nuclei_sdk_hal.h”).
– Above that, show the NMSIS layer that abstracts the CPU/DSP instructions and peripheral functionality.
– Next, add the OS Layer (if used) and then the Application layer (baremetal or RTOS-based).
• Connections that show the integration of external toolchains (Nuclei RISC-V gcc/clang, IAR, Terapines) and debugging tools (OpenOCD, gdb).
• In an auxiliary section, include the “tools” and “ideprojects” components to show their role in project configuration, benchmarking, and IDE integration.
Architectural Patterns and Design Principles
• Modularity – by dividing the system into independent and clearly defined modules (NMSIS, OS, SoC/Board, Applications, Build Infrastructure).
• Abstraction layers between hardware-specific code and the application logic.
• That the build scripts act as “glue code” that integrates these independent modules.
• How external configurations (such as toolchain-specific Makefiles in “Build/toolchain” and CPU configuration files within “tools/scripts/nsdk_cli/configs”) replace hard-coded parameters via variable substitution (e.g., CORE, DOWNLOAD options).
Technologies and Frameworks
• Integration of various compilers (nuclei_gnu, nuclei_llvm, IAR, Terapines ZCC) and debugging/flash download flows.
• Mention that PlatformIO support is provided through package.json.