mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
Merge pull request #776 from geertu/compiler-warning-fixes
Compiler warning fixes
This commit is contained in:
commit
f22079dc94
20 changed files with 66 additions and 55 deletions
|
@ -50,7 +50,7 @@ extern void boot_helper(unsigned long r1, unsigned long r2, unsigned long r3, un
|
|||
|
||||
static void __attribute__((noreturn)) boot(unsigned long r1, unsigned long r2, unsigned long r3, unsigned long addr)
|
||||
{
|
||||
printf("Executing booted program at 0x%08x\n\n", addr);
|
||||
printf("Executing booted program at 0x%08lx\n\n", addr);
|
||||
printf("--============= \e[1mLiftoff!\e[0m ===============--\n");
|
||||
uart_sync();
|
||||
#ifdef CONFIG_CPU_HAS_INTERRUPT
|
||||
|
@ -216,7 +216,7 @@ int serialboot(void)
|
|||
char *writepointer;
|
||||
|
||||
failed = 0;
|
||||
writepointer = (char *) get_uint32(&frame.payload[0]);
|
||||
writepointer = (char *)(uintptr_t) get_uint32(&frame.payload[0]);
|
||||
for(i=4;i<frame.payload_length;i++)
|
||||
*(writepointer++) = frame.payload[i];
|
||||
if (frame.cmd == SFL_CMD_LOAD)
|
||||
|
@ -277,7 +277,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);
|
||||
|
@ -432,7 +432,7 @@ static int copy_image_from_flash_to_ram(unsigned int flash_address, unsigned lon
|
|||
|
||||
length = check_image_in_flash(flash_address);
|
||||
if(length > 0) {
|
||||
printf("Copying 0x%08x to 0x%08x (%d bytes)...\n", flash_address, ram_address, length);
|
||||
printf("Copying 0x%08x to 0x%08lx (%d bytes)...\n", flash_address, ram_address, length);
|
||||
offset = 0;
|
||||
init_progression_bar(length);
|
||||
while (length > 0) {
|
||||
|
@ -504,7 +504,7 @@ static int copy_file_from_sdcard_to_ram(const char * filename, unsigned long ram
|
|||
}
|
||||
|
||||
length = f_size(&file);
|
||||
printf("Copying %s to 0x%08x (%d bytes)...\n", filename, ram_address, length);
|
||||
printf("Copying %s to 0x%08lx (%d bytes)...\n", filename, ram_address, length);
|
||||
init_progression_bar(length);
|
||||
offset = 0;
|
||||
for (;;) {
|
||||
|
@ -679,7 +679,7 @@ static int copy_file_from_sata_to_ram(const char * filename, unsigned long ram_a
|
|||
}
|
||||
|
||||
length = f_size(&file);
|
||||
printf("Copying %s to 0x%08x (%d bytes)...\n", filename, ram_address, length);
|
||||
printf("Copying %s to 0x%08lx (%d bytes)...\n", filename, ram_address, length);
|
||||
init_progression_bar(length);
|
||||
offset = 0;
|
||||
for (;;) {
|
||||
|
|
|
@ -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>");
|
||||
|
|
|
@ -40,7 +40,7 @@ static void i2c_write_handler(int nb_params, char **params)
|
|||
}
|
||||
|
||||
if (nb_params - 1 > sizeof(write_params)) {
|
||||
printf("Max data length is %d", sizeof(write_params));
|
||||
printf("Max data length is %zu", sizeof(write_params));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ static void i2c_read_handler(int nb_params, char **params)
|
|||
return;
|
||||
}
|
||||
if (len > sizeof(buf)) {
|
||||
printf("Max data count is %d", sizeof(buf));
|
||||
printf("Max data count is %zu", sizeof(buf));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ void dump_bytes(unsigned int *ptr, int count, unsigned long addr)
|
|||
(count > NUMBER_OF_BYTES_ON_A_LINE)?
|
||||
NUMBER_OF_BYTES_ON_A_LINE : count;
|
||||
|
||||
printf("\n0x%08x ", addr);
|
||||
printf("\n0x%08lx ", addr);
|
||||
for (i = 0; i < line_bytes; i++)
|
||||
printf("%02x ", *(unsigned char *)(data+i));
|
||||
|
||||
|
|
|
@ -150,10 +150,10 @@ void hist_init(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
static void cread_add_char(char ichar, int insert, unsigned long *num,
|
||||
unsigned long *eol_num, char *buf, unsigned long len)
|
||||
static void cread_add_char(char ichar, int insert, unsigned int *num,
|
||||
unsigned int *eol_num, char *buf, unsigned int len)
|
||||
{
|
||||
unsigned long wlen;
|
||||
unsigned int wlen;
|
||||
|
||||
if (insert || *num == *eol_num) {
|
||||
if (*eol_num > len - 1) {
|
||||
|
@ -186,9 +186,9 @@ static void cread_add_char(char ichar, int insert, unsigned long *num,
|
|||
|
||||
int readline(char *buf, int len)
|
||||
{
|
||||
unsigned long num = 0;
|
||||
unsigned long eol_num = 0;
|
||||
unsigned long wlen;
|
||||
unsigned int num = 0;
|
||||
unsigned int eol_num = 0;
|
||||
unsigned int wlen;
|
||||
int insert = 1;
|
||||
char ichar;
|
||||
|
||||
|
@ -254,7 +254,7 @@ int readline(char *buf, int len)
|
|||
wlen = eol_num - num - 1;
|
||||
if (wlen) {
|
||||
memmove(&buf[num], &buf[num+1], wlen);
|
||||
putnstr(buf + num, (int)wlen);
|
||||
putnstr(buf + num, wlen);
|
||||
}
|
||||
|
||||
getcmd_putch(' ');
|
||||
|
@ -286,7 +286,7 @@ int readline(char *buf, int len)
|
|||
num--;
|
||||
memmove(buf + num, buf + num + 1, wlen);
|
||||
getcmd_putch(CTL_BACKSPACE);
|
||||
putnstr(buf + num, (int)wlen);
|
||||
putnstr(buf + num, wlen);
|
||||
getcmd_putch(' ');
|
||||
do {
|
||||
getcmd_putch(CTL_BACKSPACE);
|
||||
|
@ -298,7 +298,7 @@ int readline(char *buf, int len)
|
|||
if (num < eol_num) {
|
||||
wlen = eol_num - num;
|
||||
memmove(buf + num, buf + num + 1, wlen);
|
||||
putnstr(buf + num, (int)(wlen - 1));
|
||||
putnstr(buf + num, wlen - 1);
|
||||
getcmd_putch(' ');
|
||||
do {
|
||||
getcmd_putch(CTL_BACKSPACE);
|
||||
|
|
|
@ -72,7 +72,7 @@ struct esc_cmds {
|
|||
#define REFRESH_TO_EOL() { \
|
||||
if (num < eol_num) { \
|
||||
wlen = eol_num - num; \
|
||||
putnstr(buf + num, (int)wlen); \
|
||||
putnstr(buf + num, wlen); \
|
||||
num = eol_num; \
|
||||
} \
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
# if __WORDSIZE == 64
|
||||
# ifdef __LP64__
|
||||
# define __PRI64_PREFIX "l"
|
||||
# define __PRIPTR_PREFIX "l"
|
||||
# else
|
||||
|
|
|
@ -65,7 +65,7 @@ static inline unsigned long lfsr(unsigned long bits, unsigned long prev)
|
|||
0x20000029,
|
||||
0x48000000,
|
||||
0x80200003,
|
||||
#if __WORDSIZE == 64
|
||||
#ifdef __LP64__
|
||||
0x100080000,
|
||||
0x204000003,
|
||||
0x500000000,
|
||||
|
|
|
@ -5,17 +5,21 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ULONG_MAX 0xffffffff
|
||||
#ifdef __LP64__
|
||||
#define ULONG_MAX 18446744073709551615UL
|
||||
#else
|
||||
#define ULONG_MAX 4294967295UL
|
||||
#endif
|
||||
|
||||
#define UINT_MAX 0xffffffff
|
||||
#define INT_MIN 0x80000000
|
||||
#define INT_MAX 0x7fffffff
|
||||
#define UINT_MAX 4294967295U
|
||||
#define INT_MIN (-INT_MAX - 1)
|
||||
#define INT_MAX 2147483647
|
||||
|
||||
#define USHRT_MAX 0xffff
|
||||
#define SHRT_MIN 0x8000
|
||||
#define SHRT_MAX 0x7fff
|
||||
#define USHRT_MAX 65535
|
||||
#define SHRT_MIN (-32768)
|
||||
#define SHRT_MAX 32767
|
||||
|
||||
#define UCHAR_MAX 0xff
|
||||
#define UCHAR_MAX 255
|
||||
|
||||
#define CHAR_BIT 8
|
||||
|
||||
|
|
|
@ -11,8 +11,13 @@ extern "C" {
|
|||
#define NULL ((void *)0)
|
||||
#endif
|
||||
|
||||
#ifdef __LP64__
|
||||
typedef unsigned long size_t;
|
||||
typedef long ptrdiff_t;
|
||||
#else
|
||||
typedef unsigned int size_t;
|
||||
typedef int ptrdiff_t;
|
||||
#endif
|
||||
|
||||
#define offsetof(type, member) __builtin_offsetof(type, member)
|
||||
|
||||
|
|
|
@ -5,8 +5,13 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __LP64__
|
||||
typedef long intptr_t;
|
||||
typedef unsigned long uintptr_t;
|
||||
#else
|
||||
typedef int intptr_t;
|
||||
typedef unsigned int uintptr_t;
|
||||
#endif
|
||||
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef unsigned int uint32_t;
|
||||
|
|
|
@ -10,11 +10,11 @@ extern "C" {
|
|||
int putchar(int c);
|
||||
int puts(const char *s);
|
||||
|
||||
int snprintf(char *buf, size_t size, const char *fmt, ...);
|
||||
int scnprintf(char *buf, size_t size, const char *fmt, ...);
|
||||
int sprintf(char *buf, const char *fmt, ...);
|
||||
int snprintf(char *buf, size_t size, const char *fmt, ...) __attribute__((format(printf, 3, 4)));
|
||||
int scnprintf(char *buf, size_t size, const char *fmt, ...) __attribute__((format(printf, 3, 4)));
|
||||
int sprintf(char *buf, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
|
||||
|
||||
int printf(const char *fmt, ...);
|
||||
int printf(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
|
||||
|
||||
/* Not sure this belongs here... */
|
||||
typedef long long loff_t;
|
||||
|
@ -53,7 +53,7 @@ extern FILE *stdin;
|
|||
extern FILE *stdout;
|
||||
extern FILE *stderr;
|
||||
|
||||
int fprintf(FILE *stream, const char *format, ...);
|
||||
int fprintf(FILE *stream, const char *format, ...) __attribute__((format(printf, 2, 3)));
|
||||
int fflush(FILE *stream);
|
||||
|
||||
FILE *fopen(const char *path, const char *mode);
|
||||
|
|
|
@ -76,9 +76,9 @@ static void gdb_stub(unsigned long pc, unsigned long sr,
|
|||
|
||||
case 'g': {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x"
|
||||
"%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x"
|
||||
"%08x%08x%08x",
|
||||
"%08x%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx"
|
||||
"%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx"
|
||||
"%08lx%08lx%08lx",
|
||||
0, r1, regs[2], regs[3], regs[4], regs[5], regs[6], regs[7],
|
||||
regs[8], regs[9], regs[10], regs[11], regs[12], regs[13], regs[14], regs[15],
|
||||
regs[16], regs[17], regs[18], regs[19], regs[20], regs[21], regs[22], regs[23],
|
||||
|
@ -120,7 +120,7 @@ static void gdb_stub(unsigned long pc, unsigned long sr,
|
|||
snprintf(buf, sizeof(buf), "E01");
|
||||
break;
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "%08x", value);
|
||||
snprintf(buf, sizeof(buf), "%08lx", value);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,6 @@ static void gdb_stub(unsigned long pc, unsigned long sr,
|
|||
}
|
||||
|
||||
default:
|
||||
snprintf(buf, sizeof(buf), "");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -61,6 +61,4 @@ void init_progression_bar(int max)
|
|||
spin = 0;
|
||||
if (progress_max && progress_max != FILESIZE_MAX)
|
||||
printf("[%*s]\r[", HASHES_PER_LINE, "");
|
||||
else
|
||||
printf("");
|
||||
}
|
||||
|
|
|
@ -186,7 +186,7 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
|
|||
case 'p':
|
||||
if (field_width == -1) {
|
||||
field_width = 2*sizeof(void *);
|
||||
flags |= PRINTF_ZEROPAD;
|
||||
flags |= PRINTF_ZEROPAD | PRINTF_SPECIAL;
|
||||
}
|
||||
str = number(str, end,
|
||||
(unsigned long) va_arg(args, void *),
|
||||
|
|
|
@ -130,7 +130,7 @@ void sdram_bist_loop(uint32_t loop, uint32_t burst_length, uint32_t random) {
|
|||
|
||||
static uint32_t compute_speed_mibs(uint32_t length, uint32_t ticks) {
|
||||
uint32_t speed;
|
||||
//printf("(%lu, %lu)", length, ticks);
|
||||
//printf("(%u, %u)", length, ticks);
|
||||
speed = length*(CONFIG_CLOCK_FREQUENCY/(1024*1024))/ticks;
|
||||
return speed;
|
||||
}
|
||||
|
|
|
@ -1013,7 +1013,7 @@ int sdram_init(void)
|
|||
_sdram_write_leveling_cmd_scan = 0;
|
||||
_sdram_write_leveling_cmd_delay = SDRAM_PHY_CMD_DELAY;
|
||||
#endif
|
||||
printf("Initializing SDRAM @0x%08x...\n", MAIN_RAM_BASE);
|
||||
printf("Initializing SDRAM @0x%08lx...\n", MAIN_RAM_BASE);
|
||||
sdram_software_control_on();
|
||||
#if CSR_DDRPHY_RST_ADDR
|
||||
ddrphy_rst_write(1);
|
||||
|
|
|
@ -51,7 +51,7 @@ void sata_read(uint32_t sector, uint32_t count, uint8_t* buf)
|
|||
for (i=0; i<count; i++) {
|
||||
uint8_t done = 0;
|
||||
while (done == 0) {
|
||||
sata_sector2mem_base_write((uint64_t) buf);
|
||||
sata_sector2mem_base_write((uint64_t)(uintptr_t) buf);
|
||||
sata_sector2mem_sector_write(sector + i);
|
||||
sata_sector2mem_start_write(1);
|
||||
while ((sata_sector2mem_done_read() & 0x1) == 0);
|
||||
|
@ -80,7 +80,7 @@ void sata_write(uint32_t sector, uint32_t count, uint8_t* buf)
|
|||
for (i=0; i<count; i++) {
|
||||
uint8_t done = 0;
|
||||
while (done == 0) {
|
||||
sata_mem2sector_base_write((uint64_t) buf);
|
||||
sata_mem2sector_base_write((uint64_t)(uintptr_t) buf);
|
||||
sata_mem2sector_sector_write(sector + i);
|
||||
sata_mem2sector_start_write(1);
|
||||
while ((sata_sector2mem_done_read() & 0x1) == 0);
|
||||
|
|
|
@ -473,7 +473,7 @@ void sdcard_read(uint32_t block, uint32_t count, uint8_t* buf)
|
|||
{
|
||||
/* Initialize DMA Writer */
|
||||
sdblock2mem_dma_enable_write(0);
|
||||
sdblock2mem_dma_base_write((uint64_t) buf);
|
||||
sdblock2mem_dma_base_write((uint64_t)(uintptr_t) buf);
|
||||
sdblock2mem_dma_length_write(512*count);
|
||||
sdblock2mem_dma_enable_write(1);
|
||||
|
||||
|
@ -504,7 +504,7 @@ void sdcard_write(uint32_t block, uint32_t count, uint8_t* buf)
|
|||
while (count--) {
|
||||
/* Initialize DMA Reader */
|
||||
sdmem2block_dma_enable_write(0);
|
||||
sdmem2block_dma_base_write((uint64_t) buf);
|
||||
sdmem2block_dma_base_write((uint64_t)(uintptr_t) buf);
|
||||
sdmem2block_dma_length_write(512);
|
||||
sdmem2block_dma_enable_write(1);
|
||||
|
||||
|
|
Loading…
Reference in a new issue