Open gkelly opened 5 years ago
Looks like there is an open issue with riscv-openocd. https://github.com/riscv/riscv-openocd/issues/195
Has this board programmed successfully in the past?
In the past, I was able to get fresh boards to program by manually pressing the reset just before running the openocd command but it took a few tries some times.
I have the exact same problem, I ordered two boards from Digi-Key and really wanted to work with them the weekend, but if I cannot load a program that is going to be quite difficult.
I am using the following versions: Open On-Chip Debugger 0.10.0+dev-00822-g0409bf9b2 (2019-10-18-23:08) GNU gdb (SiFive GDB 8.3.0-2019.08.0) 8.3
Both the latest from the SiFive website.
Pressing reset just before running the openocd command did not help.
I have the exact same problem, I ordered two boards from Digi-Key and really wanted to work with them the weekend, but if I cannot load a program that is going to be quite difficult.
I am using the following versions: Open On-Chip Debugger 0.10.0+dev-00822-g0409bf9b2 (2019-10-18-23:08) GNU gdb (SiFive GDB 8.3.0-2019.08.0) 8.3
Both the latest from the SiFive website.
Pressing reset just before running the openocd command did not help.
Mine is also from Digi-Key. @mwelling which versions of the toolchain bundles are you using?
Looks like there is an open issue with riscv-openocd. riscv/riscv-openocd#195
Has this board programmed successfully in the past?
Sorry, forgot to respond to this part. No, this is my first time trying to program this board.
In the past, I was able to get fresh boards to program by manually pressing the reset just before running the openocd command but it took a few tries some times.
I was trying that too, thinking that maybe I needed to catch it before it had changed the pinmux to take JTAG off of the pins. That's how I ended up with the two different behaviors in my original issue post.
I will have to find a fresh LoFive to see if I can replicate and fix this issue.
So I have been able to replicate this issue on the LoFive R1 with a fresh module.
I think I originally programmed the ones I had here with the old SDK so that is why I never ran into this issue when updating the bootloader to the new one.
Once the board has a program installed on the flash it works just fine.
Let me dig into OpenOCD and see if I can fix this.
@gkelly What distribution / version of Linux are you using?
I found that the prebuilt Ubuntu toolchain was causing the issue on my computer. I am using Debian 10 and it does not have libncurses5 by default and the gdb instance was failing to launch.
make PROGRAM=lofive-boot TARGET=lofive-r1-bootloader upload
scripts/upload --elf /home/michael/projects/freedom-e-sdk/software/lofive-boot/debug/lofive-boot.elf --openocd /home/michael/toolchains/riscv-openocd-0.10.0-2019.08.2-x86_64-linux-ubuntu14/bin/openocd --gdb /home/michael/toolchains/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-gdb --openocd-config bsp/lofive-r1-bootloader/openocd.cfg
/home/michael/toolchains/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-gdb: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
make: *** [Makefile:343: upload] Error 127
Once I installed the legacy libncurses5, I was able to program the board.
Maybe that was a fluke. I went back and erased the flash and now it won't program again.
Okay try pulling the latest changes on the lofive-r1 branch of the mwelling/freedom-e-sdk. https://github.com/mwelling/freedom-e-sdk/commit/015f64ab090a2205002408aa6065b359651b76e7
See if that fixes the issue for you. If it doesn't work the first time, press the reset button and try again.
If you still can't get it to work send me the debugging output from openocd.
Here is my log, still some issues: https://pastebin.com/ve7qyj1H
What version of OpenOCD are you using?
I am using the latest version provided on the SiFive website.
https://static.dev.sifive.com/dev-tools/riscv-openocd-0.10.0-2019.08.2-x86_64-linux-ubuntu14.tar.gz
Provide the output of the console from the launching of the programming command.
I want to make sure that the gdb instance is running as well.
Ah sorry, the previous log was OpenOCD only. I now added the -d flag to the upload script so I can use the "make PROGRAM=lofive-boot TARGET=lofive-r1-bootloader upload" command and get a complete log with OpenOCD and GDB: https://pastebin.com/gJahf10H
Does pressing the reset button before starting the upload help?
The result remains the same. I tried a few times, pressing the reset button just before, during or a few seconds before upload..
Can you try with the prebuilt versions of openocd and the toolchain provided here so we can make sure that we have the same setup?
See "Prebuilt RISC‑V / GCC Toolchain and Emulator" section.
I am already using the latest binaries from there. I am going to see if I can find a J-Link somewhere, as the Hifive board with the G002 chip uses an on board J-Link. Perhaps that helps getting these programmed.
Yeah JLink supports this SoC as well. Sorry this is being so difficult.
I have a LoFive R1 and am trying to follow the instructions for using the new SDK. When I get to the programming step the program upload always fails.
The following is from me trying to run:
If I don't press the reset button first:
If I do press the reset button first:
Here's the openocd invocation when run with
-d
: logsThis seems to point to
riscv013_halt_go(): unable to halt hart 0
. Unclear why it can't halt the HART. I tried both with the riscv-openocd from the sifive site and built from the riscv-openocd github repo.Any debugging hints?