CW308_FE310 and issues with riscv64-unknown-elf-gcc

Hello,

I am new to ChipWhisperer and I am trying to perform tests on the CW308_FE310 using a CW308 UFO board.
I tried to build an example firmware following the “1 - Connecting to Hardware.ipynb” tutorial.
So I run:

%%bash
cd …/hardware/victims/firmware/simpleserial-base/
make PLATFORM=CW308_FE310 CRYPTO_TARGET=NONE

I tried to do it using the virtual machine (using Virtual Box) provided but the riscv64-unknown-elf-gcc is not found.
I downloaded chipwhisperer locally on my OSX machine and downloaded the riscv compiler provided by sifive.

However, I seem to have some linking issue when running “make PLATFORM=CW308_FE310 CRYPTO_TARGET=NONE”.

Here is (some of) my error log:

Linking: simpleserial-base-CW308_FE310.elf
riscv64-unknown-elf-gcc -march=rv32imac -mabi=ilp32 -mcmodel=medlow -I. -ffunction-sections -gdwarf-2 -DSS_VER=SS_VER_1_1 -DHAL_TYPE=HAL_fe310 -DPLATFORM=CW308_FE310 -DF_CPU=7372800UL -DSS_VER_2_0=2 -DSS_VER_2_1=3 -DSS_VER_1_1=1 -DSS_VER_1_0=0 -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=objdir/simpleserial-base.o -I…/./simpleserial/ -I…/./hal -I…/./hal/fe310 -I…/./hal/fe310/freedom-metal-201908 -I…/./crypto/ -std=gnu99 -Wno-strict-prototypes -MMD -MP -MF .dep/simpleserial-base-CW308_FE310.elf.d objdir/simpleserial-base.o objdir/simpleserial.o objdir/fe310_hal.o objdir/button.o objdir/cache.o objdir/clock.o objdir/cpu.o objdir/gpio.o objdir/interrupt.o objdir/led.o objdir/lock.o objdir/memory.o objdir/pmp.o objdir/privilege.o objdir/shutdown.o objdir/spi.o objdir/switch.o objdir/timer.o objdir/tty.o objdir/uart.o objdir/time.o objdir/synchronize_harts.o objdir/fixed-clock.o objdir/fixed-factor-clock.o objdir/inline.o objdir/riscv_clint0.o objdir/riscv_cpu.o objdir/riscv_plic0.o objdir/sifive_ccache0.o objdir/sifive_fe310-g000_hfrosc.o objdir/sifive_fe310-g000_hfxosc.o objdir/sifive_fe310-g000_lfrosc.o objdir/sifive_fe310-g000_pll.o objdir/sifive_fe310-g000_prci.o objdir/sifive_fu540-c000_l2.o objdir/sifive_global-external-interrupts0.o objdir/sifive_gpio0.o objdir/sifive_gpio-buttons.o objdir/sifive_gpio-leds.o objdir/sifive_gpio-switches.o objdir/sifive_local-external-interrupts0.o objdir/sifive_spi0.o objdir/sifive_test0.o objdir/sifive_uart0.o objdir/sys_exit.o objdir/entry.o objdir/trap.o objdir/vector.o objdir/crt0.o --output simpleserial-base-CW308_FE310.elf --specs=nano.specs -T …/./hal/fe310/metal.default.lds -Wl,–gc-sections -lm -nostartfiles -nostdlib -Wl,–start-group -lc -lgcc -Wl,–end-group -Wl,-Map=simpleserial-base-CW308_FE310.map,–cref -lm
…/./hal/fe310/freedom-metal-201908/src/shutdown.c:15:9: note: ‘#pragma message: There is no defined shutdown mechanism, metal_shutdown() will spin.’
15 | #pragma message(“There is no defined shutdown mechanism, metal_shutdown() will spin.”)
| ^~~~~~~
…/./hal/fe310/freedom-metal-201908/src/time.c: In function ‘metal_gettimeofday’:
…/./hal/fe310/freedom-metal-201908/src/time.c:11:9: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
11 | if (rv = metal_timer_get_cyclecount(0, &mcc)) {
| ^~
…/./hal/fe310/freedom-metal-201908/src/time.c:14:9: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
14 | if (rv = metal_timer_get_timebase_frequency(0, &timebase)) {
| ^~
…/./hal/fe310/freedom-metal-201908/src/drivers/riscv_clint0.c: In function ‘__metal_driver_riscv_clint0_set_vector_mode’:
…/./hal/fe310/freedom-metal-201908/src/drivers/riscv_clint0.c:125:9: warning: enumeration value ‘METAL_SELECTIVE_NONVECTOR_MODE’ not handled in switch [-Wswitch]
125 | switch (mode) {
| ^~~~~~
…/./hal/fe310/freedom-metal-201908/src/drivers/riscv_clint0.c:125:9: warning: enumeration value ‘METAL_SELECTIVE_VECTOR_MODE’ not handled in switch [-Wswitch]
…/./hal/fe310/freedom-metal-201908/src/drivers/riscv_clint0.c:125:9: warning: enumeration value ‘METAL_HARDWARE_VECTOR_MODE’ not handled in switch [-Wswitch]
…/./hal/fe310/freedom-metal-201908/src/drivers/riscv_cpu.c: In function ‘__metal_driver_riscv_cpu_controller_set_vector_mode’:
…/./hal/fe310/freedom-metal-201908/src/drivers/riscv_cpu.c:729:43: warning: unused variable ‘intc’ [-Wunused-variable]
729 | struct __metal_driver_riscv_cpu_intc *intc = (void *)(controller);
| ^~~~
/opt/riscv/lib/gcc/riscv64-unknown-elf/11.1.0/…/…/…/…/riscv64-unknown-elf/bin/ld: objdir/button.o:/Users/johngaspoz/Documents/chipwhisperer/hardware/victims/firmware/simpleserial-base/…/./hal/fe310/freedom-metal-201908/metal/machine.h:155: multiple definition of __metal_dt_prci_10008000'; objdir/fe310_hal.o:/Users/johngaspoz/Documents/chipwhisperer/hardware/victims/firmware/simpleserial-base/.././hal/fe310/freedom-metal-201908/metal/machine.h:155: first defined here /opt/riscv/lib/gcc/riscv64-unknown-elf/11.1.0/../../../../riscv64-unknown-elf/bin/ld: objdir/button.o:/Users/johngaspoz/Documents/chipwhisperer/hardware/victims/firmware/simpleserial-base/.././hal/fe310/freedom-metal-201908/metal/machine.h:152: multiple definition of __metal_dt_clock_4’; objdir/fe310_hal.o:/Users/johngaspoz/Documents/chipwhisperer/hardware/victims/firmware/simpleserial-base/…/./hal/fe310/freedom-metal-201908/metal/machine.h:152: first defined here …

Do you have an idea how I could fix this ?

Thanks for the help

Hi,

Try using the compiler from this release: https://github.com/sifive/freedom-tools/releases/tag/v2019.05.0. The newest version of the compiler doesn’t seem to work.

Alex

Hi,

Thanks for the help.
I worked with this release.

Best,