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>
Set the PRINTF_SPECIAL flag when printing pointers, so they are prefixed
by "0x", to match glibc behavior.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
As per convention, the types of size_t, ptrdiff_t, intptr_t, and
uintptr_t should be based on "long" or "int" depending on the platform
(32-bit or 64-bit).
This fixes compiler warnings of the following type:
litex/soc/software/liblitesdcard/sdcard.c: In function 'sdcard_read':
litex/soc/software/liblitesdcard/sdcard.c:476:39: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
sdblock2mem_dma_base_write((uint64_t)(uintptr_t) buf);
^
Reported-by: Gabriel Somlo <gsomlo@gmail.com>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
The value of ULONG_MAX should depend on the size of "long".
While at it:
- Add missing "UL" and "U" suffixes to large unsigned values,
- Make INT_MIN and SHRT_MIN explicitly negative,
- Use decimal instead of hexadecimal values, for easier comparison
with /usr/include/limits.h.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
__WORDSIZE is defined by glibc, not by the compiler. Hence it is never
defined for us, and checking __WORDSIZE to determine the size of "long"
thus causes subtle misbehavings.
Fix this by checking for the presence of __LP64__ instead.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
It's probably better not mixing uploading/flashing utilities. Flashing should be
done with the proper bootloader (as we are doing on Fomu/OrangeCrab for example).
Keeping board definition files directly in LiteX is no longer useful since we are already relying on board
definitions files from LiteX-Boards (https://github.com/litex-hub/litex-boards) in various benches/projects
and having definitions files directly in LiteX creates confusion/additional work.
For projects using board definition files from LiteX, the litex.boards import can just be replaced with litex_boards:
from litex.boards.platforms import kc705
from litex_boards.platforms import kc705
- shorten args description.
- avoid mixing initrd_start/initrd_start_offset: just use initrd_start and indicate it's relative.
- others minor cleanups.
This is needed as my initrd size is much larger than the default 8mb.
Also, sometimes the kernel I build is also large, so its good to be
able to move the initrd starting position.
Issue #748
This is useful to know the memory regions available and use the mem_xy commands
on them:
List the memory regions:
litex> mem_list
Available memory regions:
ROM 0x00000000 0x8000
SRAM 0x01000000 0x2000
MAIN_RAM 0x40000000 0x10000000
CSR 0x82000000 0x10000
Test 0x1000 bytes of MAIN_RAM:
litex> mem_test 0x40000000 0x1000
Memtest at 0x40000000 (4KiB)...
Write: 0x40000000-0x40001000 4KiB
Read: 0x40000000-0x40001000 4KiB
Memtest OK
Test speed on 0x1000 bytes of MAIN_RAM:
litex> mem_speed 0x40000000 0x1000
Memspeed at 0x40000000 (4KiB)...
Write speed: 352KiB/s
Read speed: 288KiB/s
My thought is that if we are running linux the FPGA should be able to
handle these extra instruction's footprint. Also, since we are running
on linux there may be any kind of software running on the CPU, so allow
handling these instructions.
FPU is added bia a new +fpu extension.
But really, I am running GLIBC tests and they run faster with this
enabled.