ex reading/writing to scratch register over jtagbone:
In the SoC:
self.add_jtagbone()
Open LiteX Server:
litex_server --jtag
Do the MMAP accesses:
./litex_cli --read 0x4
0x12345678
./litex_clk --write 0x4 0x5aa55aa5
./litex_cli --read 0x4
0x5aa55aa5
If the environment variable TRIPLE is defined, use its value as the
highest priority candidate. Useful for testing new cross-compilers,
or selecting among toolchains in a different priority than the built-in
list.
Now all format issues are fixed, tag all functions taking printf()-style
format specifiers with "__attribute__((format(printf, ...))", enabling
format string checks ("-Wall" includes "-Wformat").
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
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 <geert@linux-m68k.org>
To fix compiler warnings of the following type:
warning: format '%x' expects argument of type 'unsigned int', but argument has type 'long unsigned int' [-Wformat=]
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
litex/soc/software/liblitesdcard/sdcard.c: In function 'sdcard_read':
litex/soc/software/liblitesdcard/sdcard.c:476:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
sdblock2mem_dma_base_write((uint64_t) buf);
^
litex/soc/software/liblitesdcard/sdcard.c: In function 'sdcard_write':
litex/soc/software/liblitesdcard/sdcard.c:507:30: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
sdmem2block_dma_base_write((uint64_t) buf);
^
When casting a pointer (32-bit or 64-bit, depending on the platform) to
a 64-bit integer, an intermediate cast to "uintptr_t" should be used to
avoid warnings like the above.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
There is no need to use "unsigned long" for small numbers related to the
number of characters in a line. Use "unsigned int" instead.
This allows us to drop the casts when calling putnstr(), and fixes compiler
warnings on 64-bit for callsites where the casts were missing:
warning: field precision specifier '.*' expects argument of type 'int', but argument 2 has type 'long unsigned int'
Reported-by: Gabriel Somlo <gsomlo@gmail.com>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
The sizeof operator returns "size_t", which is defined to be "unsigned
int" on 32-bit, and "unsigned long" on 64-bit.
Format it using "%zu", to fix compiler warnings of the following type on
64-bit:
warning: format '%d' expects argument of type 'int', but argument has type 'long unsigned int' [-Wformat=]
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
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>
On 64-bit:
litex/soc/software/bios/boot.c: In function 'serialboot':
litex/soc/software/bios/boot.c:216:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
writepointer = (char *) get_uint32(&frame.payload[0]);
^
When casting from a 32-bit integer to a pointer (32-bit or 64-bit,
depending on the platform), an intermediate cast to "uintptr_t" should
be used to avoid warnings like the above.
Note that using a 32-bit integer is OK, even on 64-bit, as this is
specified by the boot protocol.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
To fix compiler warnings of the following type:
warning: format '%lu' expects argument of type 'long unsigned int', but argument has type 'unsigned int' [-Wformat=]
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
To fix compiler warnings of the following type:
warning: zero-length gnu_printf format string [-Wformat-zero-length]
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>