[PATCH 1/5] mips/shared/irq.c: Fix warnings

Joel Sherrill joel at rtems.org
Thu Mar 9 22:18:16 UTC 2017


---
 c/src/lib/libbsp/mips/shared/irq/irq.c             |  7 +++-
 .../lib/libbsp/mips/shared/irq/vectorexceptions.c  | 45 +++-------------------
 2 files changed, 11 insertions(+), 41 deletions(-)

diff --git a/c/src/lib/libbsp/mips/shared/irq/irq.c b/c/src/lib/libbsp/mips/shared/irq/irq.c
index 4384e9f..d494176 100644
--- a/c/src/lib/libbsp/mips/shared/irq/irq.c
+++ b/c/src/lib/libbsp/mips/shared/irq/irq.c
@@ -19,10 +19,13 @@
  */
 
 
+#include <inttypes.h>
+
 #include <bsp.h>
 #include <bsp/irq.h>
 #include <bsp/irq-generic.h>
 #include <libcpu/isr_entries.h>
+#include <rtems/bspIo.h>
 
 static const char *const cause_strings[32] = {
   /*  0 */ "Int",
@@ -88,8 +91,8 @@ void bsp_interrupt_handler_default(rtems_vector_number vector)
   mips_get_sr( sr );
   mips_get_cause( cause );
 
-  printk( "Unhandled exception %d\n", vector );
-  printk( "sr: 0x%08x  cause: 0x%08x --> %s\n", sr, cause,
+  printk( "Unhandled exception %" PRId32 "\n", vector );
+  printk( "sr: 0x%08" PRIu32 "  cause: 0x%08" PRIu32 " --> %s\n", sr, cause,
      cause_strings[(cause >> 2) &0x1f] );
   #if 0
     mips_dump_exception_frame( frame );
diff --git a/c/src/lib/libbsp/mips/shared/irq/vectorexceptions.c b/c/src/lib/libbsp/mips/shared/irq/vectorexceptions.c
index 17cdaa5..cdfd94c 100644
--- a/c/src/lib/libbsp/mips/shared/irq/vectorexceptions.c
+++ b/c/src/lib/libbsp/mips/shared/irq/vectorexceptions.c
@@ -17,6 +17,7 @@
  */
 
 #include <rtems.h>
+#include <inttypes.h>
 #include <stdlib.h>
 #include <string.h>
 #include <rtems/mips/iregdef.h>
@@ -24,42 +25,6 @@
 #include <rtems/bspIo.h>
 #include <bsp/irq-generic.h>
 
-static const char *const cause_strings[32] =
-{
-  /*  0 */ "Int",
-  /*  1 */ "TLB Mods",
-  /*  2 */ "TLB Load",
-  /*  3 */ "TLB Store",
-  /*  4 */ "Address Load",
-  /*  5 */ "Address Store",
-  /*  6 */ "Instruction Bus Error",
-  /*  7 */ "Data Bus Error",
-  /*  8 */ "Syscall",
-  /*  9 */ "Breakpoint",
-  /* 10 */ "Reserved Instruction",
-  /* 11 */ "Coprocessor Unuseable",
-  /* 12 */ "Overflow",
-  /* 13 */ "Trap",
-  /* 14 */ "Instruction Virtual Coherency Error",
-  /* 15 */ "FP Exception",
-  /* 16 */ "Reserved 16",
-  /* 17 */ "Reserved 17",
-  /* 18 */ "Reserved 18",
-  /* 19 */ "Reserved 19",
-  /* 20 */ "Reserved 20",
-  /* 21 */ "Reserved 21",
-  /* 22 */ "Reserved 22",
-  /* 23 */ "Watch",
-  /* 24 */ "Reserved 24",
-  /* 25 */ "Reserved 25",
-  /* 26 */ "Reserved 26",
-  /* 27 */ "Reserved 27",
-  /* 28 */ "Reserved 28",
-  /* 29 */ "Reserved 29",
-  /* 30 */ "Reserved 30",
-  /* 31 */ "Data Virtual Coherency Error"
-};
-
 struct regdef
 {
   int  offset;
@@ -88,10 +53,12 @@ void _CPU_Exception_frame_print( const CPU_Exception_frame *frame )
      printk("   %s", dumpregs[i].name);
      for(j=0; j< 7-strlen(dumpregs[i].name); j++) printk(" ");
 #if (__mips == 1 ) || (__mips == 32)
-     printk("  %08X%c", frame_u32[dumpregs[i].offset], (i%3) ? '\t' : '\n' );
+     printk("  %08" PRIu32 "%c",
+            frame_u32[dumpregs[i].offset], (i%3) ? '\t' : '\n' );
 #elif __mips == 3
-     printk("  %08X", frame_u32[2 * dumpregs[i].offset + 1] );
-     printk("%08X%c", frame_u32[2 * dumpregs[i].offset], (i%2) ? '\t' : '\n' );
+     printk("  %08" PRIu32 "", frame_u32[2 * dumpregs[i].offset + 1] );
+     printk("%08" PRIu32 "%c",
+            frame_u32[2 * dumpregs[i].offset], (i%2) ? '\t' : '\n' );
 #endif
   }
   printk( "\n" );
-- 
1.8.3.1



More information about the devel mailing list