From aec0edbcb98ec012c3fa88eeec36d92365f07d60 Mon Sep 17 00:00:00 2001 From: Jean Pierre Dudey Date: Mon, 8 Feb 2021 17:08:17 +0100 Subject: [PATCH] cpu/cc26x0_cc13x0: use SetupTrimDevice only on cc26x0 Signed-off-by: Jean Pierre Dudey --- cpu/cc26x0_cc13x0/Makefile | 4 +++- cpu/cc26x0_cc13x0/Makefile.dep | 6 +++++- cpu/cc26x0_cc13x0/cpu.c | 8 ++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/cpu/cc26x0_cc13x0/Makefile b/cpu/cc26x0_cc13x0/Makefile index 02e64abc49..91ad1b6d17 100644 --- a/cpu/cc26x0_cc13x0/Makefile +++ b/cpu/cc26x0_cc13x0/Makefile @@ -3,6 +3,8 @@ MODULE = cpu # Add a list of subdirectories, that should also be built: DIRS = periph $(RIOTCPU)/cortexm_common $(RIOTCPU)/cc26xx_cc13xx -DIRS += vendor/driverlib +ifneq (,$(filter cc26x0_driverlib,$(USEMODULE))) + DIRS += vendor/driverlib +endif include $(RIOTBASE)/Makefile.base diff --git a/cpu/cc26x0_cc13x0/Makefile.dep b/cpu/cc26x0_cc13x0/Makefile.dep index c5ceee0705..c72b3d3bd9 100644 --- a/cpu/cc26x0_cc13x0/Makefile.dep +++ b/cpu/cc26x0_cc13x0/Makefile.dep @@ -1,4 +1,8 @@ USEMODULE += cc26xx_cc13xx -USEMODULE += cc26x0_driverlib +# Module includes functions for SetupTrimDevice, +# only supported on cc26x0 family (for now). +ifneq (,$(findstring cc26x0,$(CPU_MODEL))) + USEMODULE += cc26x0_driverlib +endif include ${RIOTCPU}/cc26xx_cc13xx/Makefile.dep diff --git a/cpu/cc26x0_cc13x0/cpu.c b/cpu/cc26x0_cc13x0/cpu.c index 0b1ddbcb93..a1aa81bbeb 100644 --- a/cpu/cc26x0_cc13x0/cpu.c +++ b/cpu/cc26x0_cc13x0/cpu.c @@ -7,7 +7,7 @@ */ /** - * @ingroup cpu_cc26x0 + * @ingroup cpu_cc26x0_cc13x0 * @{ * * @file @@ -21,7 +21,9 @@ #include "periph_conf.h" #include "periph/init.h" #include "stdio_base.h" +#if IS_USED(MODULE_CC26X0_DRIVERLIB) #include "vendor/driverlib/setup.h" +#endif #ifndef HF_CLOCK_SOURCE #define HF_CLOCK_SOURCE DDI_0_OSC_CTL0_SCLK_HF_SRC_SEL_RCOSC /* set 48MHz RCOSC */ @@ -38,12 +40,14 @@ void cpu_init(void) /* initialize the Cortex-M core */ cortexm_init(); +#if IS_USED(MODULE_CC26X0_DRIVERLIB) /* Final trim of device */ SetupTrimDevice(); +#endif /* initialize stdio prior to periph_init() to allow use of DEBUG() there */ stdio_init(); /* trigger static peripheral initialization */ periph_init(); -} \ No newline at end of file +}