[PATCH 6/7] bsps: Remove uses of BSP_GET_WORK_AREA_DEBUG

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Dec 16 12:42:11 UTC 2019


The code covered by BSP_GET_WORK_AREA_DEBUG was basically dead code
since there was no normal way to activate it (e.g. via a BSP
configuration option).  BSP developers should use a debugger instead.
If this output via printk() turns out to be still wanted by users, it
can be added as an application configuration option, e.g.
CONFIGURE_ENABLE_VERBOSE_MEMORY_INITIALIZATION.

Update #3838.
---
 bsps/arm/gdbarmsim/include/bsp.h         |  2 --
 bsps/include/bsp/bootcard.h              | 35 --------------------------------
 bsps/sparc/shared/start/bspgetworkarea.c | 28 -------------------------
 3 files changed, 65 deletions(-)

diff --git a/bsps/arm/gdbarmsim/include/bsp.h b/bsps/arm/gdbarmsim/include/bsp.h
index b880cd793a..d70be07373 100644
--- a/bsps/arm/gdbarmsim/include/bsp.h
+++ b/bsps/arm/gdbarmsim/include/bsp.h
@@ -39,8 +39,6 @@
 extern "C" {
 #endif
 
-//#define BSP_GET_WORK_AREA_DEBUG 1
-
 /**
  * @brief Support for simulated clock tick
  */
diff --git a/bsps/include/bsp/bootcard.h b/bsps/include/bsp/bootcard.h
index 02feaa47e8..6121ff9ba1 100644
--- a/bsps/include/bsp/bootcard.h
+++ b/bsps/include/bsp/bootcard.h
@@ -115,42 +115,7 @@ static inline void bsp_work_area_initialize_default(
     }
   #endif
 
-  /*
-   *  The following may be helpful in debugging what goes wrong when
-   *  you are allocating the Work Area in a new BSP.
-   */
-  #ifdef BSP_GET_WORK_AREA_DEBUG
-    {
-      void *sp = __builtin_frame_address(0);
-      void *end = (char *) area.begin + area.size;
-      printk(
-        "work_area_start = 0x%p\n"
-        "work_area_size = %lu 0x%08lx\n"
-        "end = 0x%p\n"
-        "current stack pointer = 0x%p%s\n",
-        area.begin,
-        (unsigned long) area.size,  /* decimal */
-        (unsigned long) area.size,  /* hexadecimal */
-        end,
-        sp,
-        (uintptr_t) sp >= (uintptr_t) area.begin
-          && (uintptr_t) sp <= (uintptr_t) end ?
-            " OVERLAPS!" : ""
-      );
-    }
-  #endif
-
   _Workspace_Handler_initialization(&area, 1, NULL);
-
-  #ifdef BSP_GET_WORK_AREA_DEBUG
-    printk(
-      "heap_start = 0x%p\n"
-      "heap_size = %lu\n",
-      area.begin,
-      (unsigned long) area.size
-    );
-  #endif
-
   RTEMS_Malloc_Initialize(&area, 1, NULL);
 }
 
diff --git a/bsps/sparc/shared/start/bspgetworkarea.c b/bsps/sparc/shared/start/bspgetworkarea.c
index 512d223211..8e097c8ec9 100644
--- a/bsps/sparc/shared/start/bspgetworkarea.c
+++ b/bsps/sparc/shared/start/bspgetworkarea.c
@@ -10,12 +10,8 @@
  *  http://www.rtems.org/license/LICENSE.
  */
 
-/* #define BSP_GET_WORK_AREA_DEBUG */
 #include <bsp.h>
 #include <bsp/bootcard.h>
-#ifdef BSP_GET_WORK_AREA_DEBUG
-  #include <rtems/bspIo.h>
-#endif
 
 /* Tells us where to put the workspace in case remote debugger is present.  */
 extern uint32_t rdb_start;
@@ -31,29 +27,5 @@ void bsp_work_area_initialize(void)
   void *work_area_start = (void *)&end;
   uintptr_t work_area_size = (uintptr_t)rdb_start - (uintptr_t)work_area_start;
 
-  /*
-   *  The following may be helpful in debugging what goes wrong when
-   *  you are allocating the Work Area in a new BSP.
-   */
-  #ifdef BSP_GET_WORK_AREA_DEBUG
-    {
-      void *sp = __builtin_frame_address(0);
-      void *end = *work_area_start + *work_area_size;
-      printk(
-        "work_area_start = 0x%p\n"
-        "work_area_size = %d 0x%08x\n"
-        "end = 0x%p\n"
-        "current stack pointer = 0x%p%s\n",
-        work_area_start,
-        work_area_size,  /* decimal */
-        work_area_size,  /* hexadecimal */
-        end,
-        sp,
-        ((sp >= *work_area_start && sp <= end) ? " OVERLAPS!" : "")
-     );
-     printk( "rdb_start = 0x%08x\n", rdb_start );
-   }
- #endif
-
   bsp_work_area_initialize_default(work_area_start, work_area_size);
 }
-- 
2.16.4



More information about the devel mailing list