Skip to content

Nexus是一个统一、高效、安全的嵌入式软件开发平台,旨在解决嵌入式开发中的碎片化问题。通过提供一致的开发接口和完整的工具链,Nexus让开发者能够专注于应用逻辑,而非底层适配。

License

Notifications You must be signed in to change notification settings

X-Gen-Lab/nexus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nexus Embedded Platform

Build Status License: MIT Documentation

English | 中文

Nexus is a world-class embedded software development platform designed for building reliable, secure, and portable embedded applications.

Features

  • Hardware Abstraction Layer (HAL) - Unified hardware interface across multiple MCU platforms
  • OS Abstraction Layer (OSAL) - Support for FreeRTOS, RT-Thread, Zephyr, and bare-metal
  • Security - Secure boot, TLS 1.3, hardware crypto acceleration
  • Cloud Integration - AWS IoT, Azure IoT, Alibaba Cloud
  • TinyML - TensorFlow Lite Micro support for edge AI
  • Cross-platform - Develop on Windows, Linux, or macOS

Supported Platforms

Platform Status Features
STM32F4 ✅ Supported GPIO, UART, SPI, I2C, ADC, Timer
STM32H7 🚧 Planned + TrustZone, Crypto
ESP32 🚧 Planned + WiFi, BLE
nRF52 🚧 Planned + BLE, Crypto
Native ✅ Supported Host simulation for testing

Quick Start

Prerequisites

All Platforms:

  • CMake 3.16+
  • Git

For Native Build (Testing):

  • Windows: Visual Studio 2019+ or MSVC Build Tools
  • Linux: GCC 9+
  • macOS: Clang 12+

For ARM Cross-Compilation:

  • ARM GCC Toolchain 10.3+ (arm-none-eabi-gcc)

For Documentation:

  • Doxygen 1.9+
  • Python 3.8+ with Sphinx (pip install sphinx breathe)

Build for Native (Host Testing)

# Clone repository
git clone https://github.com/nexus-platform/nexus.git
cd nexus

# Configure for native platform
cmake -B build -DCMAKE_BUILD_TYPE=Release -DNEXUS_PLATFORM=native

# Build
cmake --build build --config Release

# Run tests
ctest --test-dir build -C Release --output-on-failure

Build for STM32F4

# Configure for STM32F4
cmake -B build-stm32f4 \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/arm-none-eabi.cmake \
    -DNEXUS_PLATFORM=stm32f4

# Build
cmake --build build-stm32f4 --config Release

# Output: build-stm32f4/applications/blinky/blinky.elf

Build Options

Option Default Description
NEXUS_PLATFORM native Target platform: native, stm32f4
NEXUS_BUILD_TESTS ON Build unit tests
NEXUS_BUILD_EXAMPLES ON Build example applications
NEXUS_ENABLE_COVERAGE OFF Enable code coverage

Build Documentation

# Generate API documentation (Doxygen)
doxygen Doxyfile

# Build Sphinx documentation (English)
cd docs/sphinx
python -m sphinx -b html . _build/html/en

# Build Sphinx documentation (Chinese)
python -m sphinx -b html . _build/html/cn -D master_doc=index_cn -D language=zh_CN

# Or use the build script (Windows)
build_docs.bat

First Project

#include "hal/nx_hal.h"

int main(void)
{
    /* Initialize HAL */
    nx_hal_init();

    /* Get GPIO device (Port A, Pin 5) */
    nx_gpio_config_t cfg = {
        .mode  = NX_GPIO_MODE_OUTPUT_PP,
        .pull  = NX_GPIO_PULL_NONE,
        .speed = NX_GPIO_SPEED_LOW,
    };

    nx_gpio_t* led = nx_factory_gpio_with_config(0, 5, &cfg);
    if (!led) {
        return -1;
    }

    while (1) {
        led->toggle(led);
        /* delay 500ms - platform specific */
    }

    nx_factory_gpio_release(led);
    nx_hal_deinit();
    return 0;
}

Project Structure

nexus/
├── hal/                    # Hardware Abstraction Layer
│   ├── include/hal/        #   Public headers
│   └── src/                #   Common implementations
├── osal/                   # OS Abstraction Layer
│   ├── include/osal/       #   Public headers
│   └── adapters/           #   RTOS adapters (baremetal, freertos)
├── platforms/              # Platform-specific implementations
│   ├── native/             #   Host simulation (Windows/Linux/macOS)
│   └── stm32f4/            #   STM32F4 HAL implementations
├── applications/           # Example applications
│   └── blinky/             #   LED blink example
├── tests/                  # Unit tests (Google Test)
│   └── hal/                #   HAL unit tests
├── docs/                   # Documentation
│   ├── api/                #   Doxygen output
│   ├── sphinx/             #   Sphinx documentation (EN/CN)
│   └── requirements/       #   PRD and roadmap
├── cmake/                  # CMake modules
│   ├── modules/            #   Helper functions
│   └── toolchains/         #   Cross-compilation toolchains
└── .github/workflows/      # CI/CD pipelines

