Flashing HiFive1 revB fail... help

Hi,
I’m trying to get started with HiFive1 revB using Freedom Studio. I am stuck trying to load Hello World into the HiFive1 and am in need of advice about how to troubleshoot the problem.

problem:
copying (using the Files application to drag and drop or cp in Terminal) a .hex file into the HiFive storage device fails and a document called FAIL.TXT is created instead. FAIL.TXT only contains “Error while connecting to CPU”.

details:
I am using a clean install of Ubuntu Desktop 18.04.2 in VMware Fusion on a MacOS 10.13 (High Sierra) host. I have successfully gotten serial output from the HiFive using the Terminal and screen. I have also gotten the same output in Freedom Studio terminal window. So I think I have basic connectivity working. You can replicate what I have by following this quick start guide.

I am unsure about my Freedom Studio configuration because the author of the Freedom Studio guide seems to have misplaced most of the Configuring Your New Project section (I’ll post a separate topic asking for this to be fixed). I have used the default settings to complete setting up my project. I can successfully create debug and release versions of my project.

btw. Is there somewhere I can download HiFive1 revB .hex files for the example code so I can be sure the code is correctly compiled?

I can’t debug or run my project from Freedom Studio because it tells me it can’t launch the project. I can’t successfully drag and drop (or cp) either the debug or release .hex files into the HiFive storage device. I don’t seem to have any information to troubleshoot the problem since the FAIL.TXT file only contains “Error while connecting to CPU”.

Any help is greatly appreciated.

I thought I’d keep trying and see if I could get the command line tools to work. So I did the following to get some functionality:

The freedom-e-sdk and jlink software seems to be embedded in the Freedom Studio directories so I’m hoping that I can set some configuration and be up and running. If I run the following from the e-sdk directory I think I should get hello world on the HiFive:

make BSP=metal PROGRAM=hello TARGET=sifive-hifive1-revb clean software upload

The first error I got was being told that the C compiler couldn’t create executables. I think this was due to the riscv64-unknown-elf-gcc… not being found. I created the RISCV_PATH environment variable to fix it:

export RISCV_PATH=/home/ty/FreedomStudio/SiFive/toolchain/riscv64-unknown-elf-gcc-8.2.0-2019.02.0

The second error I got is that JLinkExe cannot be found. So I manually soft linked it into /usr/bin:

sudo ln -s /home/ty/FreedomStudio/SiFive/jlink/jlink-6.44.0-2019.03.0/JLinkExe /usr/bin/JLinkExe

Finally I get an error saying that JLink cannot connect:

scripts/upload --hex /home/ty/FreedomStudio/SiFive/freedom-e-sdk/freedom-e-sdk-v201903/software/hello/debug/hello.hex --jlink JLinkExe
SEGGER J-Link Commander V6.44 (Compiled Mar 1 2019 17:36:52)
DLL version V6.44, compiled Mar 1 2019 17:36:42

Connecting to J-Link via USB…FAILED: Cannot connect to J-Link via USB.
J-Link connection not established yet but required for command.
Connecting to J-Link via USB…FAILED: Cannot connect to J-Link via USB.
J-Link connection not established yet but required for command.
Connecting to J-Link via USB…FAILED: Cannot connect to J-Link via USB.

I had a look at kernel.log, syslog and faillog in /var/log/ but there doesn’t seem to be anything relating to the loading of data into the HiFive1.

I also noticed that there is a 99-jlink.rules file in with the other JLink files; so I added it’s content into the /etc/udev/rules.d/99-jlink.rules file I created to get plugdev group access to the HiFive1 TTY. This doesn’t seem to make any difference.

So I’m still stuck. Once again, any help/advice is greatly appreciated.

Hi,

I’d like to help you with the Freedom-e-sdk JLink connectivity issue. It appears you’re trying to use the JLink software that’s bundled with Freedom Studio and this may be the source of the connectivity issue.

Can you try installing JLink software directly from Segger? Based on your OS description I believe this would be the correct file for you: https://www.segger.com/downloads/jlink/JLink_Linux_x86_64.deb

Segger JLink downloads are here: https://www.segger.com/downloads/jlink/#J-LinkSoftwareAndDocumentationPack

Note that you should also remove the sym link you added to use the installed JLink software.

I expect that you will need to modify /etc/udev/rules.d/99-jlink.rules after install of JLink software.

Thanks Jim. I can get the HiFive1b to flash now that I have installed the JLink software separately.

I have another post with my next problem: getting the debugger to debug in Freedom Studio. If you could pass your eyes over that one I’d appreciate any help you can provide.

Thanks.