From dec319dd3b5c64000312f40adcb9f1f3877c2667 Mon Sep 17 00:00:00 2001 From: Jue Date: Sat, 18 Jun 2022 14:21:52 +0200 Subject: [PATCH 1/4] pkg/gecko_sdk: bump version to v4.1.2 --- pkg/gecko_sdk/Makefile | 2 +- pkg/gecko_sdk/Makefile.include | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/gecko_sdk/Makefile b/pkg/gecko_sdk/Makefile index 7bf50efe784e..81aaa47ea8b2 100644 --- a/pkg/gecko_sdk/Makefile +++ b/pkg/gecko_sdk/Makefile @@ -1,6 +1,6 @@ PKG_NAME=gecko_sdk PKG_URL=https://github.com/basilfx/RIOT-gecko-sdk -PKG_VERSION=e291e7e0bb56d3f51f03ef7c0b8af138a8d1301a +PKG_VERSION=944639a57adce84fb110fe89e54f50e161607918 PKG_LICENSE=Zlib include $(RIOTBASE)/pkg/pkg.mk diff --git a/pkg/gecko_sdk/Makefile.include b/pkg/gecko_sdk/Makefile.include index 18fd768fd71f..af892cddb09f 100644 --- a/pkg/gecko_sdk/Makefile.include +++ b/pkg/gecko_sdk/Makefile.include @@ -1,2 +1,3 @@ +INCLUDES += -I$(PKGDIRBASE)/gecko_sdk/dist/common/inc INCLUDES += -I$(PKGDIRBASE)/gecko_sdk/dist/emlib/inc INCLUDES += -I$(PKGDIRBASE)/gecko_sdk/dist/emlib-extra/inc From 19b69d785a8ab9bcbf7badd33df50f82a91ffd76 Mon Sep 17 00:00:00 2001 From: Jue Date: Thu, 13 Oct 2022 22:32:45 +0200 Subject: [PATCH 2/4] pkg/gecko_sdk: add librail --- pkg/gecko_sdk/Kconfig | 34 +++++++++++++++++++++++++++++++++- pkg/gecko_sdk/Makefile.dep | 4 ++++ pkg/gecko_sdk/Makefile.include | 11 +++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/pkg/gecko_sdk/Kconfig b/pkg/gecko_sdk/Kconfig index f4059241b516..dfdac1e4a120 100644 --- a/pkg/gecko_sdk/Kconfig +++ b/pkg/gecko_sdk/Kconfig @@ -1,11 +1,29 @@ # Copyright (c) 2021 HAW Hamburg +# 2022 SSV Software Systems GmbH # # This file is subject to the terms and conditions of the GNU Lesser # General Public License v2.1. See the file LICENSE in the top level # directory for more details. # -config PACKAGE_GECKO_SDK +## Definition of Gecko SDK specific features +config HAS_GECKO_SDK_LIBRAIL_NONFPU + bool + help + Indicates that the CPU offers librail support if the FPU is disabled. + Librail is shipped as pre-compiled blobs. Thus, we have to adapt to + their choice how to process floats. + +config HAS_GECKO_SDK_LIBRAIL_FPU + bool + help + Indicates that the CPU offers librail support if the FPU is enabled. + Librail is shipped as pre-compiled blobs. Thus, we have to adapt to + their choice how to process floats. + + +## Provided modules +menuconfig PACKAGE_GECKO_SDK bool "Vendor library for EFM/EFR/EZR32 MCUs" depends on TEST_KCONFIG help @@ -27,4 +45,18 @@ config MODULE_GECKO_SDK_EMLIB_EXTRA help Extra utility methods from EMBLIB vendor library. +config MODULE_GECKO_SDK_LIBRAIL + bool "Radio Abstraction Interface Layer (RAIL)" + depends on (HAS_GECKO_SDK_LIBRAIL_NONFPU && !MODULE_CORTEXM_FPU) || (HAS_GECKO_SDK_LIBRAIL_FPU && MODULE_CORTEXM_FPU) + help + The Silicon Labs Radio Abstraction Interface Layer (RAIL) is required + to use the integrated radio offered by the EFR32 families. + +config MODULE_GECKO_SDK_LIBRAIL_PA + bool "Power Amplifier Power Conversion Functions" + depends on MODULE_GECKO_SDK_LIBRAIL + help + Helper to convert between transmission power in dBm and the + chip- and circuit-specific raw power level. + endif # PACKAGE_GECKO_SDK diff --git a/pkg/gecko_sdk/Makefile.dep b/pkg/gecko_sdk/Makefile.dep index 63d497bfbd9e..500682fa8d7a 100644 --- a/pkg/gecko_sdk/Makefile.dep +++ b/pkg/gecko_sdk/Makefile.dep @@ -1,2 +1,6 @@ USEMODULE += gecko_sdk_emlib USEMODULE += gecko_sdk_emlib_extra + +ifneq (,$(filter gecko_sdk_librail_pa,$(USEMODULE))) + USEMODULE += gecko_sdk_librail +endif diff --git a/pkg/gecko_sdk/Makefile.include b/pkg/gecko_sdk/Makefile.include index af892cddb09f..a46cc88de27d 100644 --- a/pkg/gecko_sdk/Makefile.include +++ b/pkg/gecko_sdk/Makefile.include @@ -1,3 +1,14 @@ INCLUDES += -I$(PKGDIRBASE)/gecko_sdk/dist/common/inc INCLUDES += -I$(PKGDIRBASE)/gecko_sdk/dist/emlib/inc INCLUDES += -I$(PKGDIRBASE)/gecko_sdk/dist/emlib-extra/inc + +ifneq (,$(filter gecko_sdk_librail,$(USEMODULE))) + ARCHIVES += $(BINDIR)/gecko_sdk_librail.a + INCLUDES += -I$(PKGDIRBASE)/gecko_sdk/dist/radio/rail_lib/common + INCLUDES += -I$(PKGDIRBASE)/gecko_sdk/dist/radio/rail_lib/chip/efr32/$(EFM32_LIBRAIL_HEADER_NAME) +endif + +ifneq (,$(filter gecko_sdk_librail_pa,$(USEMODULE))) + INCLUDES += -I$(PKGDIRBASE)/gecko_sdk/dist/radio/rail_lib/plugin/pa-conversions + INCLUDES += -I$(PKGDIRBASE)/gecko_sdk/dist/radio/rail_lib/plugin/pa-conversions/$(EFM32_LIBRAIL_PA_HEADER_NAME)/config +endif From 65d4c046a84c4b5e9b5642ac3e3b7aad380ce722 Mon Sep 17 00:00:00 2001 From: Jue Date: Thu, 13 Oct 2022 22:33:36 +0200 Subject: [PATCH 3/4] cpu/efm32/efr32*: model librail integration --- cpu/efm32/Makefile.features | 6 ++++++ cpu/efm32/Makefile.include | 3 +++ cpu/efm32/families/efr32mg12p/Kconfig | 1 + cpu/efm32/families/efr32mg12p/Makefile.features | 1 + cpu/efm32/families/efr32mg12p/Makefile.include | 7 ++++++- cpu/efm32/families/efr32mg1b/Kconfig | 1 + cpu/efm32/families/efr32mg1b/Makefile.features | 1 + cpu/efm32/families/efr32mg1b/Makefile.include | 7 ++++++- cpu/efm32/families/efr32mg1p/Kconfig | 1 + cpu/efm32/families/efr32mg1p/Makefile.features | 1 + cpu/efm32/families/efr32mg1p/Makefile.include | 5 +++++ 11 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 cpu/efm32/families/efr32mg12p/Makefile.features create mode 100644 cpu/efm32/families/efr32mg1b/Makefile.features create mode 100644 cpu/efm32/families/efr32mg1p/Makefile.features diff --git a/cpu/efm32/Makefile.features b/cpu/efm32/Makefile.features index 08a71690df6e..4a70709277cc 100644 --- a/cpu/efm32/Makefile.features +++ b/cpu/efm32/Makefile.features @@ -3,6 +3,9 @@ include $(RIOTCPU)/efm32/efm32-features.mk CPU_CORE = $(EFM32_ARCHITECTURE) +# allow CPU families to add features individually +-include $(RIOTCPU)/efm32/families/$(CPU_FAM)/Makefile.features + # families without MPU ifeq (,$(filter efm32zg efm32hg, $(CPU_FAM))) FEATURES_PROVIDED += cortexm_mpu @@ -22,6 +25,9 @@ FEATURES_PROVIDED += periph_wdt FEATURES_CONFLICT += periph_rtc:periph_rtt FEATURES_CONFLICT_MSG += "On the EFM32, the RTC and RTT map to the same hardware peripheral." +FEATURES_CONFLICT += cortexm_fpu:gecko_sdk_librail_nonfpu +FEATURES_CONFLICT_MSG += "Using librail with the FPU enabled is not supported on this CPU." + ifeq (1,$(EFM32_TRNG)) FEATURES_PROVIDED += periph_hwrng endif diff --git a/cpu/efm32/Makefile.include b/cpu/efm32/Makefile.include index f6cb1d3d3bd0..dc649f90366a 100644 --- a/cpu/efm32/Makefile.include +++ b/cpu/efm32/Makefile.include @@ -6,6 +6,9 @@ include $(RIOTCPU)/efm32/efm32-info.mk # `cpu_$(CPU_FAM)` for something that is MODULE related. include $(RIOTCPU)/efm32/families/$(CPU_FAM)/Makefile.include +# Export vars for Gecko SDK librail Makefile +export EFM32_LIBRAIL_BLOB_NAME + ifeq (,$(EFM32_HEADER)) $(error Header file for $(CPU_MODEL) is missing) endif diff --git a/cpu/efm32/families/efr32mg12p/Kconfig b/cpu/efm32/families/efr32mg12p/Kconfig index af13ca2e4e72..e3d385e85b23 100644 --- a/cpu/efm32/families/efr32mg12p/Kconfig +++ b/cpu/efm32/families/efr32mg12p/Kconfig @@ -11,6 +11,7 @@ config CPU_FAM_EFR32MG12P select CPU_EFM32_SERIES1 select HAS_PERIPH_HWRNG select HAS_CORTEXM_MPU + select HAS_GECKO_SDK_LIBRAIL_NONFPU config MODULE_CPU_EFR32MG12P bool diff --git a/cpu/efm32/families/efr32mg12p/Makefile.features b/cpu/efm32/families/efr32mg12p/Makefile.features new file mode 100644 index 000000000000..71876a3dbacf --- /dev/null +++ b/cpu/efm32/families/efr32mg12p/Makefile.features @@ -0,0 +1 @@ +FEATURES_PROVIDED += gecko_sdk_librail_nonfpu diff --git a/cpu/efm32/families/efr32mg12p/Makefile.include b/cpu/efm32/families/efr32mg12p/Makefile.include index ade161eb6944..d085d2df8053 100644 --- a/cpu/efm32/families/efr32mg12p/Makefile.include +++ b/cpu/efm32/families/efr32mg12p/Makefile.include @@ -3,5 +3,10 @@ # as easy as adding the header file only. EFM32_HEADER = $(wildcard $(RIOTCPU)/efm32/families/efr32mg12p/include/vendor/$(CPU_MODEL).h) +# Names of librail related files +EFM32_LIBRAIL_BLOB_NAME = efr32xg12 +EFM32_LIBRAIL_HEADER_NAME = efr32xg1x +EFM32_LIBRAIL_PA_HEADER_NAME = efr32xg1x + # include vendor device headers -INCLUDES += -I$(RIOTCPU)/efm32/families/efr32mg12p/include/vendor \ No newline at end of file +INCLUDES += -I$(RIOTCPU)/efm32/families/efr32mg12p/include/vendor diff --git a/cpu/efm32/families/efr32mg1b/Kconfig b/cpu/efm32/families/efr32mg1b/Kconfig index 1d63ae4d0f0c..487e13ac3a19 100644 --- a/cpu/efm32/families/efr32mg1b/Kconfig +++ b/cpu/efm32/families/efr32mg1b/Kconfig @@ -10,6 +10,7 @@ config CPU_FAM_EFR32MG1B select CPU_COMMON_EFM32 select CPU_EFM32_SERIES1 select HAS_CORTEXM_MPU + select HAS_GECKO_SDK_LIBRAIL_NONFPU config MODULE_CPU_EFR32MG1B bool diff --git a/cpu/efm32/families/efr32mg1b/Makefile.features b/cpu/efm32/families/efr32mg1b/Makefile.features new file mode 100644 index 000000000000..71876a3dbacf --- /dev/null +++ b/cpu/efm32/families/efr32mg1b/Makefile.features @@ -0,0 +1 @@ +FEATURES_PROVIDED += gecko_sdk_librail_nonfpu diff --git a/cpu/efm32/families/efr32mg1b/Makefile.include b/cpu/efm32/families/efr32mg1b/Makefile.include index 46e4f96e1a75..c9b68f6a4def 100644 --- a/cpu/efm32/families/efr32mg1b/Makefile.include +++ b/cpu/efm32/families/efr32mg1b/Makefile.include @@ -3,5 +3,10 @@ # as easy as adding the header file only. EFM32_HEADER = $(wildcard $(RIOTCPU)/efm32/families/efr32mg1b/include/vendor/$(CPU_MODEL).h) +# Names of librail related files +EFM32_LIBRAIL_BLOB_NAME = efr32xg1 +EFM32_LIBRAIL_HEADER_NAME = efr32xg1x +EFM32_LIBRAIL_PA_HEADER_NAME = efr32xg1x + # include vendor device headers -INCLUDES += -I$(RIOTCPU)/efm32/families/efr32mg1b/include/vendor \ No newline at end of file +INCLUDES += -I$(RIOTCPU)/efm32/families/efr32mg1b/include/vendor diff --git a/cpu/efm32/families/efr32mg1p/Kconfig b/cpu/efm32/families/efr32mg1p/Kconfig index 012f273a6811..ba15ebb333b3 100644 --- a/cpu/efm32/families/efr32mg1p/Kconfig +++ b/cpu/efm32/families/efr32mg1p/Kconfig @@ -10,6 +10,7 @@ config CPU_FAM_EFR32MG1P select CPU_COMMON_EFM32 select CPU_EFM32_SERIES1 select HAS_CORTEXM_MPU + select HAS_GECKO_SDK_LIBRAIL_NONFPU config MODULE_CPU_EFR32MG1P bool diff --git a/cpu/efm32/families/efr32mg1p/Makefile.features b/cpu/efm32/families/efr32mg1p/Makefile.features new file mode 100644 index 000000000000..71876a3dbacf --- /dev/null +++ b/cpu/efm32/families/efr32mg1p/Makefile.features @@ -0,0 +1 @@ +FEATURES_PROVIDED += gecko_sdk_librail_nonfpu diff --git a/cpu/efm32/families/efr32mg1p/Makefile.include b/cpu/efm32/families/efr32mg1p/Makefile.include index 0902f16be320..f3917c84b0cb 100644 --- a/cpu/efm32/families/efr32mg1p/Makefile.include +++ b/cpu/efm32/families/efr32mg1p/Makefile.include @@ -3,5 +3,10 @@ # as easy as adding the header file only. EFM32_HEADER = $(wildcard $(RIOTCPU)/efm32/families/efr32mg1p/include/vendor/$(CPU_MODEL).h) +# Names of librail related files +EFM32_LIBRAIL_BLOB_NAME = efr32xg1 +EFM32_LIBRAIL_HEADER_NAME = efr32xg1x +EFM32_LIBRAIL_PA_HEADER_NAME = efr32xg1x + # include vendor device headers INCLUDES += -I$(RIOTCPU)/efm32/families/efr32mg1p/include/vendor From f3d177348304b85687ee6f9cdccb17962d40446d Mon Sep 17 00:00:00 2001 From: Jue Date: Sat, 15 Oct 2022 15:39:21 +0200 Subject: [PATCH 4/4] cpu/efm32/gpio: fix deprecated GPIO_IntConfig() call --- cpu/efm32/periph/gpio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpu/efm32/periph/gpio.c b/cpu/efm32/periph/gpio.c index af1f99e10ee6..8cd492ed55ea 100644 --- a/cpu/efm32/periph/gpio.c +++ b/cpu/efm32/periph/gpio.c @@ -122,8 +122,8 @@ int gpio_init_int(gpio_t pin, gpio_mode_t mode, gpio_flank_t flank, isr_ctx[_pin_num(pin)].arg = arg; /* enable interrupts */ - GPIO_IntConfig(_port_num(pin), _pin_num(pin), - flank & GPIO_RISING, flank & GPIO_FALLING, true); + GPIO_ExtIntConfig(_port_num(pin), _pin_num(pin), _pin_num(pin), + flank & GPIO_RISING, flank & GPIO_FALLING, true); NVIC_ClearPendingIRQ(GPIO_EVEN_IRQn); NVIC_ClearPendingIRQ(GPIO_ODD_IRQn);