Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Floats on RISC-V
# Build log
# Precompiled toolchain
Binaries from https://github.com/im-tomu/fomu-toolchain/releases/download/v1.5.3/fomu-toolchain-linux_x86_64-v1.5.3.tar.gz
ld: libm.a(lib_a-sf_expm1.o): in function `.L0 ':
sf_expm1.c:(.text+0x4e0): undefined reference to `__math_oflowf'
ld: riscv-blink.elf: hidden symbol `__math_oflowf' isn't defined
ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make: *** [Makefile:81: riscv-blink.elf] Error 1
# Own-compiled toolchain
Plain compiled from https://github.com/riscv/riscv-gnu-toolchain
( export LC_ALL=C ; make QUIET= ; ) 2>&1 | sed 's|/home/[^:]*/\([^/:]*:\)|\1|g'
echo " CC ./src/superbot_neural_network.c superbot_neural_network.o"
CC ./src/superbot_neural_network.c superbot_neural_network.o
riscv64-unknown-elf-gcc -c ./src/superbot_neural_network.c -I./include -D__vexriscv__ -march=rv32i -mabi=ilp32 -DSUPERBOT_FOMU_HACKER=1 -Wall -Wextra -ffunction-sections -fdata-sections -fno-common -fomit-frame-pointer -Os -march=rv32i -DGIT_VERSION=u\"v0.1-133-gbb85ddb\" -std=gnu11 -ggdb -g -DDEBUG -Wall -o .obj/superbot_neural_network.o -MMD
echo " LD riscv-blink.elf"
LD riscv-blink.elf
riscv64-unknown-elf-gcc .obj/time.o .obj/rgb.o .obj/superbot_neural_network.o .obj/usb-dev.o .obj/usb.o .obj/superbot_matrix.o .obj/main.o .obj/usb-eptri.o .obj/usb-epfifo.o .obj/crt0-vexriscv.o -I./include -D__vexriscv__ -march=rv32i -mabi=ilp32 -DSUPERBOT_FOMU_HACKER=1 -Wall -Wextra -ffunction-sections -fdata-sections -fno-common -fomit-frame-pointer -Os -march=rv32i -DGIT_VERSION=u\"v0.1-133-gbb85ddb\" -std=gnu11 -lm -L./ld -nostartfiles -Wl,--gc-sections -Wl,--no-warn-mismatch -Wl,--script=./ld/linker.ld -Wl,--build-id=none -ggdb -g -Wall -o riscv-blink.elf
ld: .obj/time.o: in function `msleep':
time.c:39: undefined reference to `__mulsi3'
ld: .obj/superbot_matrix.o: in function `matrix_multiply_vector':
superbot_matrix.c:13: undefined reference to `__mulsf3'
ld: superbot_matrix.c:13: undefined reference to `__addsf3'
ld: riscv-blink.elf(.text): relocation ".L9+0x0 (type R_RISCV_RVC_JUMP)" goes out of range
ld: libc.a(lib_a-memcpy.o): file class ELFCLASS64 incompatible with ELFCLASS32
ld: final link failed: file in wrong format
collect2: error: ld returned 1 exit status
make: *** [Makefile:81: riscv-blink.elf] Error 1
ld: .obj/time.o: in function `msleep':
time.c:39: undefined reference to `__mulsi3'
ld: .obj/superbot_matrix.o: in function `matrix_multiply_vector':
superbot_matrix.c:13: undefined reference to `__mulsf3'
ld: superbot_matrix.c:13: undefined reference to `__addsf3'
=> missing primitives
ld: libm.a(lib_a-sf_tanh.o): file class ELFCLASS64 incompatible with ELFCLASS32
ld: final link failed: file in wrong format
=> mfmf, note sure about the cause. I compiled with default settings.
collect2: error: ld returned 1 exit status
make: *** [Makefile:81: riscv-blink.elf] Error 1
Notice: none of the toolchain was installed globally. I activate one or the other (not both) by changing the PATH of the shell that runs make.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.