Documentation

  • API Reference: Run doxygen Doxyfile then open docs/api/html/index.html
  • User Guide: Run Sphinx build then open docs/sphinx/_build/html/index.html
  • Contributing Guide: How to contribute
  • Changelog: Version history

Development

Code Style

This project uses:

  • .clang-format - Code formatting (80 char limit, 4 space indent)
  • .clang-tidy - Static analysis
  • .editorconfig - Editor settings

Format code before committing:

clang-format -i hal/**/*.c hal/**/*.h

Running Tests

# Build with tests enabled
cmake -B build -DNEXUS_PLATFORM=native -DNEXUS_BUILD_TESTS=ON
cmake --build build --config Release

# Run all tests
ctest --test-dir build -C Release --output-on-failure

# Run specific test
./build/tests/Release/nexus_tests --gtest_filter="HalGpioTest.*"

Doxygen Comment Style

Use backslash style for Doxygen comments:

/**
 * \file            nx_gpio.h
 * \brief           GPIO device interface definition
 * \author          Nexus Team
 */

/**
 * \brief           Get GPIO device with configuration
 * \param[in]       port: GPIO port number
 * \param[in]       pin: GPIO pin number
 * \param[in]       cfg: GPIO configuration
 * \return          GPIO interface pointer, NULL on failure
 */
nx_gpio_t* nx_factory_gpio_with_config(uint8_t port, uint8_t pin,
                                       const nx_gpio_config_t* cfg);

CI/CD

GitHub Actions workflows:

  • build.yml: Multi-platform build (Windows, Linux, macOS) + ARM cross-compilation
  • test.yml: Unit tests with coverage + sanitizers + MISRA checks

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

License

This project is licensed under the MIT License - see the LICENSE file for details.


Nexus 嵌入式平台

Nexus 是一个世界级的嵌入式软件开发平台,专为构建可靠、安全、可移植的嵌入式应用而设计。

功能特性

  • 硬件抽象层 (HAL) - 跨多种 MCU 平台的统一硬件接口
  • 操作系统抽象层 (OSAL) - 支持 FreeRTOS、RT-Thread、Zephyr 和裸机
  • 安全特性 - 安全启动、TLS 1.3、硬件加密加速
  • 云端集成 - AWS IoT、Azure IoT、阿里云
  • TinyML - 支持 TensorFlow Lite Micro 边缘 AI
  • 跨平台开发 - 支持 Windows、Linux、macOS 开发环境

快速开始

环境要求

  • CMake 3.16+
  • Git
  • Windows: Visual Studio 2019+ 或 MSVC Build Tools
  • ARM 交叉编译: arm-none-eabi-gcc 10.3+

构建 (本地测试)

git clone https://github.com/nexus-platform/nexus.git
cd nexus

# 配置
cmake -B build -DCMAKE_BUILD_TYPE=Release -DNEXUS_PLATFORM=native

# 构建
cmake --build build --config Release

# 运行测试
ctest --test-dir build -C Release --output-on-failure

构建 STM32F4

cmake -B build-stm32f4 \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/arm-none-eabi.cmake \
    -DNEXUS_PLATFORM=stm32f4

cmake --build build-stm32f4 --config Release

构建文档

# API 文档
doxygen Doxyfile

# 用户文档 (中文)
cd docs/sphinx
python -m sphinx -b html . _build/html/cn -D master_doc=index_cn -D language=zh_CN

文档

  • API 参考: 运行 doxygen Doxyfile 后打开 docs/api/html/index.html
  • 用户指南: 运行 Sphinx 构建后打开 docs/sphinx/_build/html/cn/index_cn.html
  • 贡献指南: 如何参与贡献
  • 更新日志: 版本历史

许可证

本项目采用 MIT 许可证 - 详见 LICENSE 文件。

About

Nexus是一个统一、高效、安全的嵌入式软件开发平台,旨在解决嵌入式开发中的碎片化问题。通过提供一致的开发接口和完整的工具链,Nexus让开发者能够专注于应用逻辑,而非底层适配。

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published