Giter Club home page Giter Club logo

platform-gd32v's Introduction

GigaDevice GD32V: development platform for PlatformIO

Build Status

Usage

  1. Install PlatformIO
  2. Create PlatformIO project and configure a platform option in platformio.ini file:

Stable version

[env:stable]
platform = gd32v
board = ...
...

Development version

[env:development]
platform = https://github.com/sipeed/platform-gd32v.git
board = ...
...

Configuration

Please navigate to documentation.

platform-gd32v's People

Contributors

area-8051 avatar bitsk avatar ivankravets avatar jhaand avatar lynnl4 avatar mindshow avatar pcotret avatar themactep avatar thomaslamprecht avatar valeros avatar zepan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

platform-gd32v's Issues

dfu-util Error: 74 -- please update dfu-util

if i use the dfu-util included in your tools-dfuutil packages for uploads i get the well known error 74:

CURRENT: upload_protocol = dfu
Uploading .pio/build/sipeed-longan-nano/firmware.bin
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2020 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Opening DFU capable USB device...
ID 28e9:0189
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
DfuSe interface name: "Internal Flash  "
Found GD32VF103, which reports a bad page size and count for its internal memory.
Fixed layout based on part number: page size 1024, count 128.
Downloading to address = 0x08000000, size = 8264

Erase   	[                         ]   0%            0 bytes
Erase   	[======                   ]  24%         2048 bytes
Erase   	[============             ]  49%         4096 bytes
Erase   	[==================       ]  74%         6144 bytes
Erase   	[======================== ]  99%         8192 bytes
Download	[                         ]   0%            0 bytes
Download	[======                   ]  24%         2048 bytes
Download	[============             ]  49%         4096 bytes
Download	[==================       ]  74%         6144 bytes
Download	[======================== ]  99%         8192 bytes
Download	[=========================] 100%         8264 bytes
Download done.
File downloaded successfully
dfu-util: Error during download get_status
*** [upload] Error 74
=============================  [FAILED] Took 1.89 seconds ====================================

this well known error is already fixed in more recent upstream releases of dfu-util.

it would be very helpful, if you could replace the binaries in the tools-dfuutil by one of this fixed versions.

Support for macOS

Can you add support for macOS?
In the moment I get following error message with PlatformIO:
b9dcf80bf2dc64569495ae1b9e0f9ec8853a6562

Problem with building "Error: illegal operands `addi sp,sp,-20*(1<<2)-20*FPREGBYTES'"

Hello everyone! Firstly i hope this is right place to post my problem. If it's not please redirect me to another section. I'm trying to build a Cmake based project on target: Sipeed Longan Nano, which is GD32VF103CBT6 MCU with RISC-V 32-bit core of GigaDevice. During configuration process i faced a problem with "entry.S" file, which was connected to the toolchain. I thinks it's some startup code. This are Assembler messages:

Error: illegal operands addi sp,sp,-20*(1<<2)-20FPREGBYTES' Error: unrecognized opcode fpstore f0,(20(1<<2)+0FPREGBYTES)(sp)'
Error: unrecognized opcode fpstore f1,(20*(1<<2)+1FPREGBYTES)(sp)' Error: unrecognized opcode fpstore f2,(20(1<<2)+2FPREGBYTES)(sp)'
Error: unrecognized opcode fpload f0,(20
(1<<2)+0FPREGBYTES)(sp)' Error: unrecognized opcode fpload f1,(20(1<<2)+1FPREGBYTES)(sp)'

Arduino doesn't include "Serial" object

Trying to build a trivial Arduino project using the sipeed-longan-nano board that prints to Serial. Getting this result:

