For the moment I’ve forget the idea of using the USB driver. Let me explain a little.
I’ve spent 4 or 5 days to try to compile this one. After having setup everything on Windows or Linux I always got this error:
_Other\usb-ser/src/cdc_acm_core.c:388: undefined reference to
usbd_ep_recev' c:/users/migou/.platformio/packages/toolchain-gd32v/bin/../lib/gcc/riscv-nuclei-elf/9.2.0/../../../../riscv-nuclei-elf/bin/ld.exe: .pio\build\sipeed-longan-nano\src\cdc_acm_core.o: in functioncdc_acm_data_send’:
c:_Other\usb-ser/src/cdc_acm_core.c:402: undefined reference to
usbd_ep_send' c:/users/migou/.platformio/packages/toolchain-gd32v/bin/../lib/gcc/riscv-nuclei-elf/9.2.0/../../../../riscv-nuclei-elf/bin/ld.exe: .pio\build\sipeed-longan-nano\src\app.o: in functionmain’:
c:_Other\usb-ser/src/app.c:70: undefined reference to `usbd_init’
It means all the source code was OK, it failed during the link.
While searching the error I’ve notice that during the compilation stage it even forgot to generate the .o file for the USB driver, despite all the includes referencing the .h file of the driver.
I’ve spent time on tuning the lib discover in PlatformIO, but again no result (http://docs.platformio.org/en/latest/librarymanager/ldf.html).
I was thinking founding a bug in Platformio or in the framework, so I’ve load the source code of the target GD32V to check how a new target is added in Platformio.
And after reading and understanding the build process I went on the file “fimware_libray.py” and this awful piece of code:
> # Target: Build Core Library
> libs = [
> join("$BUILD_DIR", "standard_peripheral"),
> join(FRAMEWORK_DIR, "GD32VF103_standard_peripheral")),
> # env.BuildLibrary(
> # join("$BUILD_DIR", "usbfs_driver"),
> # join(FRAMEWORK_DIR, "GD32VF103_usbfs_driver")),
> join("$BUILD_DIR", "RISCV"),
> join(FRAMEWORK_DIR, "RISCV")),
I was a little upset of this one It tells to the Platformio to NOT build the USB lib !!!
I’ve tried to uncomment it and it failed to compile. Then I understood why it was commented: nothing is building with this libs. And I didn’t found a tricks to achieve it by correcting the source code of the USB lib.
So I’ve drop it. And now I use the USART0, a shame regarding the ability of the module. But I need to achieve something with this board and not loose more time on a BETA framework (I know it’s a bad spirit of only complain, but I don’t have the knowledge in development to correct the driver, I’m not a developer).
So maybe on the next release of the framework or with the help of someone it could be usable. With the problem clearly spotted it’s now possible to go further.