This commit is contained in:
Markus Fröschle
2012-10-16 16:02:09 +00:00
parent fc7d10e2f3
commit 688f9adfbb
5 changed files with 7 additions and 84 deletions

View File

@@ -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

View File

@@ -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();

View File

@@ -1,4 +1,4 @@
#include <MCF5475.h>
.equ MCF_MMU_MMUCR, __MMUBAR + 0
_startup:
.extern _initialize_hardware

View File

@@ -1,54 +0,0 @@
#include <MCF5475.h>
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");
}

View File

@@ -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