removed BaS copy to RAM.
Since flashing is intended from a self-contained, SD-card loaded image, this is not neccessary anymore.
This commit is contained in:
2
Makefile
2
Makefile
@@ -144,7 +144,7 @@ $(LIBBAS): $(OBJS)
|
|||||||
#$(OBJDIR)/init_fpga.o: CFLAGS += -mbitfield
|
#$(OBJDIR)/init_fpga.o: CFLAGS += -mbitfield
|
||||||
|
|
||||||
# compile printf pc-relative so it can be used as well before and after copy of BaS
|
# compile printf pc-relative so it can be used as well before and after copy of BaS
|
||||||
$(OBJDIR)/bas_printf.o: CFLAGS += -mpcrel
|
#$(OBJDIR)/bas_printf.o: CFLAGS += -mpcrel
|
||||||
# the same for flush_and_invalidate_cache()
|
# the same for flush_and_invalidate_cache()
|
||||||
$(OBJDIR)/cache.o: CFLAGS += -mpcrel
|
$(OBJDIR)/cache.o: CFLAGS += -mpcrel
|
||||||
|
|
||||||
|
|||||||
38
bas.lk.in
38
bas.lk.in
@@ -14,6 +14,25 @@ SECTIONS
|
|||||||
objs/init_fpga.o(.text)
|
objs/init_fpga.o(.text)
|
||||||
objs/wait.o(.text)
|
objs/wait.o(.text)
|
||||||
|
|
||||||
|
objs/BaS.o(.text)
|
||||||
|
objs/wait.o(.text)
|
||||||
|
/* put other routines into the same segment (RAM) as BaS.o */
|
||||||
|
objs/unicode.o(.text)
|
||||||
|
objs/mmc.o(.text)
|
||||||
|
objs/ff.o(.text)
|
||||||
|
objs/sd_card.o(.text)
|
||||||
|
objs/s19reader.o(.text)
|
||||||
|
objs/bas_printf.o(.text)
|
||||||
|
objs/bas_string.o(.text)
|
||||||
|
objs/printf_helper.o(.text)
|
||||||
|
objs/cache.o(.text)
|
||||||
|
objs/mmu.o(.text)
|
||||||
|
objs/supervisor.o(.text)
|
||||||
|
objs/illegal_instruction.o(.text)
|
||||||
|
objs/exceptions.o(.text)
|
||||||
|
objs/xhdi_sd.o(.text)
|
||||||
|
objs/xhdi_interface.o(text)
|
||||||
|
objs/xhdi_vec.o(text)
|
||||||
#if (FORMAT == elf32-m68k)
|
#if (FORMAT == elf32-m68k)
|
||||||
*(.rodata)
|
*(.rodata)
|
||||||
*(.rodata.*)
|
*(.rodata.*)
|
||||||
@@ -28,25 +47,6 @@ SECTIONS
|
|||||||
*/
|
*/
|
||||||
AT (ALIGN(ADDR(.text) + SIZEOF(.text), 4))
|
AT (ALIGN(ADDR(.text) + SIZEOF(.text), 4))
|
||||||
{
|
{
|
||||||
objs/BaS.o(.text)
|
|
||||||
objs/wait.o(.text)
|
|
||||||
/* put other routines into the same segment (RAM) as BaS.o */
|
|
||||||
objs/unicode.o(.text)
|
|
||||||
objs/mmc.o(.text)
|
|
||||||
objs/ff.o(.text)
|
|
||||||
objs/sd_card.o(.text)
|
|
||||||
objs/s19reader.o(.text)
|
|
||||||
objs/bas_printf.o(.text)
|
|
||||||
objs/bas_string.o(.text)
|
|
||||||
objs/printf_helper.o(.text)
|
|
||||||
objs/cache.o(.text)
|
|
||||||
objs/mmu.o(.text)
|
|
||||||
objs/exceptions.o(.text)
|
|
||||||
objs/supervisor.o(.text)
|
|
||||||
objs/illegal_instruction.o(.text)
|
|
||||||
objs/xhdi_sd.o(.text)
|
|
||||||
objs/xhdi_interface.o(text)
|
|
||||||
objs/xhdi_vec.o(text)
|
|
||||||
*(.data)
|
*(.data)
|
||||||
*(.bss)
|
*(.bss)
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ SECTIONS
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define BAS_LABEL_LMA(x) ((x))
|
#define BAS_LABEL_LMA(x) ((x))
|
||||||
_xprintf_before_copy = BAS_LABEL_LMA(_xprintf);
|
/* _xprintf_before_copy = BAS_LABEL_LMA(_xprintf); */
|
||||||
_display_progress_before_copy = BAS_LABEL_LMA(_display_progress);
|
/* _display_progress_before_copy = BAS_LABEL_LMA(_display_progress); */
|
||||||
/* _flush_and_invalidate_caches_before_copy = BAS_LABEL_LMA(_flush_and_invalidate_caches); */
|
/* _flush_and_invalidate_caches_before_copy = BAS_LABEL_LMA(_flush_and_invalidate_caches); */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
616
sources/BaS.c
616
sources/BaS.c
@@ -1,309 +1,309 @@
|
|||||||
/*
|
/*
|
||||||
* BaS
|
* BaS
|
||||||
*
|
*
|
||||||
* This file is part of BaS_gcc.
|
* This file is part of BaS_gcc.
|
||||||
*
|
*
|
||||||
* BaS_gcc is free software: you can redistribute it and/or modify
|
* BaS_gcc is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* BaS_gcc is distributed in the hope that it will be useful,
|
* BaS_gcc is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with BaS_gcc. If not, see <http://www.gnu.org/licenses/>.
|
* along with BaS_gcc. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* Copyright 2010 - 2012 F. Aschwanden
|
* Copyright 2010 - 2012 F. Aschwanden
|
||||||
* Copyright 2011 - 2012 V. Riviere
|
* Copyright 2011 - 2012 V. Riviere
|
||||||
* Copyright 2012 M. Froeschle
|
* Copyright 2012 M. Froeschle
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "MCF5475.h"
|
#include "MCF5475.h"
|
||||||
#include "MCF5475_SLT.h"
|
#include "MCF5475_SLT.h"
|
||||||
#include "startcf.h"
|
#include "startcf.h"
|
||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
#include "bas_printf.h"
|
#include "bas_printf.h"
|
||||||
#include "bas_types.h"
|
#include "bas_types.h"
|
||||||
#include "sd_card.h"
|
#include "sd_card.h"
|
||||||
#include "wait.h"
|
#include "wait.h"
|
||||||
|
|
||||||
#include "diskio.h"
|
#include "diskio.h"
|
||||||
#include "ff.h"
|
#include "ff.h"
|
||||||
#include "s19reader.h"
|
#include "s19reader.h"
|
||||||
|
|
||||||
/* imported routines */
|
/* imported routines */
|
||||||
extern int mmu_init();
|
extern int mmu_init();
|
||||||
extern int vec_init();
|
extern int vec_init();
|
||||||
|
|
||||||
/* Symbols from the linker script */
|
/* Symbols from the linker script */
|
||||||
extern uint8_t _STRAM_END[];
|
extern uint8_t _STRAM_END[];
|
||||||
#define STRAM_END ((uint32_t)_STRAM_END)
|
#define STRAM_END ((uint32_t)_STRAM_END)
|
||||||
extern uint8_t _TOS[];
|
extern uint8_t _TOS[];
|
||||||
#define TOS ((uint32_t)_TOS) /* final TOS location */
|
#define TOS ((uint32_t)_TOS) /* final TOS location */
|
||||||
extern uint8_t _FASTRAM_END[];
|
extern uint8_t _FASTRAM_END[];
|
||||||
#define FASTRAM_END ((uint32_t)_FASTRAM_END)
|
#define FASTRAM_END ((uint32_t)_FASTRAM_END)
|
||||||
extern uint8_t _EMUTOS[];
|
extern uint8_t _EMUTOS[];
|
||||||
#define EMUTOS ((uint32_t)_EMUTOS) /* where EmuTOS is stored in flash */
|
#define EMUTOS ((uint32_t)_EMUTOS) /* where EmuTOS is stored in flash */
|
||||||
extern uint8_t _EMUTOS_SIZE[];
|
extern uint8_t _EMUTOS_SIZE[];
|
||||||
#define EMUTOS_SIZE ((uint32_t)_EMUTOS_SIZE) /* size of EmuTOS, in bytes */
|
#define EMUTOS_SIZE ((uint32_t)_EMUTOS_SIZE) /* size of EmuTOS, in bytes */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* check if it is possible to transfer data to PIC
|
* check if it is possible to transfer data to PIC
|
||||||
*/
|
*/
|
||||||
static inline bool pic_txready(void)
|
static inline bool pic_txready(void)
|
||||||
{
|
{
|
||||||
if (MCF_PSC3_PSCSR & MCF_PSC_PSCSR_TXRDY)
|
if (MCF_PSC3_PSCSR & MCF_PSC_PSCSR_TXRDY)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* check if it is possible to receive data from PIC
|
* check if it is possible to receive data from PIC
|
||||||
*/
|
*/
|
||||||
static inline bool pic_rxready(void)
|
static inline bool pic_rxready(void)
|
||||||
{
|
{
|
||||||
if (MCF_PSC3_PSCSR & MCF_PSC_PSCSR_RXRDY)
|
if (MCF_PSC3_PSCSR & MCF_PSC_PSCSR_RXRDY)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void write_pic_byte(uint8_t value)
|
void write_pic_byte(uint8_t value)
|
||||||
{
|
{
|
||||||
/* Wait until the transmitter is ready or 1000us are passed */
|
/* Wait until the transmitter is ready or 1000us are passed */
|
||||||
waitfor(1000, pic_txready);
|
waitfor(1000, pic_txready);
|
||||||
|
|
||||||
/* Transmit the byte */
|
/* Transmit the byte */
|
||||||
*(volatile uint8_t*)(&MCF_PSC3_PSCTB_8BIT) = value; // Really 8-bit
|
*(volatile uint8_t*)(&MCF_PSC3_PSCTB_8BIT) = value; // Really 8-bit
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t read_pic_byte(void)
|
uint8_t read_pic_byte(void)
|
||||||
{
|
{
|
||||||
/* Wait until a byte has been received or 1000us are passed */
|
/* Wait until a byte has been received or 1000us are passed */
|
||||||
waitfor(1000, pic_rxready);
|
waitfor(1000, pic_rxready);
|
||||||
|
|
||||||
/* Return the received byte */
|
/* Return the received byte */
|
||||||
return *(volatile uint8_t*)(&MCF_PSC3_PSCTB_8BIT); // Really 8-bit
|
return *(volatile uint8_t*)(&MCF_PSC3_PSCTB_8BIT); // Really 8-bit
|
||||||
}
|
}
|
||||||
|
|
||||||
void pic_init(void)
|
void pic_init(void)
|
||||||
{
|
{
|
||||||
char answer[4] = "OLD";
|
char answer[4] = "OLD";
|
||||||
|
|
||||||
xprintf("initialize the PIC: ");
|
xprintf("initialize the PIC: ");
|
||||||
|
|
||||||
/* Send the PIC initialization string */
|
/* Send the PIC initialization string */
|
||||||
write_pic_byte('A');
|
write_pic_byte('A');
|
||||||
write_pic_byte('C');
|
write_pic_byte('C');
|
||||||
write_pic_byte('P');
|
write_pic_byte('P');
|
||||||
write_pic_byte('F');
|
write_pic_byte('F');
|
||||||
|
|
||||||
/* Read the 3-char answer string. Should be "OK!". */
|
/* Read the 3-char answer string. Should be "OK!". */
|
||||||
answer[0] = read_pic_byte();
|
answer[0] = read_pic_byte();
|
||||||
answer[1] = read_pic_byte();
|
answer[1] = read_pic_byte();
|
||||||
answer[2] = read_pic_byte();
|
answer[2] = read_pic_byte();
|
||||||
answer[3] = '\0';
|
answer[3] = '\0';
|
||||||
|
|
||||||
if (answer[0] != 'O' || answer[1] != 'K' || answer[2] != '!')
|
if (answer[0] != 'O' || answer[1] != 'K' || answer[2] != '!')
|
||||||
{
|
{
|
||||||
xprintf("PIC initialization failed. Already initialized?\r\n");
|
xprintf("PIC initialization failed. Already initialized?\r\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xprintf("%s\r\n", answer);
|
xprintf("%s\r\n", answer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nvram_init(void)
|
void nvram_init(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
xprintf("Restore the NVRAM data: ");
|
xprintf("Restore the NVRAM data: ");
|
||||||
|
|
||||||
/* Request for NVRAM backup data */
|
/* Request for NVRAM backup data */
|
||||||
write_pic_byte(0x01);
|
write_pic_byte(0x01);
|
||||||
|
|
||||||
/* Check answer type */
|
/* Check answer type */
|
||||||
if (read_pic_byte() != 0x81)
|
if (read_pic_byte() != 0x81)
|
||||||
{
|
{
|
||||||
// FIXME: PIC protocol error
|
// FIXME: PIC protocol error
|
||||||
xprintf("FAILED\r\n");
|
xprintf("FAILED\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Restore the NVRAM backup to the FPGA */
|
/* Restore the NVRAM backup to the FPGA */
|
||||||
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
||||||
{
|
{
|
||||||
uint8_t data = read_pic_byte();
|
uint8_t data = read_pic_byte();
|
||||||
*(volatile uint8_t*)0xffff8961 = i;
|
*(volatile uint8_t*)0xffff8961 = i;
|
||||||
*(volatile uint8_t*)0xffff8963 = data;
|
*(volatile uint8_t*)0xffff8963 = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
xprintf("finished\r\n");
|
xprintf("finished\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void enable_coldfire_interrupts()
|
void enable_coldfire_interrupts()
|
||||||
{
|
{
|
||||||
xprintf("enable interrupts: ");
|
xprintf("enable interrupts: ");
|
||||||
* (volatile uint32_t *) 0xf0010004 = 0L; /* disable all interrupts */
|
* (volatile uint32_t *) 0xf0010004 = 0L; /* disable all interrupts */
|
||||||
MCF_EPORT_EPPAR = 0xaaa8; /* all interrupts on falling edge */
|
MCF_EPORT_EPPAR = 0xaaa8; /* all interrupts on falling edge */
|
||||||
|
|
||||||
MCF_GPT0_GMS = MCF_GPT_GMS_ICT(1) | /* timer 0 on, video change capture on rising edge */
|
MCF_GPT0_GMS = MCF_GPT_GMS_ICT(1) | /* timer 0 on, video change capture on rising edge */
|
||||||
MCF_GPT_GMS_IEN |
|
MCF_GPT_GMS_IEN |
|
||||||
MCF_GPT_GMS_TMS(1);
|
MCF_GPT_GMS_TMS(1);
|
||||||
MCF_INTC_ICR62 = 0x3f;
|
MCF_INTC_ICR62 = 0x3f;
|
||||||
|
|
||||||
* (volatile uint8_t *) 0xf0010004 = 0xfe; /* enable int 1-7 */
|
* (volatile uint8_t *) 0xf0010004 = 0xfe; /* enable int 1-7 */
|
||||||
MCF_EPORT_EPIER = 0xfe; /* int 1-7 on */
|
MCF_EPORT_EPIER = 0xfe; /* int 1-7 on */
|
||||||
MCF_EPORT_EPFR = 0xff; /* clear all pending interrupts */
|
MCF_EPORT_EPFR = 0xff; /* clear all pending interrupts */
|
||||||
MCF_INTC_IMRL = 0xffffff00; /* int 1-7 on */
|
MCF_INTC_IMRL = 0xffffff00; /* int 1-7 on */
|
||||||
MCF_INTC_IMRH = 0xbffffffe; /* psc3 and timer 0 int on */
|
MCF_INTC_IMRH = 0xbffffffe; /* psc3 and timer 0 int on */
|
||||||
|
|
||||||
xprintf("finished\r\n");
|
xprintf("finished\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void disable_coldfire_interrupts()
|
void disable_coldfire_interrupts()
|
||||||
{
|
{
|
||||||
* (volatile uint32_t *) 0xf0010004 = 0L; /* disable all interrupts */
|
* (volatile uint32_t *) 0xf0010004 = 0L; /* disable all interrupts */
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaS(void)
|
void BaS(void)
|
||||||
{
|
{
|
||||||
uint8_t *src;
|
uint8_t *src;
|
||||||
uint8_t *dst = (uint8_t *)TOS;
|
uint8_t *dst = (uint8_t *)TOS;
|
||||||
uint32_t *adr;
|
uint32_t *adr;
|
||||||
|
|
||||||
pic_init();
|
pic_init();
|
||||||
nvram_init();
|
nvram_init();
|
||||||
|
|
||||||
xprintf("copy EmuTOS: ");
|
xprintf("copy EmuTOS: ");
|
||||||
|
|
||||||
/* copy EMUTOS */
|
/* copy EMUTOS */
|
||||||
src = (uint8_t *) EMUTOS;
|
src = (uint8_t *) EMUTOS;
|
||||||
while (src < (uint8_t *)(EMUTOS + EMUTOS_SIZE))
|
while (src < (uint8_t *)(EMUTOS + EMUTOS_SIZE))
|
||||||
{
|
{
|
||||||
*dst++ = *src++;
|
*dst++ = *src++;
|
||||||
}
|
}
|
||||||
|
|
||||||
xprintf("finished\r\n");
|
xprintf("finished\r\n");
|
||||||
|
|
||||||
/* we have copied a code area, so flush the caches */
|
/* we have copied a code area, so flush the caches */
|
||||||
flush_and_invalidate_caches();
|
flush_and_invalidate_caches();
|
||||||
|
|
||||||
xprintf("initialize MMU: ");
|
xprintf("initialize MMU: ");
|
||||||
mmu_init();
|
mmu_init();
|
||||||
xprintf("finished\r\n");
|
xprintf("finished\r\n");
|
||||||
|
|
||||||
xprintf("initialize exception vector table: ");
|
xprintf("initialize exception vector table: ");
|
||||||
vec_init();
|
vec_init();
|
||||||
xprintf("finished\r\n");
|
xprintf("finished\r\n");
|
||||||
|
|
||||||
MCF_MMU_MMUCR = MCF_MMU_MMUCR_EN; /* MMU on */
|
MCF_MMU_MMUCR = MCF_MMU_MMUCR_EN; /* MMU on */
|
||||||
|
|
||||||
xprintf("IDE reset: ");
|
xprintf("IDE reset: ");
|
||||||
/* IDE reset */
|
/* IDE reset */
|
||||||
* (volatile uint8_t *) (0xffff8802 - 2) = 14;
|
* (volatile uint8_t *) (0xffff8802 - 2) = 14;
|
||||||
* (volatile uint8_t *) (0xffff8802 - 0) = 0x80;
|
* (volatile uint8_t *) (0xffff8802 - 0) = 0x80;
|
||||||
wait(1);
|
wait(1);
|
||||||
|
|
||||||
* (volatile uint8_t *) (0xffff8802 - 0) = 0;
|
* (volatile uint8_t *) (0xffff8802 - 0) = 0;
|
||||||
|
|
||||||
xprintf("finished\r\n");
|
xprintf("finished\r\n");
|
||||||
xprintf("enable video: ");
|
xprintf("enable video: ");
|
||||||
/*
|
/*
|
||||||
* video setup (25MHz)
|
* video setup (25MHz)
|
||||||
*/
|
*/
|
||||||
* (volatile uint32_t *) (0xf0000410 + 0) = 0x032002ba; /* horizontal 640x480 */
|
* (volatile uint32_t *) (0xf0000410 + 0) = 0x032002ba; /* horizontal 640x480 */
|
||||||
* (volatile uint32_t *) (0xf0000410 + 4) = 0x020c020a; /* vertical 640x480 */
|
* (volatile uint32_t *) (0xf0000410 + 4) = 0x020c020a; /* vertical 640x480 */
|
||||||
* (volatile uint32_t *) (0xf0000410 + 8) = 0x0190015d; /* horizontal 320x240 */
|
* (volatile uint32_t *) (0xf0000410 + 8) = 0x0190015d; /* horizontal 320x240 */
|
||||||
* (volatile uint32_t *) (0xf0000410 + 12) = 0x020C020A; /* vertical 320x230 */
|
* (volatile uint32_t *) (0xf0000410 + 12) = 0x020C020A; /* vertical 320x230 */
|
||||||
|
|
||||||
#ifdef _NOT_USED_
|
#ifdef _NOT_USED_
|
||||||
// 32MHz
|
// 32MHz
|
||||||
move.l #0x037002ba,(a0)+ // horizontal 640x480
|
move.l #0x037002ba,(a0)+ // horizontal 640x480
|
||||||
move.l #0x020d020a,(a0)+ // vertikal 640x480
|
move.l #0x020d020a,(a0)+ // vertikal 640x480
|
||||||
move.l #0x02A001e0,(a0)+ // horizontal 320x240
|
move.l #0x02A001e0,(a0)+ // horizontal 320x240
|
||||||
move.l #0x05a00160,(a0)+ // vertikal 320x240
|
move.l #0x05a00160,(a0)+ // vertikal 320x240
|
||||||
#endif /* _NOT_USED_ */
|
#endif /* _NOT_USED_ */
|
||||||
|
|
||||||
/* fifo on, refresh on, ddrcs and cke on, video dac on */
|
/* fifo on, refresh on, ddrcs and cke on, video dac on */
|
||||||
* (volatile uint32_t *) (0xf0000410 - 0x20) = 0x01070002;
|
* (volatile uint32_t *) (0xf0000410 - 0x20) = 0x01070002;
|
||||||
|
|
||||||
xprintf("finished\r\n");
|
xprintf("finished\r\n");
|
||||||
|
|
||||||
sd_card_init();
|
sd_card_init();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* memory setup
|
* memory setup
|
||||||
*/
|
*/
|
||||||
for (adr = (uint32_t *) 0x400L; adr < (uint32_t *) 0x800L; ) {
|
for (adr = (uint32_t *) 0x400L; adr < (uint32_t *) 0x800L; ) {
|
||||||
*adr++ = 0x0L;
|
*adr++ = 0x0L;
|
||||||
*adr++ = 0x0L;
|
*adr++ = 0x0L;
|
||||||
*adr++ = 0x0L;
|
*adr++ = 0x0L;
|
||||||
*adr++ = 0x0L;
|
*adr++ = 0x0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
* (volatile uint8_t *) 0xffff8007 = 0x48; /* FIXME: what's that ? */
|
* (volatile uint8_t *) 0xffff8007 = 0x48; /* FIXME: what's that ? */
|
||||||
|
|
||||||
/* ST RAM */
|
/* ST RAM */
|
||||||
|
|
||||||
* (uint32_t *) 0x42e = STRAM_END; /* phystop TOS system variable */
|
* (uint32_t *) 0x42e = STRAM_END; /* phystop TOS system variable */
|
||||||
* (uint32_t *) 0x420 = 0x752019f3; /* memvalid TOS system variable */
|
* (uint32_t *) 0x420 = 0x752019f3; /* memvalid TOS system variable */
|
||||||
* (uint32_t *) 0x43a = 0x237698aa; /* memval2 TOS system variable */
|
* (uint32_t *) 0x43a = 0x237698aa; /* memval2 TOS system variable */
|
||||||
* (uint32_t *) 0x51a = 0x5555aaaa; /* memval3 TOS system variable */
|
* (uint32_t *) 0x51a = 0x5555aaaa; /* memval3 TOS system variable */
|
||||||
|
|
||||||
/* TT-RAM */
|
/* TT-RAM */
|
||||||
|
|
||||||
* (uint32_t *) 0x5a4 = FASTRAM_END; /* ramtop TOS system variable */
|
* (uint32_t *) 0x5a4 = FASTRAM_END; /* ramtop TOS system variable */
|
||||||
* (uint32_t *) 0x5a8 = 0x1357bd13; /* ramvalid TOS system variable */
|
* (uint32_t *) 0x5a8 = 0x1357bd13; /* ramvalid TOS system variable */
|
||||||
|
|
||||||
#define NOP() __asm__ __volatile__("nop\n\t" : : : "memory")
|
#define NOP() __asm__ __volatile__("nop\n\t" : : : "memory")
|
||||||
|
|
||||||
xprintf("init ACIA: ");
|
xprintf("init ACIA: ");
|
||||||
/* init ACIA */
|
/* init ACIA */
|
||||||
* (uint8_t *) 0xfffffc00 = 3;
|
* (uint8_t *) 0xfffffc00 = 3;
|
||||||
NOP();
|
NOP();
|
||||||
|
|
||||||
* (uint8_t *) 0xfffffc04 = 3;
|
* (uint8_t *) 0xfffffc04 = 3;
|
||||||
NOP();
|
NOP();
|
||||||
|
|
||||||
* (uint8_t *) 0xfffffc00 = 0x96;
|
* (uint8_t *) 0xfffffc00 = 0x96;
|
||||||
NOP();
|
NOP();
|
||||||
|
|
||||||
* (uint8_t *) 0xfffffa0f = -1;
|
* (uint8_t *) 0xfffffa0f = -1;
|
||||||
NOP();
|
NOP();
|
||||||
|
|
||||||
* (uint8_t *) 0xfffffa11 = -1;
|
* (uint8_t *) 0xfffffa11 = -1;
|
||||||
NOP();
|
NOP();
|
||||||
|
|
||||||
xprintf("finished\r\n");
|
xprintf("finished\r\n");
|
||||||
|
|
||||||
/* Test for pseudo-supervisor mode: DIP switch #6 down */
|
/* Test for pseudo-supervisor mode: DIP switch #6 down */
|
||||||
if (DIP_SWITCH & (1 << 7)) {
|
if (DIP_SWITCH & (1 << 7)) {
|
||||||
/* In this mode, the OS actually runs in user mode
|
/* In this mode, the OS actually runs in user mode
|
||||||
* and all the supervisor instructions are emulated. */
|
* and all the supervisor instructions are emulated. */
|
||||||
__asm__ __volatile__("move.w #0x0700,sr \n\t" : : : "memory");
|
__asm__ __volatile__("move.w #0x0700,sr \n\t" : : : "memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
srec_execute("BASFLASH.S19");
|
srec_execute("BASFLASH.S19");
|
||||||
|
|
||||||
/* Jump into the OS */
|
/* Jump into the OS */
|
||||||
typedef void void_func(void);
|
typedef void void_func(void);
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void *initial_sp;
|
void *initial_sp;
|
||||||
void_func *initial_pc;
|
void_func *initial_pc;
|
||||||
} ROM_HEADER;
|
} ROM_HEADER;
|
||||||
|
|
||||||
xprintf("Call OS. BaS initialization finished...\r\n");
|
xprintf("Call OS. BaS initialization finished...\r\n");
|
||||||
enable_coldfire_interrupts();
|
enable_coldfire_interrupts();
|
||||||
|
|
||||||
ROM_HEADER* os_header = (ROM_HEADER*)TOS;
|
ROM_HEADER* os_header = (ROM_HEADER*)TOS;
|
||||||
os_header->initial_pc();
|
os_header->initial_pc();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,10 +31,7 @@
|
|||||||
#define FPGA_DATA0 (1 << 3)
|
#define FPGA_DATA0 (1 << 3)
|
||||||
#define FPGA_CONF_DONE (1 << 5)
|
#define FPGA_CONF_DONE (1 << 5)
|
||||||
|
|
||||||
extern void xprintf_before_copy(const char *fmt, ...);
|
|
||||||
|
|
||||||
#define xprintf xprintf_before_copy
|
|
||||||
#define display_progress display_progress_before_copy
|
|
||||||
/*
|
/*
|
||||||
* load FPGA
|
* load FPGA
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "bas_printf.h"
|
#include "bas_printf.h"
|
||||||
#include "sd_card.h"
|
#include "sd_card.h"
|
||||||
|
|||||||
@@ -33,11 +33,6 @@
|
|||||||
#include "bas_types.h"
|
#include "bas_types.h"
|
||||||
#include "wait.h"
|
#include "wait.h"
|
||||||
|
|
||||||
extern void xprintf_before_copy(const char *fmt, ...);
|
|
||||||
#define xprintf xprintf_before_copy
|
|
||||||
extern void flush_and_invalidate_caches_before_copy(void);
|
|
||||||
#define flush_and_invalidate_caches flush_and_invalidate_caches_before_copy
|
|
||||||
|
|
||||||
#define UNUSED(x) (void)(x) /* Unused variable */
|
#define UNUSED(x) (void)(x) /* Unused variable */
|
||||||
|
|
||||||
extern volatile long _VRAM; /* start address of video ram from linker script */
|
extern volatile long _VRAM; /* start address of video ram from linker script */
|
||||||
@@ -852,6 +847,7 @@ void initialize_hardware(void) {
|
|||||||
//video_1280_1024();
|
//video_1280_1024();
|
||||||
init_ac97();
|
init_ac97();
|
||||||
|
|
||||||
|
#ifdef _NOT_USED_
|
||||||
/* copy the BaS code contained in flash to its final location */
|
/* copy the BaS code contained in flash to its final location */
|
||||||
src = (uint32_t *)BAS_LMA;
|
src = (uint32_t *)BAS_LMA;
|
||||||
end = (uint32_t *)(BAS_LMA + BAS_SIZE);
|
end = (uint32_t *)(BAS_LMA + BAS_SIZE);
|
||||||
@@ -872,6 +868,7 @@ void initialize_hardware(void) {
|
|||||||
flush_and_invalidate_caches();
|
flush_and_invalidate_caches();
|
||||||
|
|
||||||
/* jump into the BaS in RAM */
|
/* jump into the BaS in RAM */
|
||||||
|
#endif /* _NOT_USED_ */
|
||||||
extern void BaS(void);
|
extern void BaS(void);
|
||||||
BaS();
|
BaS();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user