1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #15859 from fjmolinas/pr_newlib_feature

treewide: model newlib as a FEATURE
This commit is contained in:
Alexandre Abadie 2021-01-27 10:06:08 +01:00 committed by GitHub
commit ce97e9d8ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 46 additions and 29 deletions

View File

@ -20,3 +20,7 @@ include $(RIOTCPU)/$(CPU)/Makefile.features
# Provide CPU as a feature to allow listing all boards with a CPU
FEATURES_PROVIDED += cpu_$(CPU)
# Features that are conflicting for all architectures
FEATURES_CONFLICT += picolibc:newlib
FEATURES_CONFLICT_MSG += "Only one standard C library can be used"

View File

@ -1,5 +1,4 @@
# Use Picolibc to reduce ROM usage
USEMODULE += picolibc
FEATURES_REQUIRED += picolibc
include $(RIOTBOARD)/common/nucleo/Makefile.dep

View File

@ -4,4 +4,3 @@ endif
# Use Picolibc to reduce ROM usage
FEATURES_REQUIRED += picolibc
USEMODULE += picolibc

View File

@ -1,3 +1,2 @@
# Use Picolibc to reduce ROM usage
FEATURES_REQUIRED += picolibc
USEMODULE += picolibc

View File

@ -24,6 +24,7 @@ config CPU_CORE_ARM7TDMI_S
## Declaration of specific features
config HAS_ARCH_ARM7
bool
select HAS_NEWLIB
select HAS_PICOLIBC
help
Indicates that the core is part of the ARM7 group of cores.

View File

@ -1,12 +1,8 @@
# use common ARM7 periph code
USEMODULE += arm7_common_periph
ifneq (,$(filter picolibc,$(FEATURES_USED)))
# Use Picolibc when explicitly selected
USEMODULE += picolibc
else
# all cortex MCU's use newlib as libc
USEMODULE += newlib
FEATURES_REQUIRED_ANY += newlib|picolibc
ifneq (,$(filter newlib,$(USEMODULE)))
# use the nano-specs of Newlib when available
USEMODULE += newlib_nano
endif

View File

@ -6,6 +6,7 @@ FEATURES_PROVIDED += arch_arm
FEATURES_PROVIDED += arch_arm7
FEATURES_PROVIDED += cpp
FEATURES_PROVIDED += libstdcpp
FEATURES_PROVIDED += newlib
FEATURES_PROVIDED += periph_pm
FEATURES_PROVIDED += picolibc
FEATURES_PROVIDED += puf_sram

View File

@ -47,6 +47,7 @@ config CPU_CORE_CORTEX_M
select HAS_CPU_CHECK_ADDRESS
select HAS_SSP
select HAS_CORTEXM_SVC
select HAS_NEWLIB
## Common CPU symbols
config CPU_CORE

View File

@ -4,17 +4,8 @@ USEMODULE += cortexm_common
# include common periph code
USEMODULE += cortexm_common_periph
# Ensure newlib is not added if picolibc is already in FEATURES_USED or USEMODULE.
# nucleo-l011k4 doesn't use features to forces picolibc but directly set it in
# USEMODULE. This is because during the first pass of the dependency resolution,
# with the feature mechanism, the picolib feature is not present in FEATURES_USED
# at this staged and as a result newlib modules are wrongly added.
ifneq (,$(filter picolibc,$(FEATURES_USED) $(USEMODULE)))
# Use Picolibc when explicitly selected
USEMODULE += picolibc
else
# all cortex MCU's use newlib as libc
USEMODULE += newlib
FEATURES_REQUIRED_ANY += newlib|picolibc
ifneq (,$(filter newlib,$(USEMODULE)))
# use the nano-specs of Newlib when available
USEMODULE += newlib_nano
endif

View File

@ -5,6 +5,7 @@ FEATURES_PROVIDED += cpp
FEATURES_PROVIDED += cpu_check_address
FEATURES_PROVIDED += cpu_core_cortexm
FEATURES_PROVIDED += libstdcpp
FEATURES_PROVIDED += newlib
FEATURES_PROVIDED += periph_pm
FEATURES_PROVIDED += puf_sram
FEATURES_PROVIDED += picolibc

View File

@ -5,9 +5,12 @@ include $(RIOTCPU)/esp_common/Makefile.dep
USEMODULE += esp_idf_driver
USEMODULE += esp_idf_esp32
USEMODULE += esp_idf_soc
USEMODULE += newlib_nano
USEMODULE += pm_layered
ifneq (,$(filter newlib,$(USEMODULE)))
USEMODULE += newlib_nano
endif
ifneq (,$(filter esp_eth,$(USEMODULE)))
USEMODULE += esp_freertos
USEMODULE += esp_idf_eth

View File

@ -9,7 +9,6 @@ USEMODULE += esp_idf_util
USEMODULE += esp_idf_wpa_supplicant_crypto
USEMODULE += esp_sdk
USEMODULE += mtd
USEMODULE += newlib
USEMODULE += periph_common
USEMODULE += ps

View File

@ -16,6 +16,7 @@ config CPU_COMMON_ESP
select HAS_ESP_SPIFFS
select HAS_ESP_WIFI
select HAS_ESP_WIFI_AP
select HAS_NEWLIB
select HAS_LIBSTDCPP
select HAS_PERIPH_CPUID
select HAS_PERIPH_HWRNG

