diff --git a/litex/soc/software/bios/boot.c b/litex/soc/software/bios/boot.c index 473b99584..901b27445 100644 --- a/litex/soc/software/bios/boot.c +++ b/litex/soc/software/bios/boot.c @@ -17,9 +17,9 @@ #include "sfl.h" #include "boot.h" -extern void boot_helper(unsigned int r1, unsigned int r2, unsigned int r3, unsigned int addr); +extern void boot_helper(unsigned long r1, unsigned long r2, unsigned long r3, unsigned long addr); -static void __attribute__((noreturn)) boot(unsigned int r1, unsigned int r2, unsigned int r3, unsigned int addr) +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", addr); uart_sync(); @@ -83,7 +83,7 @@ int serialboot(void) { struct sfl_frame frame; int failed; - unsigned int cmdline_adr, initrdstart_adr, initrdend_adr; + unsigned long cmdline_adr, initrdstart_adr, initrdend_adr; static const char str[SFL_MAGIC_LEN+1] = SFL_MAGIC_REQ; const char *c; int ack_status; @@ -146,49 +146,49 @@ int serialboot(void) failed = 0; writepointer = (char *)( - ((unsigned int)frame.payload[0] << 24) - |((unsigned int)frame.payload[1] << 16) - |((unsigned int)frame.payload[2] << 8) - |((unsigned int)frame.payload[3] << 0)); + ((unsigned long)frame.payload[0] << 24) + |((unsigned long)frame.payload[1] << 16) + |((unsigned long)frame.payload[2] << 8) + |((unsigned long)frame.payload[3] << 0)); for(i=4;i rom .data : { - . = ALIGN(4); + . = ALIGN(8); _fdata = .; *(.data .data.* .gnu.linkonce.d.*) *(.data1) @@ -37,13 +37,13 @@ SECTIONS /* Make sure the file is aligned on disk as well as in memory; CRC calculation requires that. */ FILL(0); - . = ALIGN(4); + . = ALIGN(8); _edata = .; } > rom .bss : { - . = ALIGN(4); + . = ALIGN(8); _fbss = .; *(.dynsbss) *(.sbss .sbss.* .gnu.linkonce.sb.*) @@ -51,7 +51,7 @@ SECTIONS *(.dynbss) *(.bss .bss.* .gnu.linkonce.b.*) *(COMMON) - . = ALIGN(4); + . = ALIGN(8); _ebss = .; _end = .; } > sram @@ -63,4 +63,4 @@ SECTIONS } } -PROVIDE(_fstack = ORIGIN(sram) + LENGTH(sram) - 4); +PROVIDE(_fstack = ORIGIN(sram) + LENGTH(sram) - 8); diff --git a/litex/soc/software/bios/main.c b/litex/soc/software/bios/main.c index 26ca39838..b4bf614b5 100644 --- a/litex/soc/software/bios/main.c +++ b/litex/soc/software/bios/main.c @@ -21,7 +21,7 @@ /* General address space functions */ #define NUMBER_OF_BYTES_ON_A_LINE 16 -static void dump_bytes(unsigned int *ptr, int count, unsigned addr) +static void dump_bytes(unsigned int *ptr, int count, unsigned long addr) { char *data = (char *)ptr; int line_bytes = 0, i = 0; @@ -83,7 +83,7 @@ static void mr(char *startaddr, char *len) } } - dump_bytes(addr, length, (unsigned)addr); + dump_bytes(addr, length, (unsigned long)addr); } static void mw(char *addr, char *value, char *count) @@ -298,8 +298,8 @@ extern unsigned int _ftext, _edata; static void crcbios(void) { - unsigned int offset_bios; - unsigned int length; + unsigned long offset_bios; + unsigned long length; unsigned int expected_crc; unsigned int actual_crc; @@ -309,9 +309,9 @@ static void crcbios(void) * We also use the address of _edata to know the length * of our code. */ - offset_bios = (unsigned int)&_ftext; + offset_bios = (unsigned long)&_ftext; expected_crc = _edata; - length = (unsigned int)&_edata - offset_bios; + length = (unsigned long)&_edata - offset_bios; actual_crc = crc32((unsigned char *)offset_bios, length); if(expected_crc == actual_crc) printf(" BIOS CRC passed (%08x)\n", actual_crc); diff --git a/litex/soc/software/include/hw/common.h b/litex/soc/software/include/hw/common.h index af668f74e..ba5cc6114 100644 --- a/litex/soc/software/include/hw/common.h +++ b/litex/soc/software/include/hw/common.h @@ -14,34 +14,34 @@ #ifdef __ASSEMBLER__ #define MMPTR(x) x #else /* ! __ASSEMBLER__ */ -#define MMPTR(x) (*((volatile unsigned int *)(x))) +#define MMPTR(x) (*((volatile unsigned long *)(x))) -static inline void csr_writeb(uint8_t value, uint32_t addr) +static inline void csr_writeb(uint8_t value, unsigned long addr) { *((volatile uint8_t *)addr) = value; } -static inline uint8_t csr_readb(uint32_t addr) +static inline uint8_t csr_readb(unsigned long addr) { return *(volatile uint8_t *)addr; } -static inline void csr_writew(uint16_t value, uint32_t addr) +static inline void csr_writew(uint16_t value, unsigned long addr) { *((volatile uint16_t *)addr) = value; } -static inline uint16_t csr_readw(uint32_t addr) +static inline uint16_t csr_readw(unsigned long addr) { return *(volatile uint16_t *)addr; } -static inline void csr_writel(uint32_t value, uint32_t addr) +static inline void csr_writel(uint32_t value, unsigned long addr) { *((volatile uint32_t *)addr) = value; } -static inline uint32_t csr_readl(uint32_t addr) +static inline uint32_t csr_readl(unsigned long addr) { return *(volatile uint32_t *)addr; }