Skip to content

Instantly share code, notes, and snippets.

@BjoernSchilberg
Last active November 7, 2023 15:38
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BjoernSchilberg/2547f9dfa749b89ed53d2dafafc589ec to your computer and use it in GitHub Desktop.
Save BjoernSchilberg/2547f9dfa749b89ed53d2dafafc589ec to your computer and use it in GitHub Desktop.
Sipeed Longan Nano - RISC-V GD32VF103CBT6 Development Board

gd32v

Installation PlatformIO Core (CLI)

https://docs.platformio.org/en/latest/installation.html

Develop in Visual Studio Code

https://platformio.org/install/ide?install=vscode https://docs.platformio.org/en/latest/ide/vscode.html#quick-start

Access rights

https://bbs.sipeed.com/t/topic/1338/12

sudo dfu-util -l
sudo strace -e trace=openat dfu-util -l

sudo chown $USER /dev/bus/usb/001/008
platformio run --target upload

udev

https://docs.platformio.org/en/latest/faq.html#platformio-udev-rules

Add in /etc/udev/rules.d/99-platformio-udev.rules.

# Longan Nano
ATTRS{idVendor}=="28e9", ATTRS{idProduct}=="0189", MODE="0666"
sudo service udev restart

RISC-V GNU toolchain

http://dl.sipeed.com/LONGAN/platformio/dl-packages/toolchain-gd32v-v9.2.0-linux.tar.gz

dfu-util (Sipeed version)

But dfu-util in debian still works!

http://dl.sipeed.com/LONGAN/platformio/dl-packages/tool-gd32vflash-v0.1.0-linux.tar.gz

Examples

https://github.com/riscv-mcu/GD32VF103_Firmware_Library/tree/master/Examples

Bad Apple

Convert a logo

convert -resize 160x80\! intevation-logo-150ppi-nontrans.png logo.bmp
python3 bmp2hex.py -kbin logo.bmp
mv bmp.bin logo.bin

Convert a video

Convert mp4 video to 24 bit BMP frames.

The format must be BMP, the size is set according to the size of the screen, the time I set here is 100ms, that is, 1s ten frames, the number of acquisitions will calculate the total video time and multiply the number of frames per second. I am here 219s * 10 = 2190 3-4 min. ca. 50 MB

Using ffmpeg

https://www.bugcodemaster.com/article/extract-images-frame-frame-video-file-using-ffmpeg

ffmpeg -i <input> -vf fps=1/10 -pix_fmt bgr24  output%03d.bmp -hide_banner

Select key frames.

ffmpeg -i <input> -vf "select=eq(pict_type\,I)" -vsync vfr -pix_fmt bgr24  %03d.bmp -hide_banner

combine key frame filter with scaling

ffmpeg -i 02_gran_dillama_1080p.mp4 -vf "select=eq(pict_type\,I)",scale=160:80 -vsync vfr -pix_fmt bgr24  %03d.bmp -hide_banner
ffmpeg -i 02_gran_dillama_1080p.mp4 -vf "select=eq(pict_type\,I)",scale=160:80 -vsync vfr -pix_fmt bgr24  %d.bmp -hide_banner

Convert bitmap files to hex.

python3 genhex.py

Docs dump

Links dump

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment