[PATCH] libbsp ARM: create abort.h to eliminate warnings Created libbsp/arm/shared/abort/abort.h Edited abort.c and simple_abort.c to include abort.h Changed Raspberry Pi BSP to use abort.c instead of simple_abort.c

Alan Cudmore alan.cudmore at gmail.com
Mon Nov 3 01:59:25 UTC 2014


Signed-off-by: Alan Cudmore <alan.cudmore at gmail.com>
---
 c/src/lib/libbsp/arm/raspberrypi/Makefile.am     |  2 +-
 c/src/lib/libbsp/arm/shared/abort/abort.c        | 28 +-----------
 c/src/lib/libbsp/arm/shared/abort/abort.h        | 57 ++++++++++++++++++++++++
 c/src/lib/libbsp/arm/shared/abort/simple_abort.c | 22 +--------
 4 files changed, 60 insertions(+), 49 deletions(-)
 create mode 100644 c/src/lib/libbsp/arm/shared/abort/abort.h

diff --git a/c/src/lib/libbsp/arm/raspberrypi/Makefile.am b/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
index 839c8de..a606d9d 100644
--- a/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
+++ b/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
@@ -86,7 +86,7 @@ libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
 libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
 libbsp_a_SOURCES += ../../shared/sbrk.c
 libbsp_a_SOURCES += ../../shared/src/stackalloc.c
-libbsp_a_SOURCES += ../shared/abort/simple_abort.c
+libbsp_a_SOURCES += ../shared/abort/abort.c
 libbsp_a_SOURCES += ../shared/startup/bsp-start-memcpy.S
 libbsp_a_SOURCES += ../shared/arm-cp15-set-ttb-entries.c
 
diff --git a/c/src/lib/libbsp/arm/shared/abort/abort.c b/c/src/lib/libbsp/arm/shared/abort/abort.c
index d509a2a..8dc70d7 100644
--- a/c/src/lib/libbsp/arm/shared/abort/abort.c
+++ b/c/src/lib/libbsp/arm/shared/abort/abort.c
@@ -24,33 +24,7 @@
 #include <rtems.h>
 #include <rtems/bspIo.h>
 
-#define INSN_MASK         0xc5
-
-#define INSN_STM1         0x80
-#define INSN_STM2         0x84
-#define INSN_STR          0x40
-#define INSN_STRB         0x44
-
-#define INSN_LDM1         0x81
-#define INSN_LDM23        0x85
-#define INSN_LDR          0x41
-#define INSN_LDRB         0x45
-
-#define GET_RD(x)         ((x & 0x0000f000) >> 12)
-#define GET_RN(x)         ((x & 0x000f0000) >> 16)
-
-#define GET_U(x)              ((x & 0x00800000) >> 23)
-#define GET_I(x)              ((x & 0x02000000) >> 25)
-
-#define GET_REG(r, ctx)      (((uint32_t   *)ctx)[r])
-#define SET_REG(r, ctx, v)   (((uint32_t   *)ctx)[r] = v)
-#define GET_OFFSET(insn)     (insn & 0xfff)
-
-/*
- * Prototypes
- */
-void _print_full_context(uint32_t);
-void do_data_abort(uint32_t, uint32_t, Context_Control *);
+#include "abort.h"
 
 uint32_t g_data_abort_cnt = 0;
 /*this is a big overhead for MCU only got 16K RAM*/
diff --git a/c/src/lib/libbsp/arm/shared/abort/abort.h b/c/src/lib/libbsp/arm/shared/abort/abort.h
new file mode 100644
index 0000000..14feac3
--- /dev/null
+++ b/c/src/lib/libbsp/arm/shared/abort/abort.h
@@ -0,0 +1,57 @@
+/**
+ *  @file
+ *
+ *  @ingroup arm_abort
+ *
+ *  @brief ARM abort support
+ */
+
+/*
+ *  COPYRIGHT (c) 2007 Ray Xu.
+ *  mailto: Rayx at gmail dot com
+ *
+ *  COPYRIGHT (c) 2000 Canon Research Centre France SA.
+ *  Emmanuel Raguet, mailto:raguet at crf.canon.fr
+ *
+ *  Copyright (c) 2002 Advent Networks, Inc
+ *      Jay Monkman <jmonkman at adventnetworks.com>
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.org/license/LICENSE.
+ *
+ */
+
+#ifndef _BSPABORT_H
+#define _BSPABORT_H
+
+#define INSN_MASK         0xc5
+
+#define INSN_STM1         0x80
+#define INSN_STM2         0x84
+#define INSN_STR          0x40
+#define INSN_STRB         0x44
+
+#define INSN_LDM1         0x81
+#define INSN_LDM23        0x85
+#define INSN_LDR          0x41
+#define INSN_LDRB         0x45
+
+#define GET_RD(x)         ((x & 0x0000f000) >> 12)
+#define GET_RN(x)         ((x & 0x000f0000) >> 16)
+
+#define GET_U(x)          ((x & 0x00800000) >> 23)
+#define GET_I(x)          ((x & 0x02000000) >> 25)
+
+#define GET_REG(r, ctx)      (((uint32_t   *)ctx)[r])
+#define SET_REG(r, ctx, v)   (((uint32_t   *)ctx)[r] = v)
+#define GET_OFFSET(insn)     (insn & 0xfff)
+
+/*
+ * Prototypes
+ */
+void _print_full_context(uint32_t);
+void do_data_abort(uint32_t, uint32_t, Context_Control *);
+
+#endif  /* _BSPABORT_H_ */
+
diff --git a/c/src/lib/libbsp/arm/shared/abort/simple_abort.c b/c/src/lib/libbsp/arm/shared/abort/simple_abort.c
index 51854bd..57f9a02 100644
--- a/c/src/lib/libbsp/arm/shared/abort/simple_abort.c
+++ b/c/src/lib/libbsp/arm/shared/abort/simple_abort.c
@@ -21,27 +21,7 @@
 #include <rtems.h>
 #include <rtems/bspIo.h>
 
-#define INSN_MASK         0xc5
-
-#define INSN_STM1         0x80
-#define INSN_STM2         0x84
-#define INSN_STR          0x40
-#define INSN_STRB         0x44
-
-#define INSN_LDM1         0x81
-#define INSN_LDM23        0x85
-#define INSN_LDR          0x41
-#define INSN_LDRB         0x45
-
-#define GET_RD(x)         ((x & 0x0000f000) >> 12)
-#define GET_RN(x)         ((x & 0x000f0000) >> 16)
-
-#define GET_U(x)              ((x & 0x00800000) >> 23)
-#define GET_I(x)              ((x & 0x02000000) >> 25)
-
-#define GET_REG(r, ctx)      (((uint32_t   *)ctx)[r])
-#define SET_REG(r, ctx, v)   (((uint32_t   *)ctx)[r] = v)
-#define GET_OFFSET(insn)     (insn & 0xfff)
+#include "abort.h"
 
 char *_print_full_context_mode2txt[0x10]={
   [0x0]="user",  /* User */
-- 
2.1.0



More information about the devel mailing list