Framework-gd32vf103-sdk is not supported by creators

I found an issue gd32vf103.h header cannot be used from C++ module · Issue #1 · riscv-mcu/GD32VF103_Firmware_Library · GitHub is still relevant with framework-gd32vf103-sdk.

Steps to repeat:

git clone https://github.com/MuellerA/LonganNanoTest
cd LonganNanoTest/Usart
pio run

Output:

Processing longan-nano-lite (platform: gd32v; board: sipeed-longan-nano-lite; framework: gd32vf103-sdk)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/gd32v/sipeed-longan-nano-lite.html
PLATFORM: GigaDevice GD32V (1.3.0) > Sipeed Longan Nano Lite
HARDWARE: GD32VF103C8T6 108MHz, 20KB RAM, 64KB Flash
DEBUG: Current (altera-usb-blaster) External (altera-usb-blaster, gd-link, jlink, rv-link, sipeed-rv-debugger, um232h)
PACKAGES: 
 - framework-gd32vf103-sdk @ 1.0.0 
 - tool-dfuutil @ 1.9.200310 
 - toolchain-gd32v @ 9.2.0
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/longan-nano-lite/src/main.o
Compiling .pio/build/longan-nano-lite/src/usart.o
Compiling .pio/build/longan-nano-lite/standard_peripheral/Source/gd32vf103_adc.o
Compiling .pio/build/longan-nano-lite/standard_peripheral/Source/gd32vf103_bkp.o
In file included from src/usart.cpp:7:
/home/user/.platformio/packages/framework-gd32vf103-sdk/GD32VF103_standard_peripheral/gd32vf103.h:179:41: error: redeclaration of C++ built-in type 'bool' [-fpermissive]
  179 | typedef enum {FALSE = 0, TRUE = !FALSE} bool;
      |                                         ^~~~
Compiling .pio/build/longan-nano-lite/standard_peripheral/Source/gd32vf103_can.o
Compiling .pio/build/longan-nano-lite/standard_peripheral/Source/gd32vf103_crc.o
In file included from src/main.cpp:7:
/home/user/.platformio/packages/framework-gd32vf103-sdk/GD32VF103_standard_peripheral/gd32vf103.h:179:41: error: redeclaration of C++ built-in type 'bool' [-fpermissive]
  179 | typedef enum {FALSE = 0, TRUE = !FALSE} bool;
      |                                         ^~~~
Compiling .pio/build/longan-nano-lite/standard_peripheral/Source/gd32vf103_dac.o
*** [.pio/build/longan-nano-lite/src/usart.o] Error 1
Compiling .pio/build/longan-nano-lite/standard_peripheral/Source/gd32vf103_dbg.o
*** [.pio/build/longan-nano-lite/src/main.o] Error 1
===================================================================== [FAILED] Took 0.64 seconds =====================================================================

Commenting out the line 179 in ~/.platformio/packages/framework-gd32vf103-sdk/GD32VF103_standard_peripheral/gd32vf103.h fixes the error.

I see no fixed issues in Issues · riscv-mcu/GD32VF103_Firmware_Library · GitHub since 2019.
I can’t find any popular fork to recommend to use it for framework-gd32vf103-sdk.

Questions:

  • Any idea how to fix the code for PlatformIO end user, so that no one should apply fix manually every time?
  • Can we apply patches for framework-gd32vf103-sdk?

Surprise: gd32vf103.h header cannot be used from C++ module · Issue #1 · riscv-mcu/GD32VF103_Firmware_Library · GitHub was closed today!

 % pio pkg install --tool https://github.com/riscv-mcu/GD32VF103_Firmware_Library.git
Resolving longan-nano-lite dependencies...
Tool Manager: Installing git+https://github.com/riscv-mcu/GD32VF103_Firmware_Library.git
git version 2.25.1
Cloning into '/home/user/.platformio/.cache/tmp/pkg-installing-m13_w4qs'...
…
Resolving deltas: 100% (343/343), done.
Error: Could not find one of 'package.json' manifest files in the package

How can I have these changes locally?
Should I ask the repository owners to create tags with versions?

You wouldn’t do it via pio pkg install, you would give your project a platform_packages line in which you point to the fixed SDK.

The package name for it is

So just fork the now main repo and add a package.json to it with

{
  "name": "framework-gd32vf103-sdk",
  "version": "1.0.1",
  "description": "GigaDevice GD32VF103 Firmware Library",
  "keywords": [
    "framework",
    "sdk",
    "risc-v",
    "gigadevice"
  ],
  "homepage": "https://www.riscv-mcu.com/",
  "repository": {
    "type": "git",
    "url": "https://github.com/riscv-mcu/GD32VF103_Firmware_Library"
  }
}

Then say

platform_packages =
  framework-gd32vf103-sdk@<Git link for your fork>

in the platformio.ini.

1 Like

This is now also tracked in

1 Like