Modified Makefile and linker script ("make ram") to be able to compile with a ram address as target. Should ease BDM debugging roundtrip because no need to flash after a fresh compile.

This commit is contained in:
Markus Fröschle
2012-10-19 09:56:45 +00:00
parent 79df8eec6d
commit 480e2479f7
2 changed files with 100 additions and 8 deletions

View File

@@ -16,6 +16,7 @@ TCPREFIX=m68k-atari-mint-
CC=$(TCPREFIX)gcc
LD=$(TCPREFIX)ld
CPP=$(TCPREFIX)cpp
INCLUDE=-Iinclude
CFLAGS=-mcpu=5474 -Wall -Wno-multichar -Os -fomit-frame-pointer
@@ -25,10 +26,9 @@ OBJDIR=objs
MAPFILE=bas.map
# Linker control files. flash.lk is meant for BaS in flash, ram.lk (not written yet) for
# debugging in RAM.
LDCFILE=flash.lk
# LDCFILE=ram.lk
# Linker control file.
LDCFILE=bas.lk
LDCSRC=bas.lk.S
EXEC=bas.s19
@@ -57,11 +57,17 @@ OBJS=$(COBJS) $(AOBJS)
.PHONY all: $(EXEC)
.PHONY clean:
@ rm -f $(EXEC) $(STRT_OBJ) $(OBJS) $(MAPFILE) depend
$(EXEC): $(STRT_OBJ) $(OBJS) $(LDCFILE)
$(LD) --oformat srec -Map $(MAPFILE) --cref -T flash.lk -s -o $@
@ rm -f $(EXEC) $(STRT_OBJ) $(OBJS) $(MAPFILE) $(LDCFILE) depend
$(EXEC): $(STRT_OBJ) $(OBJS) $(LDCSRC)
$(CPP) -P -DTARGET_ADDRESS=0xe0000000 $(LDCSRC) -o $(LDCFILE)
$(LD) --oformat srec -Map $(MAPFILE) --cref -T $(LDCFILE) -s -o $@
ram: $(STRT_OBJ) $(OBJS) $(LDCSRC)
$(CPP) -P -DTARGET_ADDRESS=0x01000000 $(LDCSRC) -o $(LDCFILE)
$(LD) --oformat srec -Map $(MAPFILE) --cref -T $(LDCFILE) -s -o $@.s19
# compile init_fpga with -mbitfield for testing purposes
$(OBJDIR)/init_fpga.o: CFLAGS += -mbitfield

86
bas.lk.S Normal file
View File

@@ -0,0 +1,86 @@
MEMORY {
flash (RX) : ORIGIN = TARGET_ADDRESS, LENGTH = 0x00200000
ram (WX) : ORIGIN = 0x1FE00000, LENGTH = 0x00100000 /* target to copy BaS to */
}
SECTIONS {
_Bas_base = ABSOLUTE(0x1FE00000);
_tos_base = ABSOLUTE(0xe00000);
/* Init CS0 (BootFLASH @ E000_0000 - E07F_FFFF 8Mbytes) */
___BOOT_FLASH = ABSOLUTE(TARGET_ADDRESS);
___BOOT_FLASH_SIZE = ABSOLUTE(0x00800000);
/* SDRAM Initialization @ 0000_0000 - 1FFF_FFFF 512Mbytes */
___SDRAM = ABSOLUTE(0x00000000);
___SDRAM_SIZE = ABSOLUTE(0x20000000);
/* VIDEO RAM BASIS */
__VRAM = ABSOLUTE(0x60000000);
/* Memory mapped registers */
__MBAR = ABSOLUTE(0xFF000000);
__MMUBAR = ABSOLUTE(0xFF040000);
/*
* 4KB on-chip Core SRAM0: -> exception table and exception stack
*/
__RAMBAR0 = ABSOLUTE(0xFF100000);
__RAMBAR0_SIZE = ABSOLUTE(0x00001000);
__SUP_SP = ABSOLUTE(__RAMBAR0 + __RAMBAR0_SIZE - 4);
/* 4KB on-chip Core SRAM1: -> modified code */
__RAMBAR1 = ABSOLUTE(0xFF101000);
__RAMBAR1_SIZE = ABSOLUTE(0x00001000);
/* system variables */
/* RAMBAR0 0 to 0x7FF -> exception vectors */
_rt_mod = __RAMBAR0 + 0x800;
_rt_ssp = __RAMBAR0 + 0x804;
_rt_usp = __RAMBAR0 + 0x808;
_rt_vbr = __RAMBAR0 + 0x80C; /* (8)01 */
_rt_cacr = __RAMBAR0 + 0x810; /* 002 */
_rt_asid = __RAMBAR0 + 0x814; /* 003 */
_rt_acr0 = __RAMBAR0 + 0x818; /* 004 */
_rt_acr1 = __RAMBAR0 + 0x81c; /* 005 */
_rt_acr2 = __RAMBAR0 + 0x820; /* 006 */
_rt_acr3 = __RAMBAR0 + 0x824; /* 007 */
_rt_mmubar = __RAMBAR0 + 0x828; /* 008 */
_rt_sr = __RAMBAR0 + 0x82c;
_d0_save = __RAMBAR0 + 0x830;
_a7_save = __RAMBAR0 + 0x834;
_video_tlb = __RAMBAR0 + 0x838;
_video_sbt = __RAMBAR0 + 0x83C;
_rt_mbar = __RAMBAR0 + 0x844; /* (c)0f */
/* 32KB on-chip System SRAM */
__SYS_SRAM = ABSOLUTE(0xFF010000);
__SYS_SRAM_SIZE = ABSOLUTE(0x00008000);
.code ___BOOT_FLASH :
{
objs/startcf.o
} > flash
.text :
{
objs/sysinit.o(.text)
objs/init_fpga.o(.text)
objs/sd_card.o(.text)
objs/cache.o(.text)
objs/mmu.o(.text)
objs/exceptions.o(.text)
objs/supervisor.o(.text)
objs/ewf.o(.text)
objs/illegal_instruction.o(.text)
_bas = .;
} > flash
.bas _Bas_base : AT (ADDR(.text) + SIZEOF(.text))
{
objs/BaS.o(.text)
_bas_end = ABSOLUTE(.);
} > ram
}