From c3dea1b9fd0c50cf05f25de695b4cd3ff7f356ae Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Fri, 15 Jan 2021 11:41:05 +0100 Subject: [PATCH] software: Use "%p" to format pointer values To fix compiler warnings of the following type: warning: format '%x' expects argument of type 'unsigned int', but argument 2 has type 'foo *' [-Wformat=] Signed-off-by: Geert Uytterhoeven --- litex/soc/software/bios/boot.c | 2 +- litex/soc/software/libbase/memtest.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/litex/soc/software/bios/boot.c b/litex/soc/software/bios/boot.c index 34d10fcab..bb565fd65 100644 --- a/litex/soc/software/bios/boot.c +++ b/litex/soc/software/bios/boot.c @@ -273,7 +273,7 @@ static int copy_file_from_tftp_to_ram(unsigned int ip, unsigned short server_por const char *filename, char *buffer) { int size; - printf("Copying %s to 0x%08x... ", filename, buffer); + printf("Copying %s to %p... ", filename, buffer); size = tftp_get(ip, server_port, filename, buffer); if(size > 0) printf("(%d bytes)", size); diff --git a/litex/soc/software/libbase/memtest.c b/litex/soc/software/libbase/memtest.c index d6f112614..ae604fe9e 100644 --- a/litex/soc/software/libbase/memtest.c +++ b/litex/soc/software/libbase/memtest.c @@ -53,7 +53,7 @@ int memtest_access(unsigned int *addr) array[0] = ZEROONE; array[1] = array[0]; if (ctrl_bus_errors_read() - bus_errors) { - printf("memtest_access error @ 0x%0x, exiting memtest.\n", addr); + printf("memtest_access error @ %p, exiting memtest.\n", addr); return 1; } @@ -83,7 +83,7 @@ int memtest_bus(unsigned int *addr, unsigned long size) if(rdata != ONEZERO) { errors++; #ifdef MEMTEST_BUS_DEBUG - printf("memtest_bus error @ 0x%0x: 0x%08x vs 0x%08x\n", addr + i, rdata, ONEZERO); + printf("memtest_bus error @ %p: 0x%08x vs 0x%08x\n", addr + i, rdata, ONEZERO); #endif } } @@ -103,7 +103,7 @@ int memtest_bus(unsigned int *addr, unsigned long size) if(rdata != ZEROONE) { errors++; #ifdef MEMTEST_BUS_DEBUG - printf("memtest_bus error @ 0x%0x:: 0x%08x vs 0x%08x\n", addr + i, rdata, ZEROONE); + printf("memtest_bus error @ %p:: 0x%08x vs 0x%08x\n", addr + i, rdata, ZEROONE); #endif } } @@ -139,7 +139,7 @@ int memtest_addr(unsigned int *addr, unsigned long size, int random) if(rdata != i) { errors++; #ifdef MEMTEST_ADDR_DEBUG - printf("memtest_addr error @ 0x%0x: 0x%08x vs 0x%08x\n", addr + i, rdata, i); + printf("memtest_addr error @ %p: 0x%08x vs 0x%08x\n", addr + i, rdata, i); #endif } } @@ -202,7 +202,7 @@ int memtest_data(unsigned int *addr, unsigned long size, int random) if(rdata != seed_32) { errors++; #ifdef MEMTEST_DATA_DEBUG - printf("memtest_data error @%0x: 0x%08x vs 0x%08x\n", addr + i, rdata, seed_32); + printf("memtest_data error @%p: 0x%08x vs 0x%08x\n", addr + i, rdata, seed_32); #endif } if (i%0x8000 == 0)