Skip to content

cpu/fe310: set back newlib as default libc#15988

Merged
aabadie merged 1 commit intoRIOT-OS:masterfrom
aabadie:pr/cpu/fe310_newlib_default
Feb 12, 2021
Merged

cpu/fe310: set back newlib as default libc#15988
aabadie merged 1 commit intoRIOT-OS:masterfrom
aabadie:pr/cpu/fe310_newlib_default

Conversation

@aabadie
Copy link
Contributor

@aabadie aabadie commented Feb 12, 2021

Contribution description

This PR fixes a regression introduced by the combination of #15859 and #15957. Initially newlib was used as default libc on fe310 and the regression forces the use of picolibc.

For users with local toolchains providing newlib by default, this regression is a breaking change. Note that in recent Ubuntu versions, riscv64-unknown-elf is available in the package manager but it doesn't come with newlib and the package manager only provides picolibc. So it's not possible to use the riscv toolchain in the package manager of Ubuntu unless FEATURES_REQUIRED=picolibc is added to the build command. So this is not optimal but there's no good solution for all setup at the moment (until we have a way to automatically detect and use the available libc).

Testing procedure

this PR
$ make BOARD=hifive1b -C examples/hello-world --no-print-directory 
Building application "hello-world" for "hifive1b" with MCU "fe310".

"make" -C /work/riot/RIOT/boards/hifive1b
"make" -C /work/riot/RIOT/core
"make" -C /work/riot/RIOT/cpu/fe310
"make" -C /work/riot/RIOT/cpu/fe310/periph
"make" -C /work/riot/RIOT/cpu/fe310/vendor
"make" -C /work/riot/RIOT/cpu/riscv_common
"make" -C /work/riot/RIOT/cpu/riscv_common/periph
"make" -C /work/riot/RIOT/drivers
"make" -C /work/riot/RIOT/drivers/periph_common
"make" -C /work/riot/RIOT/sys
"make" -C /work/riot/RIOT/sys/auto_init
"make" -C /work/riot/RIOT/sys/malloc_thread_safe
"make" -C /work/riot/RIOT/sys/newlib_syscalls_default
"make" -C /work/riot/RIOT/sys/stdio_uart
   text	   data	    bss	    dec	    hex	filename
   7790	    108	   2248	  10146	   27a2	/work/riot/RIOT/examples/hello-world/bin/hifive1b/hello-world.elf
master
$ make BOARD=hifive1b -C examples/hello-world --no-print-directory 
Building application "hello-world" for "hifive1b" with MCU "fe310".

"make" -C /work/riot/RIOT/boards/hifive1b
"make" -C /work/riot/RIOT/core
"make" -C /work/riot/RIOT/cpu/fe310
"make" -C /work/riot/RIOT/cpu/fe310/periph
"make" -C /work/riot/RIOT/cpu/fe310/vendor
"make" -C /work/riot/RIOT/cpu/riscv_common
"make" -C /work/riot/RIOT/cpu/riscv_common/periph
"make" -C /work/riot/RIOT/drivers
"make" -C /work/riot/RIOT/drivers/periph_common
"make" -C /work/riot/RIOT/sys
"make" -C /work/riot/RIOT/sys/auto_init
"make" -C /work/riot/RIOT/sys/malloc_thread_safe
"make" -C /work/riot/RIOT/sys/picolibc_syscalls_default
/work/riot/RIOT/sys/picolibc_syscalls_default/syscalls.c:236:5: error: implicit declaration of function 'FDEV_SETUP_STREAM' [-Werror=implicit-function-declaration]
  236 |     FDEV_SETUP_STREAM(picolibc_put, picolibc_get, picolibc_flush, _FDEV_SETUP_RW);
      |     ^~~~~~~~~~~~~~~~~
/work/riot/RIOT/sys/picolibc_syscalls_default/syscalls.c:236:67: error: '_FDEV_SETUP_RW' undeclared here (not in a function)
  236 |     FDEV_SETUP_STREAM(picolibc_put, picolibc_get, picolibc_flush, _FDEV_SETUP_RW);
      |                                                                   ^~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[3]: *** [/work/riot/RIOT/Makefile.base:107: /work/riot/RIOT/examples/hello-world/bin/hifive1b/picolibc_syscalls_default/syscalls.o] Error 1
make[2]: *** [/work/riot/RIOT/Makefile.base:30: ALL--/work/riot/RIOT/sys/picolibc_syscalls_default] Error 2
make[1]: *** [/work/riot/RIOT/Makefile.base:30: ALL--/work/riot/RIOT/sys] Error 2
make: *** [/work/riot/RIOT/examples/hello-world/../../Makefile.include:618: application_hello-world.module] Error 2

Issues/PRs references

#15859 and #15957

@aabadie aabadie added Area: build system Area: Build system CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: RISC-V Platform: This PR/issue effects RISC-V-based platforms labels Feb 12, 2021
@aabadie aabadie requested a review from maribu February 12, 2021 08:12
@aabadie aabadie changed the title cpu/fe310: set newlib as default libc cpu/fe310: set back newlib as default libc Feb 12, 2021
Copy link
Member

@maribu maribu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

@aabadie aabadie merged commit 3a9f8d5 into RIOT-OS:master Feb 12, 2021
@aabadie aabadie deleted the pr/cpu/fe310_newlib_default branch February 12, 2021 08:59
@kaspar030 kaspar030 added this to the Release 2021.04 milestone Apr 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: build system Area: Build system CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: RISC-V Platform: This PR/issue effects RISC-V-based platforms

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants