aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2022-11-30 15:18:02 +0100
committerPeter Maydell <peter.maydell@linaro.org>2022-12-16 13:45:54 +0000
commit046f3b65d62681a4c5d72e32b8906f3415c2f22b (patch)
tree2d5ea63ae271a5caa3b6e9350c51bcf4849aa284
parent9c7daeff8bf4779710e61dfd060e99b7ea19b564 (diff)
tests: Fix format string using PRIx32 definition
test7.c: In function 'svc': test7.c:105:29: error: format '%x' expects argument of type 'unsigned int', but argument 2 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=] 105 | testDiag("New xPSR %x", sframe[7]); | ~^ ~~~~~~~~~ | | | | | uint32_t {aka long unsigned int} | unsigned int | %lx Using gcc version 12.2.0 (Arm GNU Toolchain 12.2.MPACBTI-Bet1 (Build arm-12-mpacbti.16)) Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--test11-buserr.c5
-rw-r--r--test7.c14
-rw-r--r--test8.c7
3 files changed, 16 insertions, 10 deletions
diff --git a/test11-buserr.c b/test11-buserr.c
index f848dce..dcc60dd 100644
--- a/test11-buserr.c
+++ b/test11-buserr.c
@@ -1,5 +1,6 @@
/* See how various faults are reported and recovered
*/
+#include <inttypes.h>
#include "armv7m.h"
#include "testme.h"
@@ -116,7 +117,7 @@ void bus(uint32_t *sp)
out32(SCB(0xd38), 0);
if(sts&0x8000) {
- testDiag("BFARVALID set, BFAR is 0x%x", addr);
+ testDiag("BFARVALID set, BFAR is 0x%"PRIx32, addr);
far = addr;
}
@@ -155,7 +156,7 @@ void mem(uint32_t *sp)
out32(SCB(0xd28), 0xff); /* W1C */
if (sts&0x80) {
- testDiag("MMARVALID set, MMFAR is 0x%x", addr);
+ testDiag("MMARVALID set, MMFAR is 0x%"PRIx32, addr);
far = addr;
}
diff --git a/test7.c b/test7.c
index fdbd46c..76f0cf0 100644
--- a/test7.c
+++ b/test7.c
@@ -1,5 +1,6 @@
/* Test exception return integrity checks.
*/
+#include <inttypes.h>
#include "armv7m.h"
#include "testme.h"
@@ -55,7 +56,8 @@ uint32_t usage(uint32_t old_lr, uint32_t *sframe)
case 5:
testDiag("In UsageFault handler, checking we got INVPC fault");
test_equal("CFSR", 0x040000, cfsr);
- testDiag("Ignoring bogus LR %x, doing return to handler", old_lr);
+ testDiag("Ignoring bogus LR %"PRIx32", doing return to handler",
+ old_lr);
return 0xfffffff1;
break;
case 9:
@@ -73,7 +75,8 @@ uint32_t usage(uint32_t old_lr, uint32_t *sframe)
case 0x11:
testDiag("In UsageFault handler, checking we got INVPC fault");
test_equal("CFSR", 0x040000, cfsr);
- testDiag("Ignoring bogus LR %x, doing return to thread", old_lr);
+ testDiag("Ignoring bogus LR %"PRIx32", doing return to thread",
+ old_lr);
return 0xfffffff9;
break;
default:
@@ -102,18 +105,19 @@ uint32_t svc(uint32_t old_lr, uint32_t *sframe)
case 8:
testDiag("In SVC handler, writing non-0 to xPSR.exception in sframe");
sframe[7] |= 0x3;
- testDiag("New xPSR %x", sframe[7]);
+ testDiag("New xPSR %"PRIx32, sframe[7]);
break;
case 0xc:
testDiag("In SVC handler, writing 0 to xPSR.exception in sframe");
- testDiag("old xPSR %x", sframe[7]);
+ testDiag("old xPSR %"PRIx32, sframe[7]);
sframe[7] &= ~0x1ff;
break;
case 0x10:
testDiag("In SVC handler, attempting return with reserved value");
return 0xfffffff0;
case 0x13:
- testDiag("In SVC handler (direct call from main with LR %x)", old_lr);
+ testDiag("In SVC handler (direct call from main with LR %"PRIx32")",
+ old_lr);
saved_real_lr = old_lr;
return 0xfffffff9;
default:
diff --git a/test8.c b/test8.c
index 9f5ce63..937060a 100644
--- a/test8.c
+++ b/test8.c
@@ -1,5 +1,6 @@
/* Test MPU
*/
+#include <inttypes.h>
#include "armv7m.h"
#include "testme.h"
@@ -18,9 +19,9 @@ static
void try(volatile char *p)
{
uint32_t tval = 0;
- testDiag("Try %x", (uint32_t)p);
+ testDiag("Try %"PRIx32, (uint32_t)p);
__asm__ ("mov %r0, #'X'; ldr %r0, [%r1]" : "+r"(tval) : "r"(p) :);
- testDiag("Got %x", tval);
+ testDiag("Got %"PRIx32, tval);
}
#define EXPECT_NO_FAULT 1
@@ -100,7 +101,7 @@ void mem(uint32_t *sp)
sp = get_src_stack(sp);
inst_skip(sp);
addr = in32((void*)0xe000ed34);
- testDiag("In MemFault, Addr 0x%x, from 0x%x", addr, sp[6]);
+ testDiag("In MemFault, Addr 0x%"PRIx32", from 0x%"PRIx32, addr, sp[6]);
switch(expect_fault) {
case EXPECT_MEMFAULT: