From cbd54e7b5cd5bd1b52a0d9613ffee188ef090216 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Tue, 19 Jan 2021 11:51:29 +0100 Subject: [PATCH] software/bios/cmds/cmd_bios: Make crc command 64-bit clean On 64-bit: litex/soc/software/bios/cmds/cmd_bios.c: In function 'crc_handler': litex/soc/software/bios/cmds/cmd_bios.c:110:30: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] printf("CRC32: %08x", crc32((unsigned char *)addr, length)); ^ Fix this by using the appropriate types (uintptr_t and size_t) for memory addresses and sizes, which are defined to 32-bit or 64-bit, depending on the platform. Note that the specified length must still be smaller than 4 GiB on 64-bit, or it will be truncated, as the crc32() function is currently limited to a 32-bit size anyway. Signed-off-by: Geert Uytterhoeven --- litex/soc/software/bios/cmds/cmd_bios.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/litex/soc/software/bios/cmds/cmd_bios.c b/litex/soc/software/bios/cmds/cmd_bios.c index 2163a7e2a..873468db2 100644 --- a/litex/soc/software/bios/cmds/cmd_bios.c +++ b/litex/soc/software/bios/cmds/cmd_bios.c @@ -87,8 +87,8 @@ define_command(uptime, uptime_handler, "Uptime of the system since power-up", SY static void crc_handler(int nb_params, char **params) { char *c; - unsigned int addr; - unsigned int length; + uintptr_t addr; + size_t length; if (nb_params < 2) { printf("crc
");