1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 14:33:52 +01:00

pkg/nimble: conditional compilation of nRF5x code

The package uses the nRFx SDK package `nrfx`. In addition, the `mynewt-nimble` repository contains some files (`porting/nimble/src/hal_timer.c` and `porting/npl/riot/src/nrf5x_isr.c`) that are compilable only for nRF MCUs. To allow the compilation for other platforms, the use of the `nrfx` package and the compilation of these files are now dependent on the use of any nRF5x MCU.
This commit is contained in:
Gunar Schorcht 2022-08-11 09:53:57 +02:00
parent e3b2b75aff
commit 0bef4c0c30
5 changed files with 16 additions and 3 deletions

View File

@ -10,3 +10,7 @@ USEMODULE += cpu_common
FEATURES_OPTIONAL += vdd_lc_filter_reg1
# reg0 feature denotes stage 0 two-stage regulator models
FEATURES_OPTIONAL += vdd_lc_filter_reg0
ifneq (,$(filter nimble,$(USEPKG)))
USEPKG += nrfx
endif

View File

@ -38,7 +38,7 @@ nimble_porting_nimble:
$(QQ)"$(MAKE)" -C $(PDIR)/porting/nimble/src/ -f $(RIOTPKG)/$(PKG_NAME)/nimble.porting.mk MODULE=$@
nimble_npl_riot:
$(QQ)"$(MAKE)" -C $(PDIR)/porting/npl/riot/src/ -f $(RIOTBASE)/Makefile.base MODULE=$@
$(QQ)"$(MAKE)" -C $(PDIR)/porting/npl/riot/src/ -f $(RIOTPKG)/$(PKG_NAME)/nimble.npl.mk MODULE=$@
# generic modules
nimble_transport:

View File

@ -3,8 +3,6 @@ USEMODULE += sema
USEMODULE += event_callback
USEMODULE += ztimer_msec
USEPKG += nrfx
# Requires nimble feature
FEATURES_REQUIRED += ble_nimble

7
pkg/nimble/nimble.npl.mk Normal file
View File

@ -0,0 +1,7 @@
ifeq (,$(filter nrf51 nrf52 nrf53,$(CPU_FAM)))
# nrf5x_isr.c does only compile for nRF5x MCUs
IGNORE := nrf5x_isr.c
SRC := $(filter-out $(IGNORE),$(wildcard *.c))
endif
include $(RIOTBASE)/Makefile.base

View File

@ -1,5 +1,9 @@
ifneq (,$(filter mynewt-core,$(USEMODULE)))
SRC = nimble_port.c
else ifeq (,$(filter nrf51 nrf52 nrf53,$(CPU_FAM)))
# hal_timer.c does only compile for nRF5x MCUs
IGNORE := hal_timer.c
SRC := $(filter-out $(IGNORE),$(wildcard *.c))
endif
include $(RIOTBASE)/Makefile.base