Nuclei-Software / nuclei-sdk

Nuclei RISC-V Software Development Kit
https://doc.nucleisys.com/nuclei_sdk
Apache License 2.0
117 stars 50 forks source link
embedded-hal embedded-systems fpga-evaluation-board freertos iot-platform makefile nmsis nuclei nuclei-sdk opensource platformio risc-v riscv rt-thread rtos sdk ucosii

Nuclei Software Development Kit

Build Documentation Build SDK

[!NOTE] If you want to build and run on Nuclei 100 series CPU, please switch to develop_n100 or master_n100 branch.

Since 0.5.0 release, Nuclei Studio >= 2023.10 and Nuclei RISC-V Toolchain/Qemu/OpenOCD >= 2023.10 are required to build and run.

Nuclei Software Development Kit(Nuclei SDK) is developed for developing and evaluating software for Nuclei Evaluation SoC.

Nuclei SDK Diagram

This Nuclei SDK is built based on the NMSIS framework, user can access all the APIs provided by NMSIS and also the APIs that provided by Nuclei SDK which mainly for on-board peripherals access such as GPIO, UART, SPI and I2C etc.

This Nuclei SDK can support various compiler such as Nuclei riscv gcc/clang, IAR compiler and Terapines ZCC.

We also intergated many RTOSes into Nuclei SDK, which are FreeRTOS, UCOSII, RTThread and ThreadX, you can easily find it in the OS folder.

Quick Startup

Wanner to take a try with Nuclei SDK for Nuclei 200/300/600/900/1000 series CPU, click Quick Start with Nuclei SDK to start up.

Wanner to take a try with Nuclei N100 SDK for Nuclei 100 series CPU, click Quick Start with Nuclei N100 SDK to start up.

Requirements

Directory Structure

Here is the directory structure for this Nuclei SDK.

$NUCLEI_SDK_ROOT
├── application
│   ├── baremetal
│   ├── freertos
│   ├── ucosii
│   ├── threadx
│   └── rtthread
├── Build
│   ├── gmsl
│   ├── toolchain
│   ├── Makefile.base
│   ├── Makefile.conf
│   ├── Makefile.core
│   ├── Makefile.components
│   ├── Makefile.files
│   ├── Makefile.global
│   ├── Makefile.misc
│   ├── Makefile.rtos
│   ├── Makefile.rules
│   └── Makefile.soc
├── doc
│   ├── build
│   ├── source
│   ├── Makefile
│   └── requirements.txt
├── NMSIS
│   ├── Core
│   ├── DSP
│   ├── NN
│   └── Library
├── OS
│   ├── FreeRTOS
│   ├── UCOSII
│   ├── ThreadX
│   └── RTThread
├── SoC
│   ├── gd32vf103
│   └── evalsoc
├── test
│   ├── core
│   ├── ctest.h
│   ├── LICENSE
│   └── README.md
├── LICENSE
├── Makefile
├── NMSIS_VERSION
├── package.json
├── SConscript
├── README.md
├── setup.bat
└── setup.sh

How to use

  1. Create and modify your own setup config
    • For Linux, create setup_config.sh in $NUCLEI_SDK_ROOT.
    • For Windows, create setup_config.bat in %NUCLEI_SDK_ROOT%.
  2. Source the environment script right in NUCLEI_SDK_ROOT
    • For Linux: source setup.sh
    • For Windows: setup.bat
  3. Build and run application.
    • Note: By default, the SoC and Board is set to evalsoc and nuclei_fpga_eval, if you don't pass any SOC and BOARD variable in Make command, it will use the default SoC and Board.
    • Assume that you will run this application -> application/baremetal/helloworld/.
    • cd application/baremetal/helloworld/
    • you can run make help to show help message.
    • We provided different Nuclei Core configurations(CORE=) we supported, see Build/Makefile.core.
      • such as CORE=n305
    • We support several download modes(DOWNLOAD=) for different applications.
      • flashxip: Program will to be download into flash and run directly in Flash
      • flash: Program will be download into flash, when running, program will be copied to ilm/ram and run in ilm/ram
      • ilm: Program will be download into ilm/ram and run directly in ilm/ram, program lost when poweroff
    • For example, if you want to build your application for CORE=n305 DOWNLOAD=ilm, you can easily run this command:
      make CORE=n305 DOWNLOAD=ilm all
    • If you want to upload your application for CORE=n305 DOWNLOAD=ilm, you can easily run this command:
      make CORE=n305 DOWNLOAD=ilm upload
    • (Option 1)If you want to debug your application for CORE=n305 DOWNLOAD=ilm:
      • First open a new terminal in the same application folder and run: make CORE=n305 DOWNLOAD=ilm run_openocd
      • Then run this command make CORE=n305 DOWNLOAD=ilm run_gdb in the existing terminal, then you can debug it using gdb, if you want to load your program, you need to type load to achieve it.
      • Notice: Since version 0.2.4, you can also pass extra GDB_PORT=<portno>, to change to use new gdb port other than default 3333, for example, make CORE=n305 DOWNLOAD=ilm GDB_PORT=3344 run_openocd and make CORE=n305 DOWNLOAD=ilm GDB_PORT=3344 run_gdb
    • (Option 2)If you want to debug your application for CORE=n305 DOWNLOAD=ilm:
      make CORE=n305 DOWNLOAD=ilm debug
    • If you want to use UART terminal tool to view the UART message, you can choose screen or minicom in Linux, teraterm in Windows, the default UART baudrate we use is 115200.

Knowledge book

Contributing

Changelog