From c70c178a7d5c9a3b7cc2588894764eda91bbe738 Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Wed, 15 Mar 2023 10:51:08 +0100 Subject: [PATCH] arch/nrf52: nvmc and flash should depends on ALLOW_BSD_COMPONENTS=y --- arch/arm/src/nrf52/Kconfig | 1 + arch/arm/src/nrf52/Make.defs | 13 ++++++++----- arch/arm/src/nrf52/nrf52_flash.c | 4 ++++ arch/arm/src/nrf52/nrf52_nvmc.c | 8 ++++++++ 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/arch/arm/src/nrf52/Kconfig b/arch/arm/src/nrf52/Kconfig index 30ec168f2e..500e714c20 100644 --- a/arch/arm/src/nrf52/Kconfig +++ b/arch/arm/src/nrf52/Kconfig @@ -385,6 +385,7 @@ config NRF52_FLASH_PREFETCH config NRF52_PROGMEM bool "FLASH program memory" + depends on ALLOW_BSD_COMPONENTS default n select ARCH_HAVE_PROGMEM ---help--- diff --git a/arch/arm/src/nrf52/Make.defs b/arch/arm/src/nrf52/Make.defs index 3b9d15549b..e2acfb0482 100644 --- a/arch/arm/src/nrf52/Make.defs +++ b/arch/arm/src/nrf52/Make.defs @@ -29,9 +29,16 @@ endif endif CHIP_CSRCS += nrf52_start.c nrf52_clockconfig.c nrf52_irq.c nrf52_utils.c -CHIP_CSRCS += nrf52_allocateheap.c nrf52_lowputc.c nrf52_gpio.c nrf52_nvmc.c +CHIP_CSRCS += nrf52_allocateheap.c nrf52_lowputc.c nrf52_gpio.c CHIP_CSRCS += nrf52_uid.c +ifeq ($(CONFIG_ALLOW_BSD_COMPONENTS),y) +CHIP_CSRCS += nrf52_nvmc.c +ifeq ($(CONFIG_NRF52_PROGMEM),y) +CHIP_CSRCS += nrf52_flash.c +endif +endif + ifeq ($(CONFIG_ARCH_CHIP_NRF52832),y) CHIP_CSRCS += nrf52832_errdata.c endif @@ -52,10 +59,6 @@ ifeq ($(CONFIG_NRF52_UART),y) CHIP_CSRCS += nrf52_serial.c endif -ifeq ($(CONFIG_NRF52_PROGMEM),y) -CHIP_CSRCS += nrf52_flash.c -endif - ifeq ($(CONFIG_NRF52_WDT),y) CHIP_CSRCS += nrf52_wdt.c diff --git a/arch/arm/src/nrf52/nrf52_flash.c b/arch/arm/src/nrf52/nrf52_flash.c index e8f6ef3127..4896f5194d 100644 --- a/arch/arm/src/nrf52/nrf52_flash.c +++ b/arch/arm/src/nrf52/nrf52_flash.c @@ -61,6 +61,10 @@ * Pre-processor Definitions ****************************************************************************/ +#ifndef CONFIG_ALLOW_BSD_COMPONENTS +# error "This file requires Kconfig ALLOW_BSD_COMPONENTS" +#endif + #define NRF52_FLASH_PAGE_SIZE (4*1024) #define NRF52_FLASH_ERASEDVAL (0xffu) diff --git a/arch/arm/src/nrf52/nrf52_nvmc.c b/arch/arm/src/nrf52/nrf52_nvmc.c index 1e111c4d03..ae3b15ebcb 100644 --- a/arch/arm/src/nrf52/nrf52_nvmc.c +++ b/arch/arm/src/nrf52/nrf52_nvmc.c @@ -53,6 +53,14 @@ #include "hardware/nrf52_nvmc.h" #include "nrf52_nvmc.h" +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifndef CONFIG_ALLOW_BSD_COMPONENTS +# error "This file requires Kconfig ALLOW_BSD_COMPONENTS" +#endif + /**************************************************************************** * Private Functions ****************************************************************************/