I have a HiFive1 revB, and I’m trying to get a simple command-line development workflow going under macOS. Following the instructions in the Getting Started Guide, which seemed to make sense. I found and installed the Segger JLink stuff. That step was a bit icky/proprietary feeling, but there you go. JLinkConfig prompted me to upgrade the firmware of the JLink emulator, which seemed to go fine.
I can connect to both serial ports of my HiFive1 revB, and see the ASCII art on one of them, and the ESP32 (I think?) serial console info on the other. So far, so good.
Chapter 7 of the getting started guide says that I should be able to find both the Freedom-E SDK for my platform, and the openocd tools on the SiFive page for the HiFive1revB. Currently I only see the Freedom-E SDK stuff, and nothing in the releases page mentions host platform, so that was odd. Further, I don’t see mention of openocd on the sifive.com page for the HiFive, or in the github repo, so following the Getting started guide has lead me to a dead end.
I have, in my previous RISC-V explorations, installed both the risc-v gnu toolchain and openocd using homebrew. If that works, I highly suggest adding that to the getting started guide for macOs users.
In case that is correct, I did
export RISCV_PATH to my homebrew’s riscv-gnu-toolchain directory, and attempted to build hello, in the RC3 release of the freedom-e-sdk (201908-rc3) according to the instructions on page 21 of the getting started guide:
make BSP=metal PROGRAM=hello TARGET=sifive-hifive1-revb software
That failed looking for the file
freedom-metal/configure, so I tried again in a fresh checkout of the freedom-e repo from github.
That got a bit further: the configure step failed checking that the C compiler produces valid executables. According to config.log, it was checking for 32-bit executables, but found 64-bit. Here’s the relevant part of config.log:
/usr/local/Cellar/riscv-gnu-toolchain/gnu/lib/gcc/riscv64-unknown-elf/9.2.0/../../../../riscv64-unknown-elf/bin/ld: /usr/local/Cellar/riscv-gnu-toolchain/gnu/lib/gcc/riscv64-unknown-elf/9.2.0/../../../../riscv64-unknown-elf/lib/libg_nano.a(lib_a-exit.o): file class ELFCLASS64 incompatible with ELFCLASS32 /usr/local/Cellar/riscv-gnu-toolchain/gnu/lib/gcc/riscv64-unknown-elf/9.2.0/../../../../riscv64-unknown-elf/bin/ld: final link failed: file in wrong format
At this point, I’m off the rails enough that I figured I should stop, document what I tried, carefully back out of all of the steps I’d taken, and pretend I’m opening the HiFive1 box again from scratch.
I imagine I took a wrong step early on but thought it might be helpful to others to document what I experienced, and what I tried.