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 <geert@linux-m68k.org>
This commit is contained in:
Geert Uytterhoeven 2021-01-19 11:51:29 +01:00
parent 857ef69b3f
commit cbd54e7b5c

View file

@ -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 <address> <length>");