From f26c45762971ddb5628b53f093c59d4e851fe6a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Fr=C3=B6schle?= Date: Tue, 16 Oct 2012 16:02:09 +0000 Subject: [PATCH] --- Makefile | 5 +++-- sources/sd_ide.c | 5 +---- sources/startcf.S | 2 +- sources/startcf.c | 54 ----------------------------------------------- sources/startcf.h | 25 ++-------------------- 5 files changed, 7 insertions(+), 84 deletions(-) delete mode 100644 sources/startcf.c diff --git a/Makefile b/Makefile index b15a130..1d02320 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,6 @@ LDCFILE=flash.lk EXEC=bas.s19 CSRCS= \ - $(SRCDIR)/startcf.c \ $(SRCDIR)/sysinit.c \ $(SRCDIR)/init_fpga.c \ $(SRCDIR)/BaS.c \ @@ -48,6 +47,8 @@ ASRCS= \ $(SRCDIR)/ewf.S \ $(SRCDIR)/illegal_instruction.S +STRT_SRC = startcf.S +STRT_OBJ = $(OBJDIR)/startcf.o COBJS=$(patsubst $(SRCDIR)/%.o,$(OBJDIR)/%.o,$(patsubst %.c,%.o,$(CSRCS))) AOBJS=$(patsubst $(SRCDIR)/%.o,$(OBJDIR)/%.o,$(patsubst %.S,%.o,$(ASRCS))) @@ -58,7 +59,7 @@ OBJS=$(COBJS) $(AOBJS) .PHONY clean: @ rm -f $(EXEC) $(OBJS) $(MAPFILE) depend -$(EXEC): $(OBJS) $(LDCFILE) +$(EXEC): $(STRT_OBJ) $(OBJS) $(LDCFILE) $(LD) --oformat srec -Map $(MAPFILE) --cref -T flash.lk -s -o $@ # compile init_fpga with -mbitfield for testing purposes diff --git a/sources/sd_ide.c b/sources/sd_ide.c index 7068a26..ffbde9d 100644 --- a/sources/sd_ide.c +++ b/sources/sd_ide.c @@ -1,10 +1,7 @@ - - #include "MCF5475.h" #include "startcf.h" -extern unsigned long __SP_AFTER_RESET[]; -extern unsigned long __Bas_base[]; + /* imported routines */ //extern int warten_20ms(); diff --git a/sources/startcf.S b/sources/startcf.S index 4904a57..646c693 100644 --- a/sources/startcf.S +++ b/sources/startcf.S @@ -1,4 +1,4 @@ -#include + .equ MCF_MMU_MMUCR, __MMUBAR + 0 _startup: .extern _initialize_hardware diff --git a/sources/startcf.c b/sources/startcf.c deleted file mode 100644 index 0f20eb4..0000000 --- a/sources/startcf.c +++ /dev/null @@ -1,54 +0,0 @@ -#include - -void startup(void) -{ - __asm__ __volatile__( - " .extern _initialize_hardware\n\t" - - " bra.s warmstart\n\t" - " jmp ___BOOT_FLASH + 8\n\t" /* that's also our reset vector */ - - /* disable interrupts */ - "warmstart:\n\t" - " move.w #0x2700,sr\n\t" - /* output */ : - /* input */ : - /* clobber */ : "d0", "memory"); - - /* Initialize MBAR */ - __asm__ __volatile__( - " MOVE.L #__MBAR,D0\n\t" - " MOVEC D0,MBAR\n\t" - " MOVE.L D0,_rt_mbar\n\t" - /* output */ : - /* input */ : - /* clobber */ : "d0", "memory"); - - /* mmu off */ - __asm__ __volatile__( - " move.l #__MMUBAR+1,d0\n\t" - " movec d0,MMUBAR\n\t" - /* output */ : - /* input */ : - /* clobber */ : "d0", "memory"); - - MCF_MMU_MMUCR = 0L; /* MMU off */ - - __asm__ __volatile__( - /* Initialize RAMBARs: locate SRAM and validate it */ - " move.l #__RAMBAR0 + 0x7,d0\n\t" /* supervisor only */ - " movec d0,RAMBAR0\n\t" - " move.l #__RAMBAR1 + 0x1,d0\n\t" - " movec d0,RAMBAR1\n\t" - /* set stack pointer to end of SRAM1 */ - " lea __SUP_SP,a7\n\t" - /* instruction cache on */ - " move.l #0x000C8100,d0\n\t" - " movec d0,cacr\n\t" - " nop\n\t" - /* initialize any hardware specific issues */ - " bra _initialize_hardware\n\t" - /* output */ : - /* input */ : - /* clobber */ : "d0", "memory"); -} diff --git a/sources/startcf.h b/sources/startcf.h index ad9e185..446c2b2 100644 --- a/sources/startcf.h +++ b/sources/startcf.h @@ -1,26 +1,4 @@ -/****************************************************************************** - FILE : startcf.h - PURPOSE : startup code for ColdFire - LANGUAGE: C - - - Notes: - 1) Default entry point is _startup. - . disable interrupts - . the SP is set to __SP_AFTER_RESET - . SP must be initialized to valid memory - in case the memory it points to is not valid using MEMORY_INIT macro - 2) __initialize_hardware is called. Here you can initialize memory and some peripherics - at this point global variables are not initialized yet - 3) After __initialize_hardware memory is setup; initialize SP to _SP_INIT and perform - needed initialisations for the language (clear memory, data rom copy). - 4) void __initialize_system(void); is called - to allow additional hardware initialization (UART, GPIOs, etc...) - 5) Jump to main - -*/ -/********************************************************************************/ - +#ifdef _NOT_USED_ #define cf_stack //#define ii_on @@ -39,6 +17,7 @@ #define halten_exg #define halten_movep #define halten_ewf +#endif /* _NOT_USED_ */ #define DIP_SWITCH (*(volatile uint8_t *)(&_MBAR[0xA2C])) #define DIP_SWITCHa __MBAR + 0xA2C