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?