View File

@ -7,7 +7,6 @@ USEMODULE += esp_common_periph
USEMODULE += esp_freertos
USEMODULE += esp_idf
USEMODULE += log
USEMODULE += newlib
USEMODULE += periph
USEMODULE += periph_hwrng
USEMODULE += periph_flash
@ -22,6 +21,7 @@ USEMODULE += xtensa
# Features used by ESP*
FEATURES_REQUIRED += newlib
FEATURES_REQUIRED += cpp # Vendor code uses C++
ifneq (,$(filter esp_wifi_ap,$(USEMODULE)))

View File

@ -10,6 +10,7 @@ FEATURES_PROVIDED += esp_spiffs
FEATURES_PROVIDED += esp_wifi_ap
FEATURES_PROVIDED += esp_wifi
FEATURES_PROVIDED += libstdcpp
FEATURES_PROVIDED += newlib
FEATURES_PROVIDED += periph_cpuid
FEATURES_PROVIDED += periph_hwrng
FEATURES_PROVIDED += periph_pm

View File

@ -8,6 +8,7 @@
config CPU_ARCH_RISCV
bool
select HAS_ARCH_RISCV
select HAS_NEWLIB
select HAS_PICOLIBC if '$(RIOT_CI_BUILD)' != '1'
select MODULE_MALLOC_THREAD_SAFE if TEST_KCONFIG

View File

@ -1,6 +1,6 @@
ifneq (,$(filter picolibc,$(FEATURES_USED)))
USEMODULE += picolibc
else
FEATURES_REQUIRED_ANY += picolibc|newlib
ifneq (,$(filter newlib,$(USEMODULE)))
USEMODULE += newlib_nano
USEMODULE += newlib_syscalls_default
endif

View File

@ -2,6 +2,7 @@ FEATURES_PROVIDED += arch_32bit
FEATURES_PROVIDED += arch_riscv
FEATURES_PROVIDED += cpp
FEATURES_PROVIDED += libstdcpp
FEATURES_PROVIDED += newlib
FEATURES_PROVIDED += periph_cpuid
FEATURES_PROVIDED += periph_gpio periph_gpio_irq
FEATURES_PROVIDED += periph_plic

View File

@ -9,6 +9,7 @@ config CPU_ARCH_MIPS32R2
bool
select HAS_ARCH_32BIT
select HAS_ARCH_MIPS32R2
select HAS_NEWLIB
select HAS_CPP
select HAS_LIBSTDCPP
select HAS_PERIPH_PM

View File

@ -1,7 +1,7 @@
USEMODULE += mips32r2_common
USEMODULE += mips32r2_common_periph
USEMODULE += newlib
FEATURES_REQUIRED += newlib
# mips32 needs periph_timer for its gettimeofday() implementation
FEATURES_REQUIRED += periph_timer

View File

@ -2,6 +2,7 @@ CPU_ARCH = mips32r2
FEATURES_PROVIDED += arch_32bit
FEATURES_PROVIDED += arch_mips32r2
FEATURES_PROVIDED += newlib
FEATURES_PROVIDED += cpp
FEATURES_PROVIDED += libstdcpp
FEATURES_PROVIDED += periph_pm

View File

@ -12,6 +12,7 @@ config CPU_ARCH_MSP430
select HAS_ARCH_MSP430
select HAS_PERIPH_FLASHPAGE
select HAS_PERIPH_FLASHPAGE_PAGEWISE
select HAS_NEWLIB
select HAS_PERIPH_PM
select MODULE_MALLOC_THREAD_SAFE if TEST_KCONFIG

View File

@ -3,6 +3,7 @@ CPU_CORE = msp430
FEATURES_PROVIDED += arch_16bit
FEATURES_PROVIDED += arch_msp430
FEATURES_PROVIDED += newlib
FEATURES_PROVIDED += periph_flashpage
FEATURES_PROVIDED += periph_flashpage_pagewise
FEATURES_PROVIDED += periph_pm

View File

@ -327,6 +327,11 @@ config HAS_PICOLIBC
help
Indicates that the picolibc C library is available for the platform.
config HAS_NEWLIB
bool
help
Indicates that the newlib C library is available for the platform.
config HAS_PUF_SRAM
bool
help

View File

@ -45,5 +45,15 @@ ifneq (,$(filter cortexm_mpu,$(FEATURES_USED)))
USEMODULE += mpu_stack_guard
endif
# use picolibc if the feature is used
ifneq (,$(filter picolibc,$(FEATURES_USED)))
USEMODULE += picolibc
endif
# use newlib if the feature is used
ifneq (,$(filter newlib,$(FEATURES_USED)))
USEMODULE += newlib
endif
# use efm32_coretemp if the feature is used
USEMODULE += $(filter efm32_coretemp, $(FEATURES_USED))

View File

@ -530,11 +530,11 @@ ifneq (,$(filter od_string,$(USEMODULE)))
endif
ifneq (,$(filter newlib_gnu_source,$(USEMODULE)))
USEMODULE += newlib
FEATURES_REQUIRED += newlib
endif
ifneq (,$(filter newlib_nano,$(USEMODULE)))
USEMODULE += newlib
FEATURES_REQUIRED += newlib
endif
ifneq (,$(filter newlib,$(USEMODULE)))