[PATCH] config: CONFIGURE_DISABLE_BSP_SETTINGS

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Nov 15 18:18:38 UTC 2021


Evaluate CONFIGURE_DISABLE_BSP_SETTINGS for each affected application
configuration option.  This makes the code easier to review since the influence
of CONFIGURE_DISABLE_BSP_SETTINGS is locally visible in the code.
---
 cpukit/include/rtems/confdefs/bsp.h        | 15 ++-------------
 cpukit/include/rtems/confdefs/extensions.h |  3 ++-
 cpukit/include/rtems/confdefs/iodrivers.h  |  3 ++-
 cpukit/include/rtems/confdefs/malloc.h     | 10 +++++++---
 cpukit/include/rtems/confdefs/percpu.h     |  9 ++++++---
 5 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/cpukit/include/rtems/confdefs/bsp.h b/cpukit/include/rtems/confdefs/bsp.h
index 03ad9bf55f..bc96713765 100644
--- a/cpukit/include/rtems/confdefs/bsp.h
+++ b/cpukit/include/rtems/confdefs/bsp.h
@@ -41,19 +41,8 @@
 #error "Do not include this file directly, use <rtems/confdefs.h> instead"
 #endif
 
-#ifdef CONFIGURE_INIT
-
-#ifdef CONFIGURE_DISABLE_BSP_SETTINGS
-  #undef BSP_IDLE_TASK_BODY
-  #undef BSP_IDLE_TASK_STACK_SIZE
-  #undef BSP_INITIAL_EXTENSION
-  #undef BSP_INTERRUPT_STACK_SIZE
-  #undef CONFIGURE_BSP_PREREQUISITE_DRIVERS
-  #undef CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK
-#else
-  #include <bsp.h>
+#if defined(CONFIGURE_INIT) && !defined(CONFIGURE_DISABLE_BSP_SETTINGS)
+#include <bsp.h>
 #endif
 
-#endif /* CONFIGURE_INIT */
-
 #endif /* _RTEMS_CONFDEFS_BSP_H */
diff --git a/cpukit/include/rtems/confdefs/extensions.h b/cpukit/include/rtems/confdefs/extensions.h
index 6492407934..118ad29484 100644
--- a/cpukit/include/rtems/confdefs/extensions.h
+++ b/cpukit/include/rtems/confdefs/extensions.h
@@ -146,7 +146,8 @@ extern "C" {
     #ifdef CONFIGURE_INITIAL_EXTENSIONS
       CONFIGURE_INITIAL_EXTENSIONS,
     #endif
-    #ifdef BSP_INITIAL_EXTENSION
+    #if !defined(CONFIGURE_DISABLE_BSP_SETTINGS) && \
+      defined(BSP_INITIAL_EXTENSION)
       BSP_INITIAL_EXTENSION
     #endif
   };
diff --git a/cpukit/include/rtems/confdefs/iodrivers.h b/cpukit/include/rtems/confdefs/iodrivers.h
index a7de77a8c3..8c102197eb 100644
--- a/cpukit/include/rtems/confdefs/iodrivers.h
+++ b/cpukit/include/rtems/confdefs/iodrivers.h
@@ -110,7 +110,8 @@ extern "C" {
 
 rtems_driver_address_table
 _IO_Driver_address_table[ CONFIGURE_MAXIMUM_DRIVERS ] = {
-  #ifdef CONFIGURE_BSP_PREREQUISITE_DRIVERS
+  #if !defined(CONFIGURE_DISABLE_BSP_SETTINGS) && \
+    defined(CONFIGURE_BSP_PREREQUISITE_DRIVERS)
     CONFIGURE_BSP_PREREQUISITE_DRIVERS,
   #endif
   #ifdef CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS
diff --git a/cpukit/include/rtems/confdefs/malloc.h b/cpukit/include/rtems/confdefs/malloc.h
index d864a98270..a8dae6e739 100644
--- a/cpukit/include/rtems/confdefs/malloc.h
+++ b/cpukit/include/rtems/confdefs/malloc.h
@@ -45,8 +45,12 @@
 
 #include <rtems/confdefs/bsp.h>
 
-#if defined(CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK) \
-  || defined(CONFIGURE_MALLOC_DIRTY)
+#if !defined(CONFIGURE_DISABLE_BSP_SETTINGS) && \
+  defined(CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK)
+#define _CONFIGURE_HEAP_EXTEND_VIA_SBRK
+#endif
+
+#if defined(_CONFIGURE_HEAP_EXTEND_VIA_SBRK) || defined(CONFIGURE_MALLOC_DIRTY)
 #include <rtems/malloc.h>
 #endif
 
@@ -54,7 +58,7 @@
 extern "C" {
 #endif
 
-#ifdef CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK
+#ifdef _CONFIGURE_HEAP_EXTEND_VIA_SBRK
 const rtems_heap_extend_handler rtems_malloc_extend_handler =
   rtems_heap_extend_via_sbrk;
 #endif
diff --git a/cpukit/include/rtems/confdefs/percpu.h b/cpukit/include/rtems/confdefs/percpu.h
index 3bea8340cb..b91590bfd9 100644
--- a/cpukit/include/rtems/confdefs/percpu.h
+++ b/cpukit/include/rtems/confdefs/percpu.h
@@ -78,7 +78,8 @@ extern "C" {
 /* Interrupt stack configuration */
 
 #ifndef CONFIGURE_INTERRUPT_STACK_SIZE
-  #ifdef BSP_INTERRUPT_STACK_SIZE
+  #if !defined(CONFIGURE_DISABLE_BSP_SETTINGS) && \
+    defined(BSP_INTERRUPT_STACK_SIZE)
     #define CONFIGURE_INTERRUPT_STACK_SIZE BSP_INTERRUPT_STACK_SIZE
   #else
     #define CONFIGURE_INTERRUPT_STACK_SIZE CPU_STACK_MINIMUM_SIZE
@@ -121,7 +122,8 @@ RTEMS_DEFINE_GLOBAL_SYMBOL(
 /* Idle thread configuration */
 
 #ifndef CONFIGURE_IDLE_TASK_STACK_SIZE
-  #ifdef BSP_IDLE_TASK_STACK_SIZE
+  #if !defined(CONFIGURE_DISABLE_BSP_SETTINGS) && \
+    defined(BSP_IDLE_TASK_STACK_SIZE)
     #define CONFIGURE_IDLE_TASK_STACK_SIZE BSP_IDLE_TASK_STACK_SIZE
   #else
     #define CONFIGURE_IDLE_TASK_STACK_SIZE CONFIGURE_MINIMUM_TASK_STACK_SIZE
@@ -153,7 +155,8 @@ const size_t _Thread_Idle_stack_size = CONFIGURE_IDLE_TASK_STACK_SIZE;
   #error "If you define CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION, then you must define CONFIGURE_IDLE_TASK_BODY as well"
 #endif
 
-#if !defined(CONFIGURE_IDLE_TASK_BODY) && defined(BSP_IDLE_TASK_BODY)
+#if !defined(CONFIGURE_IDLE_TASK_BODY) && \
+  !defined(CONFIGURE_DISABLE_BSP_SETTINGS) && defined(BSP_IDLE_TASK_BODY)
   #define CONFIGURE_IDLE_TASK_BODY BSP_IDLE_TASK_BODY
 #endif
 
-- 
2.26.2



More information about the devel mailing list