riscv-rust / longan-nano

Board support package for the Longan Nano board
https://www.seeedstudio.com/Sipeed-Longan-Nano-RISC-V-GD32VF103CBT6-Development-Board-p-4205.html
117 stars 30 forks source link

examples just do nothing (hang/black) on longan nano lite #20

Closed hansfbaier closed 3 years ago

hansfbaier commented 3 years ago

Hi, I use the lite version, and my .cargo/config looks like this:

[target.riscv32imac-unknown-none-elf]
runner = 'riscv64-unknown-elf-gdb -x openocd.gdb'
rustflags = [
  "-C", "link-arg=-Tmemory-c8.x",
  "-C", "link-arg=-Tlink.x",
  "-C", "target-cpu=generic-rv32"
]

[build]
target = "riscv32imac-unknown-none-elf"

The c8 should be the correct model for the lite. But when I upload the .bin files I created with objcopy

riscv64-unknown-elf-objcopy -O binary target/riscv32imac-unknown-none-elf/release/examples/blinky blinky.bin

and uploaded

$ dfu-util -a 0 -s 0x08000000 -D blinky.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/

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
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
DfuSe interface name: "Internal Flash  "
Downloading to address = 0x08000000, size = 8976
Download    [=========================] 100%         8976 bytes
Download done.
File downloaded successfully

After that the target just does nothing (hang?). No blinking LED. Same symptoms with the display example. On platformio I had those symptoms when using the longan-nano configuration instead of the longan-nano-lite. But here already the right chip is selected. What else could I try? How could I diagnose the issue?

Disasm commented 3 years ago

I think you have a non-compatible version of dfu-util. Check this readme section for details: https://github.com/riscv-rust/longan-nano#using-dfu-util-for-flashing

hansfbaier commented 3 years ago

Yay! That worked! Thank you so much!