diff --git a/cpu/arm7_common/Kconfig b/cpu/arm7_common/Kconfig index 8d2959b5bf..edc4337c63 100644 --- a/cpu/arm7_common/Kconfig +++ b/cpu/arm7_common/Kconfig @@ -23,6 +23,7 @@ config CPU_CORE_ARM7TDMI_S ## Declaration of specific features config HAS_ARCH_ARM7 bool + select HAS_PICOLIBC help Indicates that the core is part of the ARM7 group of cores. diff --git a/cpu/arm7_common/Makefile.dep b/cpu/arm7_common/Makefile.dep index 2d3962bb58..fabfff3190 100644 --- a/cpu/arm7_common/Makefile.dep +++ b/cpu/arm7_common/Makefile.dep @@ -1,7 +1,7 @@ # use common ARM7 periph code USEMODULE += arm7_common_periph -ifeq (1,$(PICOLIBC)) +ifneq (,$(filter picolibc,$(FEATURES_USED))) # Use Picolibc when explicitly selected USEMODULE += picolibc else diff --git a/cpu/arm7_common/Makefile.features b/cpu/arm7_common/Makefile.features index f382f9a5d8..b4681a50cd 100644 --- a/cpu/arm7_common/Makefile.features +++ b/cpu/arm7_common/Makefile.features @@ -7,5 +7,6 @@ FEATURES_PROVIDED += arch_arm7 FEATURES_PROVIDED += cpp FEATURES_PROVIDED += libstdcpp FEATURES_PROVIDED += periph_pm +FEATURES_PROVIDED += picolibc FEATURES_PROVIDED += puf_sram FEATURES_PROVIDED += ssp diff --git a/cpu/cortexm_common/Kconfig b/cpu/cortexm_common/Kconfig index 93418443fc..afd3726171 100644 --- a/cpu/cortexm_common/Kconfig +++ b/cpu/cortexm_common/Kconfig @@ -40,6 +40,7 @@ config CPU_CORE_CORTEX_M select HAS_CPU_CORE_CORTEXM select HAS_PERIPH_PM select HAS_PUF_SRAM + select HAS_PICOLIBC select HAS_CPP select HAS_LIBSTDCPP select HAS_CPU_CHECK_ADDRESS diff --git a/cpu/cortexm_common/Makefile.dep b/cpu/cortexm_common/Makefile.dep index edc2835da9..d2b74c516f 100644 --- a/cpu/cortexm_common/Makefile.dep +++ b/cpu/cortexm_common/Makefile.dep @@ -4,7 +4,7 @@ USEMODULE += cortexm_common # include common periph code USEMODULE += cortexm_common_periph -ifeq (1,$(PICOLIBC)) +ifneq (,$(filter picolibc,$(FEATURES_USED))) # Use Picolibc when explicitly selected USEMODULE += picolibc else diff --git a/cpu/cortexm_common/Makefile.features b/cpu/cortexm_common/Makefile.features index 260ec2c31e..bc2895d380 100644 --- a/cpu/cortexm_common/Makefile.features +++ b/cpu/cortexm_common/Makefile.features @@ -7,6 +7,7 @@ FEATURES_PROVIDED += cpu_core_cortexm FEATURES_PROVIDED += libstdcpp FEATURES_PROVIDED += periph_pm FEATURES_PROVIDED += puf_sram +FEATURES_PROVIDED += picolibc FEATURES_PROVIDED += ssp # cortex-m4f and cortex-m7 provide FPU support diff --git a/cpu/fe310/Kconfig b/cpu/fe310/Kconfig index bdadfff1b5..d1be703e52 100644 --- a/cpu/fe310/Kconfig +++ b/cpu/fe310/Kconfig @@ -8,6 +8,7 @@ config CPU_ARCH_RISCV bool select HAS_ARCH_RISCV + select HAS_PICOLIBC if '$(RIOT_CI_BUILD)' != '1' config CPU_CORE_RV32M bool diff --git a/cpu/fe310/Makefile.dep b/cpu/fe310/Makefile.dep index ff4abe1366..99efb3df64 100644 --- a/cpu/fe310/Makefile.dep +++ b/cpu/fe310/Makefile.dep @@ -1,4 +1,4 @@ -ifeq (1,$(PICOLIBC)) +ifneq (,$(filter picolibc,$(FEATURES_USED))) USEMODULE += picolibc else USEMODULE += newlib_nano diff --git a/cpu/fe310/Makefile.features b/cpu/fe310/Makefile.features index 9f46d6ce83..5830696231 100644 --- a/cpu/fe310/Makefile.features +++ b/cpu/fe310/Makefile.features @@ -8,3 +8,8 @@ FEATURES_PROVIDED += periph_plic FEATURES_PROVIDED += periph_pm FEATURES_PROVIDED += periph_wdt FEATURES_PROVIDED += ssp + +# RISC-V toolchain on CI does not work properly with picolibc yet +ifeq (,$(RIOT_CI_BUILD)) + FEATURES_PROVIDED += picolibc +endif diff --git a/examples/gnrc_minimal/Makefile b/examples/gnrc_minimal/Makefile index cb657e60b4..5f44b79cdb 100644 --- a/examples/gnrc_minimal/Makefile +++ b/examples/gnrc_minimal/Makefile @@ -26,6 +26,12 @@ USEMODULE += gnrc_icmpv6_echo # Use minimal standard PRNG USEMODULE += prng_minstd +# llvm compatibility requires yet to be released picolibc 1.4.7 +ifneq (llvm, $(TOOLCHAIN)) + # Use picolibc when available + FEATURES_OPTIONAL += picolibc +endif + CFLAGS += -DLOG_LEVEL=LOG_NONE # disable log output # Set GNRC_PKTBUF_SIZE via CFLAGS if not being set via Kconfig. ifndef CONFIG_GNRC_PKTBUF_SIZE diff --git a/kconfigs/Kconfig.features b/kconfigs/Kconfig.features index c0f321edbc..26bfd998ec 100644 --- a/kconfigs/Kconfig.features +++ b/kconfigs/Kconfig.features @@ -296,6 +296,11 @@ config HAS_PERIPH_WDT_CB help Indicates that the WDT peripheral allows setting a callback. +config HAS_PICOLIBC + bool + help + Indicates that the picolibc C library is available for the platform. + config HAS_PUF_SRAM bool help