RISC-V

 
 
RISC-V is an open standard instruction set architecture (ISA) based on established reduced instruction set computer (RISC) principles. The RISC-V ISA is provided under open source licenses that do not require fees to use.

More information about RISC-V can be found at:
https://riscv.org/








Unofficial MacOS PlatformIO support for Sipeed Longan Nano (gd32v).



Information
none

Operating system used
macOS Monterey

Software prerequisites
Homebrew

Procedure
  • Create folder.
    Type: mkdir ~/repositories

  • Clone repository.
    Type: cd ~/repositories
    Type: git clone https://github.com/yesitsme007/platform-gd32v-mac-unofficial

  • Download and unpack these files.
    https://github.com/yesitsme007/test1/releases/download/0.0.1/tool-gd32vflash-darwin_x86_64-0.1.0-unofficial.tar.gz

    https://github.com/yesitsme007/test1/releases/download/0.0.1/tool-openocd-riscv-darwin_x86_64-0.9.20191123-unofficial.tar.gz

    https://github.com/yesitsme007/test1/releases/download/0.0.1/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-apple-darwin.tar.gz

  • Copy these 3 unpacked folders to: /Users/<user>/.platformio/packages

  • Rename these folders:
    Type: mv riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-apple-darwin toolchain-gd32v-mac

    Type: mv tool-gd32vflash-darwin_x86_64-0.1.0-unofficial tool-gd32vflash-mac

    Type: mv tool-openocd-riscv-darwin_x86_64-0.9.20191123-unofficial tool-openocd-gd32v-mac

    See the package.json files how to rename these folders.

  • Start Visual Studio Code and open a PlatformIO Core Terminal.

  • Install the gd32v platform.
    Type: pio platform install file:///Users/<user>/repositories/platform-gd32v-mac-unofficial

    Note:
    To uninstall, type: pio platform uninstall gd32v-mac-unofficial

  • Create a PlatformIO projectc.
    Open a PlatformIO Core Terminal.
    Type: cd /Users/<user>/Documents/PlatformIO/Projects
    Type: mkdir myproject
    Type: pio init -d myproject -b sipeed-longan-nano --project-option "framework=gd32vf103-sdk" --project-option "upload_protocol=dfu"

    Output:
    Project has been successfully initialized!

    Note 1:
    If you want to use an Arduino framework, use: --project-option "framework=arduino"

    Note 2:
    Useful commands:
    `pio run` - process/build project from the current directory
    `pio run --target upload` or `pio run -t upload` - upload firmware to a target
    `pio run --target clean` - clean project (remove compiled files)
    `pio run --help` - additional information

  • In IDE, PlatformIO: Quick Access
    Select Project & Configuration
    Select Add Existing
    Select /Users/<user>/Documents/PlatformIO/Projects/myproject
    Restart IDE

  • Copy c en h files from examples to @@@

  • Install Extensions: @@@

  • Create package tool-gd32vflash-mac.
    • Create folder tool-gd32vflash-mac.
      Type: mkdir ~/tool-gd32vflash-mac

    • Goto https://sourceforge.net/projects/dfu-util/files/
      Download and unpack the latest version, in my case: dfu-util-0.11-binaries.tar.xz
      Copy the darwin-x86_64 files: dfu-prefix, dfu-suffix and dfu-util
      to folder ~/tool-gd32vflash-mac

      dfu-util binaries

    • Goto https://sourceforge.net/projects/stm32flash/files/
      Download and unpack the latest version, in my case: stm32flash-0.6-binaries.zip
      Rename file stm32flash_macosx to stm32flash and copy file stm32flash
      to folder ~/tool-gd32vflash-mac

      stm32flash binaries

    • Create package.json.
      @@@


  • Create package tool-openocd-gd32v-mac.

  • Goto https://github.com/riscv-mcu/riscv-gnu-toolchain
    Download and unpack: riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-apple-darwin.tar.gz (https://www.sifive.com/software)
    Copy content to folder /Users/<user>/.platformio/packages/toolchain-gd32v-mac

  • Blabla