Riscv E31 Arty example in Eclipse Error

Hi,
I am trying to run the Riscv E31 Arty example in Eclipse but I am getting the error below:
make all
Building file: …/xpacks/micro-os-plus-semihosting/src/syscalls-semihosting.cpp
Invoking: GNU RISC-V Cross C++ Compiler
riscv-none-elf-g++ -march=rv32imac -mabi=ilp32 -mcmodel=medany -msmall-data-limit=8 -mno-save-restore -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-move-loop-invariants -Wall -Wextra -g3 -DDEBUG -DOS_USE_SEMIHOSTING_SYSCALLS -DOS_USE_CPP_INTERRUPTS -DTRACE -DOS_USE_TRACE_SEMIHOSTING_DEBUG -DSIFIVE_E31ARTY -DSIFIVE_E31ARTY_BOARD -I"…/include" -I"…/xpacks/micro-os-plus-diag-trace/include" -I"…/xpacks/micro-os-plus-semihosting/include" -I"…/xpacks/sifive-devices/include" -I"…/xpacks/sifive-arty-boards/include" -I"…/xpacks/micro-os-plus-c-libs/include" -I"…/xpacks/micro-os-plus-riscv-arch/include" -I"…/xpacks/micro-os-plus-startup/include" -std=gnu++14 -fabi-version=0 -fno-exceptions -fno-rtti -fno-use-cxa-atexit -fno-threadsafe-statics -MMD -MP -MF"xpacks/micro-os-plus-semihosting/src/syscalls-semihosting.d" -MT"xpacks/micro-os-plus-semihosting/src/syscalls-semihosting.o" -c -o “xpacks/micro-os-plus-semihosting/src/syscalls-semihosting.o” “…/xpacks/micro-os-plus-semihosting/src/syscalls-semihosting.cpp”
…/xpacks/micro-os-plus-semihosting/src/syscalls-semihosting.cpp:1569:3: error: ‘int select(int, fd_set*, fd_set*, fd_set*, timeval*)’ aliased to undefined symbol ‘_ZN5posix6selectEiP13_types_fd_setS1_S1_P7timeval’
1569 | select (int nfds, fd_set* readfds, fd_set* writefds, fd_set* errorfds,
| ^~~~~~
make: *** [xpacks/micro-os-plus-semihosting/src/subdir.mk:23: xpacks/micro-os-plus-semihosting/src/syscalls-semihosting.o] Error 1
“make all” terminated with exit code 2. Build might be incomplete.

The Eclipse project template is pretty old and requires some minor updates. I’ll check it and try to suggest a workaround.

Thanks

With the latest toolchain, please enter _zicsr in the Other extensions field (C/C++ Build → Settings → Tool Settings → Target Processor), and in syscalls-semihosting.cpp, comment out the select() at lines 1568-1570.

The first issue is caused by a change in how the RISC-V standard defines the extensions and the second by a change in newlib.

Also please note that the SiFive RISC-V C/C++ Project template is deprecated. For an updated template, see the Hello World RISC-V QEMU xPack.

Thank you! It builds now.

~H

Hi, Thank you for helping me with my previous issue. I have another question, do I need to make any changes to the device files in order to load the design to an Arty- A7 100T? This is the board I have in hand and I would like to load the demo to it.

Thank you,
Hellen

I’m afraid I don’t have an answer for this. If I remember right, by the time those templates were written, they were configured for a smaller Arty board.