diff --git a/.cproject b/.cproject index 49a4578..838f260 100644 --- a/.cproject +++ b/.cproject @@ -7,7 +7,6 @@ - @@ -22,7 +21,7 @@ @@ -33,12 +32,8 @@ - - - - @@ -51,7 +46,7 @@ + @@ -130,6 +128,16 @@ + + + + + + + + + + diff --git a/.gdbinit b/.gdbinit index e441b0b..346a05a 100644 --- a/.gdbinit +++ b/.gdbinit @@ -1,6 +1,6 @@ set disassemble-next-line on define tr - target remote | m68k-atari-mint-gdbserver pipe /dev/bdmcf3 + target remote | m68k-bdm-gdbserver pipe /dev/bdmcf3 end tr source mcf5474.gdb diff --git a/.settings/org.eclipse.ltk.core.refactoring.prefs b/.settings/org.eclipse.ltk.core.refactoring.prefs new file mode 100644 index 0000000..b196c64 --- /dev/null +++ b/.settings/org.eclipse.ltk.core.refactoring.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false diff --git a/bas.lk.in b/bas.lk.in index ad8f284..7e7a5a3 100644 --- a/bas.lk.in +++ b/bas.lk.in @@ -69,6 +69,11 @@ SECTIONS { objs/sysinit.o(.text) objs/init_fpga.o(.text) objs/cache.o(.text) +#if (FORMAT == elf32-m68k) + *(.rodata) + *(.rodata.*) + . = ALIGN(4); +#endif } > flash .bas _Bas_base : AT (ADDR(.text) + SIZEOF(.text)) @@ -76,24 +81,20 @@ SECTIONS { objs/BaS.o(.text) /* put other routines into the same segment (RAM) as BaS.o */ objs/sd_card_asm.o(.text) - _xprintf_before_copy = _xprintf - (_BaS - LOADADDR(.bas)); - _xprintf_after_copy = _xprintf; objs/bas_printf.o(.text) objs/printf_helper.o(.text) + _xprintf_before_copy = _xprintf - (_BaS - LOADADDR(.bas)); + _display_progress_before_copy = _display_progress - (_BaS - LOADADDR(.bas)); objs/sd_card.o(.text) objs/mmu.o(.text) objs/exceptions.o(.text) objs/supervisor.o(.text) objs/ewf.o(.text) objs/illegal_instruction.o(.text) - *(.data) - *(.bss) - -#if (FORMAT == elf32-m68k) - *(.rodata) - *(.rodata.*) -#endif + *(.bss) + . = ALIGN(4); + _bas_end = ABSOLUTE(.); } > ram diff --git a/include/bas_printf.h b/include/bas_printf.h index 7738c19..68209e8 100644 --- a/include/bas_printf.h +++ b/include/bas_printf.h @@ -8,4 +8,6 @@ extern void xvprintf(const char *fmt, va_list va); extern void xprintf(const char *fmt, ...); extern void xsnprintf(char *str, size_t size, const char *fmt, ...); +extern void display_progress(void); + #endif /* _BAS_PRINTF_H_ */ diff --git a/mcf5474.bdm b/mcf5474.bdm index b8bc919..40975b6 100755 --- a/mcf5474.bdm +++ b/mcf5474.bdm @@ -5,21 +5,16 @@ open $1 reset -# notify flashlib that we have flash at address 0xE0000000, length 0x7FFFFF, plugin is flash29 -#flash 0xE0000000 flash29 -# do not flash yet. First check if board can be initialized correctly +wait # set VBR -write-ctrl 0x0801 0x00000000 +#write-ctrl 0x0801 0x00000000 sleep 10 # Turn on MBAR at 0xFF00_0000 write-ctrl 0x0C0F 0xFF000000 -sleep 10 -write-ctrl 0x0C0F 0xFF000000 # Turn on MMUBAR at 0xFF04_0000 -#write-ctrl 0x0008 0xFF000001 -#write 0xFF000008 0x00000000 4 +write-ctrl 0x0008 0xFF040001 # Turn on RAMBAR0 at address FF10_0000 write-ctrl 0x0C04 0xFF100007 @@ -32,38 +27,49 @@ sleep 10 write 0xFF000500 0xE0000000 4 write 0xFF000508 0x00001180 4 write 0xFF000504 0x007F0001 4 +# Init CS1 (Atari I/O address range) +#write 0xFF00050C 0xFFF00000 4 +#write 0xFF000514 0x00002180 4 +#write 0xFF000510 0x000F0001 4 +# Init CS2 (FireBee 32 bit I/O address range) +#write 0xFF000518 0xF0000000 4 +#write 0xFF000520 0x00002100 4 +#write 0xFF00051C 0x07FF0001 4 +# Init CS3 (FireBee 16 bit I/O address range) +#write 0xFF000524 0xF8000000 4 +#write 0xFF00052C 0x00000180 4 +#write 0xFF000528 0x03FF0001 4 +# Init CS4 (FireBee video address range) +#write 0xFF000530 0x40000000 4 +#write 0xFF000538 0x00000018 4 +#write 0xFF000534 0x003F0001 4 + # SDRAM Initialization @ 0000_0000 - 1FFF_FFFF 512Mbytes write 0xFF000004 0x000002AA 4 # SDRAMDS configuration -sleep 10 write 0xFF000020 0x0000001A 4 # SDRAM CS0 configuration (128Mbytes 0000_0000 - 07FF_FFFF) -sleep 10 write 0xFF000024 0x0800001A 4 # SDRAM CS1 configuration (128Mbytes 0800_0000 - 0FFF_FFFF) -sleep 10 write 0xFF000028 0x1000001A 4 # SDRAM CS2 configuration (128Mbytes 1000_0000 - 17FF_FFFF) -sleep 10 write 0xFF00002C 0x1800001A 4 # SDRAM CS3 configuration (128Mbytes 1800_0000 - 1FFF_FFFF) -sleep 10 write 0xFF000108 0x73622830 4 # SDCFG1 -sleep 10 write 0xFF00010C 0x46770000 4 # SDCFG2 -sleep 10 write 0xFF000104 0xE10D0002 4 # SDCR + IPALL -sleep 10 write 0xFF000100 0x40010000 4 # SDMR (write to LEMR) -sleep 10 write 0xFF000100 0x048D0000 4 # SDMR (write to LMR) -sleep 10 write 0xFF000104 0xE10D0002 4 # SDCR + IPALL -sleep 10 write 0xFF000104 0xE10D0004 4 # SDCR + IREF (first refresh) -sleep 10 write 0xFF000104 0xE10D0004 4 # SDCR + IREF (first refresh) -sleep 10 write 0xFF000100 0x008D0000 4 # SDMR (write to LMR) -sleep 10 write 0xFF000104 0x710D0F00 4 # SDCR (lock SDMR and enable refresh) -load -v ram.s19.elf -execute 0x10000000 +write 0xFF000240 0x80000000 4 # disable watchdog arbiter + +# notify flashlib that we have flash at address 0xE0000000, length 0x7FFFFF, plugin is flash29 +flash 0xE0000000 flash29 +# do not flash yet. First check if board can be initialized correctly + +load -v ram.elf +wait +sleep 1000 +execute diff --git a/sources/bas_printf.c b/sources/bas_printf.c index 4be9492..4772912 100644 --- a/sources/bas_printf.c +++ b/sources/bas_printf.c @@ -66,7 +66,7 @@ static void xputchar(int c) "bsr printf_helper\n\t" /* output */: /* input */: "r" (c) - /* clobber */: "d0","d2","a0" + /* clobber */: "d0","d2","a0","memory" ); } diff --git a/sources/init_fpga.c b/sources/init_fpga.c index 84132dc..af03eb2 100644 --- a/sources/init_fpga.c +++ b/sources/init_fpga.c @@ -14,32 +14,28 @@ #define FPGA_CONF_DONE (1 << 5) extern void xprintf_before_copy(const char *fmt, ...); -#define xprintf xprintf_before_copy +extern void display_progress_before_copy(void); +extern void wait_10ms(); +#define xprintf xprintf_before_copy +#define display_progress display_progress_before_copy /* * load FPGA */ void init_fpga(void) { - register uint8_t *fpga_data; + register uint32_t *fpga_data; register int i; - xprintf("FPGA load data..."); + xprintf("FPGA load data...\r\n"); MCF_GPIO_PODR_FEC1L &= ~FPGA_CLOCK; /* FPGA clock => low */ MCF_GPIO_PODR_FEC1L &= ~FPGA_CONFIG; /* FPGA config => low */ - while (((MCF_GPIO_PPDSDR_FEC1L & FPGA_STATUS)) || ((MCF_GPIO_PPDSDR_FEC1L & FPGA_CONF_DONE))); - wait_10us(); - - MCF_GPIO_PODR_FEC1L |= FPGA_CONFIG; /* pull FPGA_CONFIG high */ - wait_10us(); - - while (!(MCF_GPIO_PPDSDR_FEC1L & FPGA_STATUS)) /* wait until status becomes high */ - { - wait_10us(); - } + while ((MCF_GPIO_PPDSDR_FEC1L & FPGA_STATUS) && (MCF_GPIO_PPDSDR_FEC1L & FPGA_CONF_DONE)); + MCF_GPIO_PODR_FEC1L |= FPGA_CONFIG; /* pull FPGA_CONFIG high */ + while (!(MCF_GPIO_PPDSDR_FEC1L & FPGA_STATUS)); /* wait until status becomes high */ /* * excerpt from an Altera configuration manual: @@ -60,11 +56,17 @@ void init_fpga(void) * which is pulled high by a pull-up resistor. A low to high transition on CONF_DONE indicates * configuration is complete and initialization of the device can begin. */ - fpga_data = (uint8_t *) FPGA_FLASH_DATA; + fpga_data = (uint32_t *) FPGA_FLASH_DATA; do { - uint8_t value = *fpga_data++; - for (i = 0; i < 8; i++, value >>= 1) + uint32_t value = *fpga_data++; + + if (((int) fpga_data % 0x100) == 0) { + xprintf("%08x ", fpga_data); + display_progress(); + } + + for (i = 0; i < 32; i++, value >>= 1) { if (value & 1) @@ -81,9 +83,9 @@ void init_fpga(void) MCF_GPIO_PODR_FEC1L |= FPGA_CLOCK; MCF_GPIO_PODR_FEC1L &= ~FPGA_CLOCK; } - } while (!(MCF_GPIO_PPDSDR_FEC1L & FPGA_CONF_DONE) && (fpga_data < FPGA_FLASH_DATA_END)); + } while ((!(MCF_GPIO_PPDSDR_FEC1L & FPGA_CONF_DONE)) && (fpga_data < (uint32_t *) FPGA_FLASH_DATA_END)); - if (fpga_data < FPGA_FLASH_DATA_END) + if (fpga_data < (uint32_t *) FPGA_FLASH_DATA_END) { for (i = 0; i < 4000; i++) { diff --git a/sources/sd_card.c b/sources/sd_card.c index 13b1f2d..15a8c39 100644 --- a/sources/sd_card.c +++ b/sources/sd_card.c @@ -12,7 +12,7 @@ void sd_card_idle(void) "bsr sd_idle\n\t" /* output */: /* input */ : - /* clobber */: "a0","a1","a2","a3","a4","a5","a6", + /* clobber */: "a0","a1","a2","a3","a4","a5", "d0","d1","d2","d3","d4","d5","d6","d7","memory" ); } @@ -28,7 +28,7 @@ int sd_card_init(void) "bsr.l sd_init\n\t" /* output */: "=r" (ret) /* input */ : - /* clobber */: "a0","a1","a2","a3","a4","a5","a6", + /* clobber */: "a0","a1","a2","a3","a4","a5", "d1","d2","d3","d4","d5","d6","d7","memory" );