Topic: Building for embedded RISC-V platform


I am attempting to build wolfSSL and the associated tests for a platform running a minimalistic kernel (implements some system calls and sets up virtual memory) with a RISC-V arch and newlib toolchain. The library needs to be compiled statically. I am cross-compiling this on an x86 machine.

I'm encountering some build errors for the wolfcrypt/test/testwolfcrypt binary:

tls13.c:(.text+0x2f96): undefined reference to `__errno_location'
integer.c:(.text+0x3912): undefined reference to `__ctype_toupper_loc'
.... and these same errors but for other files as well.

Here's the configuration options used:

./configure --enable-static CFLAGS="-I$RISCV/sysroot/usr/include -I$RISCV/riscv64-unknown-elf/include -DWOLFSSL_USER_IO -Os" CPPFLAGS="-I./" --host=riscv64 CC=riscv64-unknown-elf-gcc AR=riscv64-unknown-elf-ar RANLIB=riscv64-unknown-elf-ranlib LD=riscv64-unknown-elf-gcc --prefix=$HOME/tools/wolfssl LDFLAGS="-L$RISCV/riscv64-unknown-elf/lib -lc -lgloss -lstdc++" --enable-filesystem=no --enable-singlethreaded --enable-oldtls=no --enable-tlsv12=no --enable-asyncthreads=no --enable-asm=no

Are these errors related to libc? I'm configuring with newlib's c library, and not sure what the problem might be.

Is there an additional configuration option needed, or is there somehow a library inconsistency problem?



Re: Building for embedded RISC-V platform

Hi kbarb,

Did you happen to see the instructions for HiFive Unleashed here? … -UNLEASHED … -compiling

The errors above look like either libc or sysroot target/host mismatch issue with cross-compiling.  Perhaps try using `--with-sysroot=` instead of manually putting it into "CFLAGS"-I..."?

David Garske, wolfSSL