Processing sipeed-longan-nano (board: sipeed-longan-nano; platform: gd32v-mac-unofficial; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/gd32v-mac-unofficial/sipeed-longan-nano.html
PLATFORM: GigaDevice GD32V Platform with Toolchain for Mac OS (unoffical fork) 1.1.0 #5304539 > Sipeed Longan Nano
HARDWARE: GD32VF103CBT6 108MHz, 32KB RAM, 128KB Flash
DEBUG: Current (altera-usb-blaster) External (altera-usb-blaster, gd-link, jlink, rv-link, sipeed-rv-debugger, um232h)
PACKAGES:
 - framework-arduino-gd32v 0.1.1
 - toolchain-gd32v-mac 9.2.0
Converting Blink.ino
LDF: Library Dependency Finder -> http://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/sipeed-longan-nano/src/Blink.ino.cpp.o
Compiling .pio/build/sipeed-longan-nano/FrameworkArduino/GD32VF103_Firmware_Library/RISCV/env_Eclipse/handlers.c.o
Compiling .pio/build/sipeed-longan-nano/FrameworkArduino/GD32VF103_Firmware_Library/RISCV/env_Eclipse/init.c.o
Compiling .pio/build/sipeed-longan-nano/FrameworkArduino/GD32VF103_Firmware_Library/RISCV/env_Eclipse/start.S.o
Compiling .pio/build/sipeed-longan-nano/FrameworkArduino/GD32VF103_Firmware_Library/RISCV/env_Eclipse/your_printf.c.o
Compiling .pio/build/sipeed-longan-nano/FrameworkArduino/GD32VF103_Firmware_Library/RISCV/stubs/_exit.c.o
Compiling .pio/build/sipeed-longan-nano/FrameworkArduino/GD32VF103_Firmware_Library/RISCV/stubs/close.c.o
Compiling .pio/build/sipeed-longan-nano/FrameworkArduino/GD32VF103_Firmware_Library/RISCV/stubs/fstat.c.o
/Users/dean/.platformio/packages/framework-arduino-gd32v/cores/arduino/GD32VF103_Firmware_Library/RISCV/env_Eclipse/your_printf.c: In function '__wrap_printf':
/Users/dean/.platformio/packages/framework-arduino-gd32v/cores/arduino/GD32VF103_Firmware_Library/RISCV/env_Eclipse/your_printf.c:4:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
Compiling .pio/build/sipeed-longan-nano/FrameworkArduino/GD32VF103_Firmware_Library/RISCV/stubs/isatty.c.o
Compiling .pio/build/sipeed-longan-nano/FrameworkArduino/GD32VF103_Firmware_Library/RISCV/stubs/lseek.c.o
Compiling .pio/build/sipeed-longan-nano/FrameworkArduino/GD32VF103_Firmware_Library/RISCV/stubs/read.c.o
Compiling .pio/build/sipeed-longan-nano/FrameworkArduino/GD32VF103_Firmware_Library/RISCV/stubs/sbrk.c.o
Compiling .pio/build/sipeed-longan-nano/FrameworkArduino/GD32VF103_Firmware_Library/RISCV/stubs/write.c.o
Compiling .pio/build/sipeed-longan-nano/FrameworkArduino/GD32VF103_Firmware_Library/RISCV/stubs/write_hex.c.o
Compiling .pio/build/sipeed-longan-nano/FrameworkArduino/IPAddress.cpp.o
/Users/dean/src/blink/src/Blink.ino: In function 'void setup()':
/Users/dean/src/blink/src/Blink.ino:34:3: error: 'Serial' was not declared in this scope
   Serial.begin(115200);
   ^~~~~~
Compiling .pio/build/sipeed-longan-nano/FrameworkArduino/PluggableUSB.cpp.o
/Users/dean/src/blink/src/Blink.ino:34:3: note: suggested alternative: 'Server'
   Serial.begin(115200);
   ^~~~~~
   Server
/Users/dean/src/blink/src/Blink.ino: In function 'void loop()':
/Users/dean/src/blink/src/Blink.ino:39:3: error: 'Serial' was not declared in this scope
   Serial.println("blink on");
   ^~~~~~
/Users/dean/src/blink/src/Blink.ino:39:3: note: suggested alternative: 'Server'
   Serial.println("blink on");
   ^~~~~~
   Server
Compiling .pio/build/sipeed-longan-nano/FrameworkArduino/Print.cpp.o
Compiling .pio/build/sipeed-longan-nano/FrameworkArduino/Stream.cpp.o
Compiling .pio/build/sipeed-longan-nano/FrameworkArduino/WString.cpp.o
Compiling .pio/build/sipeed-longan-nano/FrameworkArduino/main.cpp.o
*** [.pio/build/sipeed-longan-nano/src/Blink.ino.cpp.o] Error 1
Compiling .pio/build/sipeed-longan-nano/FrameworkArduino/wiring.c.o```

OpenOCD source for gd32v

Since PlatformIO uses OpenOCD under the hood and downloads the binaries from http://dl.sipeed.com/LONGAN/platformio/dl-packages/ I wonder were the source code for these binaries is. Since OpenOCD is licensed under the GPL I would appreciate if Sipeed or Gigadevices released the source code for OpenOCD or - even better - merge it with the riscv-openocd repo.

Support Sipeed RV-Debugger Lite debug probe

Per user report from https://community.platformio.org/t/sipeed-rv-debugger-lite/19784.

The Lite version seems to be very close to the normal version listed at https://docs.platformio.org/en/latest/plus/debug-tools/sipeed-rv-debugger.html, but OpenOCD fails to pick up the adapter because of a USB device string constraint looking for Dual RS232, but the device reports something different.

A fix is to comment the line

#ftdi_device_desc "Dual RS232"

in the C:\Users\<user>\.platformio\packages\tool-openocd-gd32v\scripts\interface\ftdi\sipeed-rv-debugger.cfg file.

But I htink a new adapter variant, openocd cfg file and debug_tool = sipeed-rv-debugger-lite along with an update of tool-openocd-gd32v should be introduced to support the probe.

undefined reference usbd_***

The same code is working well with Eclipse, can't work with Platform IO?

I checked and it includes all the needed files, but it just didn't work under Platform IO.

Project:https://drive.google.com/file/d/1PBh_j7_V_jaYRxJ7P_ZWM_cE_keZ4Msz/view?usp=sharing

c:/users/taterli/.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\standard_hid_core.o: in function hid_deinit':
standard_hid_core.c:(.text.hid_deinit+0x8): undefined reference to usbd_ep_clear' c:/users/taterli/.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\standard_hid_core.o: in function hid_init':
standard_hid_core.c:(.text.hid_init+0xc): undefined reference to usbd_ep_setup' c:/users/taterli/.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\main.o: in function main':
main.c:(.text.startup.main+0x24): undefined reference to usbd_init' c:/users/taterli/.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\gd32vf103_it.o: in function USBFS_IRQHandler':
gd32vf103_it.c:(.text.USBFS_IRQHandler+0x8): undefined reference to usbd_isr' c:/users/taterli/.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\gd32vf103_it.o: in function USBFS_WKUP_IRQHandler':
gd32vf103_it.c:(.text.USBFS_WKUP_IRQHandler+0x2a): undefined reference to usb_clock_active'

Example programs don't run when using dfu download

I've been trying to get the example blink programs to run.
Since I don't have a debugger or serial port, I need to use dfu method for uploading.
So I only add upload_protocol = dfu to the platformio.ini

After I run the command below and press the reset button, nothing happens.
~/code/platform-gd32v/examples/longan-nano-blink$ platformio run --target upload
The command output shows that the download was successfull. (I do get the Error 74 from dfu-util, but it seems that doesn't matter. ) The same happens when I try the arduino-blink. See the output below.

When I attached the board the first time, the RGB LED demo was running. After downloading it stopped. So downloading should be successfull. Only the code that was uploaded doesn't seem to run correct.
I run Debian Linux 10.2 and I installed platformio using pip3. I checked that I have the original Longan Nano instead of the lite, as was the case with another issue.

breetai@thinktop2:~/code/platform-gd32v/examples/arduino-blink$ platformio run -e sipeed-longan-nano  --target upload
Processing sipeed-longan-nano (platform: gd32v; framework: arduino; board: sipeed-longan-nano)
--------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/gd32v/sipeed-longan-nano.html
PLATFORM: GigaDevice GD32V 1.1.2 > Sipeed Longan Nano
HARDWARE: GD32VF103CBT6 108MHz, 32KB RAM, 128KB Flash
DEBUG: Current (altera-usb-blaster) External (altera-usb-blaster, gd-link, jlink, rv-link, sipeed-rv-debugger, um232h)
PACKAGES: framework-arduino-gd32v 0.1.1, tool-openocd-gd32v 0.1.1, tool-gd32vflash 0.1.0, toolchain-gd32v 9.2.0
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Checking size .pio/build/sipeed-longan-nano/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
DATA:    [=         ]   7.2% (used 2358 bytes from 32768 bytes)
PROGRAM: [=         ]   6.3% (used 8250 bytes from 131072 bytes)
Configuring upload protocol...
AVAILABLE: altera-usb-blaster, dfu, gd-link, jlink, rv-link, serial, sipeed-rv-debugger, um232h
CURRENT: upload_protocol = dfu
Uploading .pio/build/sipeed-longan-nano/firmware.bin
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Opening DFU capable USB device...
ID 28e9:0189
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
GD32 flash memory access detected
Device model: GD32VF103CB
Memory segment (0x08000000 - 0801ffff)(rew)
Erase size 1024, page count 128
Downloading to address = 0x08000000, size = 8268

Download        [                         ]   0%            0 bytes
Download        [======                   ]  24%         2048 bytes
Download        [============             ]  49%         4096 bytes
Download        [==================       ]  74%         6144 bytes
Download        [======================== ]  99%         8192 bytes
Download        [=========================] 100%         8268 bytes
Download done.
File downloaded successfully
dfu-util: Error during download get_status
*** [upload] Error 74
====================================== [FAILED] Took 1.65 seconds ======================================

Environment         Status    Duration
------------------  --------  ------------
gd32vf103v-eval     IGNORED
sipeed-longan-nano  FAILED    00:00:01.652
================================ 1 failed, 0 succeeded in 00:00:01.652 ================================
breetai@thinktop2:~/code/platform-gd32v/examples/arduino-blink$ 

A few questions

Firstly, thank you so much for this dev/platform! 😊

  1. A lot of tracks to Kendryte, such as -> https://github.com/sipeed/platform-gd32v/tree/master/examples/longan-nano-blink

  2. gd32vf103_firmware_library - what is it? Is this SDK? Can we get a better name for it? If it is a library, we can omit the framework field in platformio.ini and submit this library to PlatformIO Registry. Later, developers can use it with lib_deps = gd32vf103.....

  3. Could you remove custom init_cmds from board manifests for debug section? The default should work as well. Could you test this?

  4. Can you add me to collaborators list for this repository? We would like to add this dev/platform to a public registry.

cannot upload over usb-c to sipeed-longan-nano from linux

Hi there,

I cannot upload to my nano. I'm running arch and have it connected via usb-c. In dmesg I see:

[15912.862725] usb 1-3: new full-speed USB device number 8 using xhci_hcd
[15913.193941] usb 1-3: device descriptor read/64, error -71
[15913.442442] usb 1-3: New USB device found, idVendor=28e9, idProduct=0189, bcdDevice=10.00
[15913.442448] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[15913.442452] usb 1-3: Product: GD32 0x418 DFU Bootloade
[15913.442455] usb 1-3: Manufacturer: GDMicroelectronics
[15913.442457] usb 1-3: SerialNumber: 䌳䩂

I'm worried about the second line above.

this is the output when trying to upload the blink example after deleting my ~/.platformio:

[levi@arch-x1c longan-nano-blink]$ platformio run -e sipeed-longan-nano --target upload  
*******************************************************************************
If you like PlatformIO, please:
- follow us on Twitter to stay up-to-date on the latest project news > https://twitter.com/PlatformIO_Org
- star it on GitHub > https://github.com/platformio/platformio
- try PlatformIO IDE for IoT development > https://platformio.org/platformio-ide
- support us with PlatformIO Plus > https://pioplus.com
*******************************************************************************

Processing sipeed-longan-nano (platform: gd32v; framework: gd32vf103-sdk; board: sipeed-longan-nano)
-------------------------------------------------------------------------------
PlatformManager: Installing gd32v
gd32v @ 1.1.0 has been successfully installed!
The platform 'gd32v' has been successfully installed!
The rest of packages will be installed automatically depending on your build environment.
PackageManager: Installing framework-gd32vf103-sdk @ ~1.0.0
framework-gd32vf103-sdk @ 1.0.0 has been successfully installed!
PackageManager: Installing tool-openocd-gd32v @ ~0.1.1
tool-openocd-gd32v @ 0.1.1 has been successfully installed!
PackageManager: Installing tool-gd32vflash @ ~0.1.0
tool-gd32vflash @ 0.1.0 has been successfully installed!
PackageManager: Installing toolchain-gd32v @ ~9.2.0
Downloading  [####################################]  100%          ^_
Unpacking  [####################################]  100%          
toolchain-gd32v @ 9.2.0 has been successfully installed!
CorePackageManager: Installing tool-scons @ ~3.30101.0
tool-scons @ 3.30101.0 has been successfully installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/gd32v/sipeed-longan-nano.html
PLATFORM: GigaDevice GD32V 1.1.0 > Sipeed Longan Nano
HARDWARE: GD32VF103CBT6 108MHz, 32KB RAM, 128KB 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-openocd-gd32v 0.1.1, tool-gd32vflash 0.1.0, toolchain-gd32v 9.2.0
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Linking .pio/build/sipeed-longan-nano/firmware.elf
Checking size .pio/build/sipeed-longan-nano/firmware.elf
Memory Usage -> http://bit.ly/pio-memory-usage
DATA:    [=         ]   7.0% (used 2310 bytes from 32768 bytes)
PROGRAM: [=         ]   5.0% (used 6572 bytes from 131072 bytes)
Configuring upload protocol...
AVAILABLE: altera-usb-blaster, gd-link, jlink, rv-link, serial, sipeed-rv-debugger, um232h
CURRENT: upload_protocol = serial
Looking for upload port...
Error: Please specify `upload_port` for environment or use global `--upload-port` option.
For some development platforms it can be a USB flash drive (i.e. /media/<user>/<device name>)
*** [upload] Explicit exit, status 1
===================================================================================================== [FAILED] Took 23.48 seconds =====================================================================================================
[levi@arch-x1c longan-nano-blink]$ 

I'm not sure if I'm supposed to see something in /dev/ttyUSB.... but I don't see any device there. lsusb shows:

Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 06cb:00bd Synaptics, Inc. 
Bus 001 Device 002: ID 5986:114e Acer, Inc Integrated Camera
Bus 001 Device 008: ID 28e9:0189 GDMicroelectronics GD32 0x418 DFU Bootloade
Bus 001 Device 004: ID 8087:0aaa Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Not sure what I'm missing.

Update:

Also tried on my desktop running ubuntu 18.04 - Basically the same stuff. Read error in dmesg, lsusb shows device in list but no ttyUSB entry.

Three color LED flashing

I tried to modify the program of "Longan nano BLINK" so that the three-color LED lights on the board light up in turn.
But I found that when I operate the red, green and blue lights individually, they are all normal. When I operate in turn, the blue or green lights will always be on.

`
#include "gd32vf103.h"
#include "systick.h"
#include <stdio.h>

/* BUILTIN LED OF LONGAN BOARDS IS PIN PC13 */
#define LED_PIN GPIO_PIN_13
#define LED_PIN1 GPIO_PIN_1
#define LED_PIN2 GPIO_PIN_2

#define LED_GPIO_PORT GPIOC
#define LED_GPIO_PORTA GPIOA

#define LED_GPIO_CLK RCU_GPIOC
#define LED_GPIO_CLK_A RCU_GPIOA

void longan_led_init()
{
/* enable the led clock */
rcu_periph_clock_enable(LED_GPIO_CLK);
rcu_periph_clock_enable(LED_GPIO_CLK_A);

/* configure led GPIO port */ 
gpio_init(LED_GPIO_PORT,  GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ, LED_PIN);
gpio_init(LED_GPIO_PORTA, GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ, LED_PIN1);
gpio_init(LED_GPIO_PORTA, GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ, LED_PIN2);

/* Clear led GPIO pin */ 
GPIO_BC(LED_GPIO_PORT) =  LED_PIN;
GPIO_BC(LED_GPIO_PORTA) = LED_PIN1;
GPIO_BC(LED_GPIO_PORTA) = LED_PIN2;

}

void longan_led_on_R()
{
GPIO_BOP(LED_GPIO_PORT) = LED_PIN;
}

void longan_led_on_G()
{
GPIO_BOP(LED_GPIO_PORTA) = LED_PIN1;
}

void longan_led_on_B()
{
GPIO_BOP(LED_GPIO_PORTA) = LED_PIN2;
}

void longan_led_off_R()
{
GPIO_BC(LED_GPIO_PORT) = LED_PIN;
}
void longan_led_off_G()
{
GPIO_BC(LED_GPIO_PORTA) = LED_PIN1;
}
void longan_led_off_B()
{
GPIO_BC(LED_GPIO_PORTA) = LED_PIN2;
}

/*!
\brief main function
\param[in] none
\param[out] none
\retval none
*/
int main(void)
{
longan_led_init();

while(1){

//RED
/* turn on builtin led /
longan_led_on_R();
delay_1ms(1000);
/
turn off uiltin led */
longan_led_off_R();
delay_1ms(1000);

// Green
longan_led_on_G();
delay_1ms(1000);

    longan_led_off_G();
    delay_1ms(1000);

//Blue
longan_led_on_B();
delay_1ms(1000);

    longan_led_off_B();
    delay_1ms(1000);

}

}`

Platformio can't install platform

Hello,

I have tried to install the platformio platform but I can't.

This is the error I get:

Tool Manager: Installing platformio/toolchain-gd32v @ ~9.2.0
Error: You do not have permission for this request

gd32v v1.1.1 breaks RV-LINK debugging

Today the PlatformIO IDE prompted me to update the gd32v platform to v1.1.1. After installing this update debugging a Longan Nano via RV-LINK is no longer possible. This worked fine with gd32v v1.1.0.

When I try to debug a Longan Nano via RV-LINK the following error message pops up:

gd32v-debug-error

The debug console output is this:

Processing sipeed-longan-nano (platform: gd32v; board: sipeed-longan-nano; framework: arduino)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/gd32v/sipeed-longan-nano.html
PLATFORM: GigaDevice GD32V 1.1.1 > Sipeed Longan Nano
HARDWARE: GD32VF103CBT6 108MHz, 32KB RAM, 128KB Flash
DEBUG: Current (rv-link) External (altera-usb-blaster, gd-link, jlink, rv-link, sipeed-rv-debugger, um232h)
PACKAGES:
 - framework-arduino-gd32v 0.1.1
 - toolchain-gd32v 9.2.0
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 4 compatible libraries
Scanning dependencies...
No dependencies
Building in debug mode
Checking size .pio\build\sipeed-longan-nano\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   8.7% (used 2837 bytes from 32768 bytes)
Flash: [=====     ]  52.5% (used 68852 bytes from 131072 bytes)
========================= [SUCCESS] Took 1.16 seconds =========================
Reading symbols from e:\Users\stm\Documents\GitHub\longannano\longan-nano-experiments\rfid-spi\.pio\build\sipeed-longan-nano\firmware.elf...
undefinedC:\.platformio\packages\toolchain-gd32v\bin\riscv-nuclei-elf-gdb.exe: warning: Couldn't determine a path for the index cache directory.
PlatformIO Unified Debugger -> http://bit.ly/pio-debug
PlatformIO: debug_tool = rv-link
PlatformIO: Initializing remote target...
0x080059c8 in LCD_ShowChar (x=<optimized out>, x@entry=16, y=<optimized out>, y@entry=48, num=18 '\022', mode=mode@entry=0 '\000', color=color@entry=65535) at src\lcd\lcd.c:545
545					x++;
RV-LINK v0.2: Longan Nano, configed for GD32VF103 family.
:( unsupported monitor command!
A program is being debugged already.  Kill it? (y or n) [answered Y; input not from terminal]
.pioinit:21: Error in sourced command file:
Unknown remote qXfer reply: OK

This is my platformio.ini file:

[env:sipeed-longan-nano]
platform = gd32v
board = sipeed-longan-nano
framework = arduino
platform_packages = framework-arduino-gd32v @ file://e:/Users/stm/Documents/GitHub/Longduino
upload_protocol = rv-link
debug_tool = rv-link
build_type = debug
debug_port = COM5

Workaround: Force downgrade of platform gd32v to v1.1.0 which corresponds to commit 2e95e83:

platform = https://github.com/sipeed/platform-gd32v.git#2e95e8300025123af69e70ea7c700e3f8b3013c7

Doesn't show external crystal clock's status in RCU_CTL register.

Hi team,
I a'm very excited regarding the risc v architecture and would like to work with this future technology. Before a week, i started learning risc v architecture with help of a low cost development board. I have given by some basic details here to get you an idea about my working environment.
Gd32 dev board with lcd (seed studio)
Rv debugger(sipeed )
Platform io

The example led code is working fine. I would like to turn on external clock. That's why i read gd32 's reference manual and got regarding the RCU_CTL register. Then i have written a demo code.

Code

#include "gd32vf103.h"

Int main()
{
RCU_CTL|=(1<<16);// external Crystal turn on
While(RCU_CTL & (1<<17) != 0x00020000);// checking the external crystal turn on successful.

RCU_CTL|=(1<<16);// external Crystal turn off
While(RCU_CTL & (1<<17) == 0x00020000);// checking the external crystal turn off successful

return 0;
}

Here turn on working fine. But when code enter turn off checki it's not exit. So the status of external clock is enable.

Such as when i was searching this one i saw "system init" function definition inside of one of the gd32 firmware library file. It's enable internal oscillator like
RCU_CTL|=0x1;
Then it's not checking the status of oscillator with bit number 2.

So the RCU_CTL register showing bit number 2 for internal oscillator status and bit number 17 for external oscillator status.

All of you if you hqve any idea about this region pls help me. I'm still stucking?
.
If you have the gd32 related board could you pls check it for me?

Download and no effect!

Having bought a Sipeed Longan Nano RISC-V GD32VF103CBT6 MCU Development Board, I have installed Visual Studio Code with platformio add-on. Drivers GD32 MCU Dfu Drivers_v1.0.1.2316 for Windows 10. Then loaded "arduino-blink", compiled (one button Build), with no issues. Mention here platformio.ini lines:
[env:sipeed-longan-nano]
platform = gd32v
framework = arduino
board = sipeed-longan-nano
monitor_speed = 115200
upload_protocol = dfu

The board was set in burning mode: the Device Manager shows in USB devices: GD32 Device in DFU mode. Download, with messages:
Opening DFU capable USB device...
ID 28e9:0189
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuERROR, status = 10
dfuERROR, clearing status
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
GD32 flash memory access detected
Device model: GD32VF103C8
Memory segment (0x08000000 - 0800ffff)(rew)
Erase size 1024, page count 64
Downloading to address = 0x08000000, size = 8268
Download [ ] 0% 0 bytes
Download [====== ] 24% 2048 bytes
Download [============ ] 49% 4096 bytes
Download [================== ] 74% 6144 bytes
Download [======================== ] 99% 8192 bytes
Download [=========================] 100% 8268 bytes
Download done.
File downloaded successfully
Transitioning to dfuMANIFEST state

Now comes the question: After Reset, NO sign of blink (the factory 4 colors blink went off). Moreover the display went dark.
Being the first time I try to use this board, I would appreciate a suggestion to make work the first code!

JTAG upload fails

Using either sipeed-rv-debugger or jlink (J-Link EDU Mini in my case) as upload_protocol, it fails with the following log on a Sipeed Longan Nano:

Open On-Chip Debugger 0.10.0+dev-00911-gcfbca74bd (2019-09-12-09:31)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Warn : Transport "jtag" was already selected
jtag
adapter speed: 1000 kHz

Info : clock speed 1000 kHz
Info : JTAG tap: riscv.cpu tap/device found: 0x1000563d (mfg: 0x31e (Andes Technology Corporation), part: 0x0005, ver: 0x1)
Warn : JTAG tap: riscv.cpu       UNEXPECTED: 0x1000563d (mfg: 0x31e (Andes Technology Corporation), part: 0x0005, ver: 0x1)
Error: JTAG tap: riscv.cpu  expected 1 of 1: 0x1e200a6d (mfg: 0x536 (Nuclei System Technology Co.,Ltd.), part: 0xe200, ver: 0x1)
Info : JTAG tap: auto0.tap tap/device found: 0x790007a3 (mfg: 0x3d1 (GigaDevice Semiconductor (Beijing)), part: 0x9000, ver: 0x7)
Error: Trying to use configured scan chain anyway...
Warn : AUTO auto0.tap - use "jtag newtap auto0 tap -irlen 5 -expected-id 0x790007a3"
Warn : Bypassing JTAG setup events due to errors
Info : datacount=4 progbufsize=2
Info : Exposing additional CSR 3040
Info : Exposing additional CSR 3041
Info : Exposing additional CSR 3042
Info : Exposing additional CSR 3043
Info : Exposing additional CSR 3044
Info : Exposing additional CSR 3045
Info : Exposing additional CSR 3046
Info : Exposing additional CSR 3047
Info : Exposing additional CSR 3048
Info : Exposing additional CSR 3049
Info : Exposing additional CSR 3050
Info : Exposing additional CSR 3051
Info : Exposing additional CSR 3052
Info : Exposing additional CSR 3053
Info : Exposing additional CSR 3054
Info : Exposing additional CSR 3055
Info : Exposing additional CSR 3056
Info : Exposing additional CSR 3057
Info : Exposing additional CSR 3058
Info : Exposing additional CSR 3059
Info : Exposing additional CSR 3060
Info : Exposing additional CSR 3061
Info : Exposing additional CSR 3062
Info : Exposing additional CSR 3063
Info : Exposing additional CSR 3064
Info : Exposing additional CSR 3065
Info : Exposing additional CSR 3066
Info : Exposing additional CSR 3067
Info : Exposing additional CSR 3068
Info : Exposing additional CSR 3069
Info : Exposing additional CSR 3070
Info : Exposing additional CSR 3071
Info : Examined RISC-V core; found 1 harts
Info :  hart 0: XLEN=32, misa=0x40901105
Info : Listening on port 3333 for gdb connections
Info : device id = 0x19060410
Info : flash_size_in_kb = 0x00000080
Info : flash size = 128kbytes
Info : JTAG tap: riscv.cpu tap/device found: 0x1000563d (mfg: 0x31e (Andes Technology Corporation), part: 0x0005, ver: 0x1)
Warn : JTAG tap: riscv.cpu       UNEXPECTED: 0x1000563d (mfg: 0x31e (Andes Technology Corporation), part: 0x0005, ver: 0x1)
Error: JTAG tap: riscv.cpu  expected 1 of 1: 0x1e200a6d (mfg: 0x536 (Nuclei System Technology Co.,Ltd.), part: 0xe200, ver: 0x1)
Info : JTAG tap: auto0.tap tap/device found: 0x790007a3 (mfg: 0x3d1 (GigaDevice Semiconductor (Beijing)), part: 0x9000, ver: 0x7)
Error: Trying to use configured scan chain anyway...
Warn : Bypassing JTAG setup events due to errors
** Programming Started **
** Programming Finished **
** Verify Started **
** Verified OK **
Info : Hart 0 unexpectedly reset!

*** [upload] Error 1

I tried both with RST pin connected or disconnected and it still fails the same way.

UnknownPackageError triggered on Ubuntu 16 i686

Hi.
Would you be up to start supporting i686?

I have this https://github.com/platformio/platformio-core/blob/6e5198f3739f536935916f700bd09a9f96ad0278/platformio/package/exception.py#L55 error fired, on Ubuntu 16 👍

$ python3 -m platformio run
Processing sipeed-longan-nano (framework: gd32vf103-sdk; platform: https://github.com/sipeed/platform-gd32v.git)

Tool Manager: Installing platformio/toolchain-gd32v @ ~9.2.0
Error: Could not find the package with 'platformio/toolchain-gd32v @ ~9.2.0' requirements for your system 'linux_i686'

I have

$ python3 --version
Python 3.5.2
here (I could upgrade to a modern version, if required).

$ uname -a
Linux bibip 4.15.0-122-generic #124~16.04.1-Ubuntu SMP Thu Oct 15 16:14:02 UTC 2020 i686 i686 i686 GNU/Linux

Uploading with Sipeed RV-Debugger Plus gets stuck

I am trying to upload firmware for Longan Nano v1.1 using RV-Debugger Plus. I connected TCK, TDI, TDO, TMS, 3V3, GND, T0, and R0 lines between them and the debugger is connected to my computer via a USB C-to-A cable. The project configuration is as follows:

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter, extra scripting
;   Upload options: custom port, speed and extra flags
;   Library options: dependencies, extra library storages
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:sipeed-longan-nano]
platform = gd32v
framework = gd32vf103-sdk
board = sipeed-longan-nano
monitor_speed = 115200

upload_protocol = sipeed-rv-debugger

Since the default OpenOCD configuration for RV-Debugger finds a device named Dual RS232 and the actual USB device name is JTAG Debugger, I modified sipeed-rv-debugger.cfg in .platformio/packages/tool-openocd-gd32v/share/openocd/scripts/interface/ftdi as follows:

interface ftdi
#ftdi_device_desc "Dual RS232"
ftdi_device_desc "JTAG Debugger"
ftdi_vid_pid 0x0403 0x6010

#autoexit true

#interface cmsis-dap
transport select jtag
ftdi_layout_init 0x0008 0x001b
ftdi_layout_signal nSRST -oe 0x0020 -data 0x0020

With these setups, uploading longan-nano-blink example prints the following output and gets stuck:

Processing sipeed-longan-nano (platform: gd32v; framework: gd32vf103-sdk; board: sipeed-longan-nano)
-------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/gd32v/sipeed-longan-nano.html
PLATFORM: GigaDevice GD32V (1.3.0) > Sipeed Longan Nano
HARDWARE: GD32VF103CBT6 108MHz, 32KB RAM, 128KB 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 
 - tool-gd32vflash @ 0.1.0 
 - tool-openocd-gd32v @ 0.1.1 
 - 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
Checking size .pio/build/sipeed-longan-nano/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   7.0% (used 2310 bytes from 32768 bytes)
Flash: [=         ]   5.0% (used 6572 bytes from 131072 bytes)
Configuring upload protocol...
AVAILABLE: altera-usb-blaster, gd-link, jlink, rv-link, serial, sipeed-rv-debugger, um232h
CURRENT: upload_protocol = sipeed-rv-debugger
Uploading .pio/build/sipeed-longan-nano/firmware.elf
Open On-Chip Debugger 0.10.0+dev-00911-gcfbca74bd (2019-09-12-09:31)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Warn : Transport "jtag" was already selected
jtag
adapter speed: 1000 kHz

Info : clock speed 1000 kHz
Info : JTAG tap: riscv.cpu tap/device found: 0x1000563d (mfg: 0x31e (Andes Technology Corporation), part: 0x0005, ver: 0x1)
Warn : JTAG tap: riscv.cpu       UNEXPECTED: 0x1000563d (mfg: 0x31e (Andes Technology Corporation), part: 0x0005, ver: 0x1)
Error: JTAG tap: riscv.cpu  expected 1 of 1: 0x1e200a6d (mfg: 0x536 (Nuclei System Technology Co.,Ltd.), part: 0xe200, ver: 0x1)
Info : JTAG tap: auto0.tap tap/device found: 0x790007a3 (mfg: 0x3d1 (GigaDevice Semiconductor (Beijing)), part: 0x9000, ver: 0x7)
Error: Trying to use configured scan chain anyway...
Warn : AUTO auto0.tap - use "jtag newtap auto0 tap -irlen 5 -expected-id 0x790007a3"
Warn : Bypassing JTAG setup events due to errors
Info : datacount=4 progbufsize=2
Info : Exposing additional CSR 3040
Info : Exposing additional CSR 3041
Info : Exposing additional CSR 3042
Info : Exposing additional CSR 3043
Info : Exposing additional CSR 3044
Info : Exposing additional CSR 3045
Info : Exposing additional CSR 3046
Info : Exposing additional CSR 3047
Info : Exposing additional CSR 3048
Info : Exposing additional CSR 3049
Info : Exposing additional CSR 3050
Info : Exposing additional CSR 3051
Info : Exposing additional CSR 3052
Info : Exposing additional CSR 3053
Info : Exposing additional CSR 3054
Info : Exposing additional CSR 3055
Info : Exposing additional CSR 3056
Info : Exposing additional CSR 3057
Info : Exposing additional CSR 3058
Info : Exposing additional CSR 3059
Info : Exposing additional CSR 3060
Info : Exposing additional CSR 3061
Info : Exposing additional CSR 3062
Info : Exposing additional CSR 3063
Info : Exposing additional CSR 3064
Info : Exposing additional CSR 3065
Info : Exposing additional CSR 3066
Info : Exposing additional CSR 3067
Info : Exposing additional CSR 3068
Info : Exposing additional CSR 3069
Info : Exposing additional CSR 3070
Info : Exposing additional CSR 3071
Info : Examined RISC-V core; found 1 harts
Info :  hart 0: XLEN=32, misa=0x40901105
Info : Listening on port 3333 for gdb connections
Info : device id = 0x19060410
Info : flash_size_in_kb = 0x0000f000
Info : flash size = 61440kbytes
Info : Device Security Bit Set

Environment

  • OS: Manjaro Linux
  • DE: KDE Plasma (see below)
Operating System: Manjaro Linux 
KDE Plasma Version: 5.27.1
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 6.0.19-4-MANJARO (64-bit)
Graphics Platform: X11
Processors: 12 × AMD Ryzen 5 3600 6-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 1080/PCIe/SSE2
  • Editor: VS Code

tool-dfuutil not auto-installed

There's a report of getting a

sh: 1: bin/dfu-suffix: not found

message during upload, which is because the ~/.platformio/packages/tool-dfuutil package was never installed: report. That could only be manually fixed by downloading the package from the bintray.

I think the platform is missing some code to mark tool-dfuutil package as required / not optional when using upload_protocol = dfu? As in

https://github.com/platformio/platform-ststm32/blob/a05ae97d25336fd20f8774a01590b0c91d498518/platform.py#L43-L44

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.