#############################################################################
#
#  Makefile - makefile for SBC8240 Evaluation Board
#
#
#  modification history
#  --------------------
#  Added By Hitesh Boda Contech Software ltd.
#
#  DESCRIPTION
#  -----------
#  This file contains rules for building the various targets 
#  for the SBC8240 Evaluation Board. 
#
#
#  TARGETS
#  -------
#  This section briefly lists the available build targets. 
#
#  e.g.  make vxWorks               <-- standard vxWorks build
#        make bootrom_uncmp.hex     <-- stardard vxWorks bootrom
#        make ESTWdbNetDemo.vxWorks <-- EST specific build
#
#  Target Build             Description
#  ------------             -----------
#  bootrom_uncmp.hex     -  bootrom image, hex format
#  bootrom_uncmp.bin     -  bootrom image, est binary format
#  vxWorks               -  standard vxWorks image
#
#############################################################################

CPU   = PPC603
TOOL  = gnu

TGT_DIR = $(WIND_BASE)/target

include $(TGT_DIR)/h/make/defs.bsp
include $(TGT_DIR)/h/make/make.$(CPU)$(TOOL)
include $(TGT_DIR)/h/make/defs.$(WIND_HOST_TYPE)

## Only redefine make definitions below this point, or your definitions will
## be overwritten by the makefile stubs above.

TARGET_DIR   = Project
BOARD        = est8240 Evaluation SBC
EST_PLATFORM = EST8240

RELEASE          = 

## EST requires a modified version of the ../all/usrConfig.c file. The
## file has been modified to include constructs that allow EST's emulator
## and backend to be used in place of a WDB agent on the target. 
USRCONFIG = usrConfig.c

##
## See Header before altering the EXTRA_DEFINE and MACH_EXTRA lines below.
##
EXTRA_DEFINE = $(EST_EXTRA_DEFINE) -D$(EST_PLATFORM) 
MACH_EXTRA       = $(EST_MACH_EXTRA) dec21x4xEnd.obj  \
                   Project.o \
                   MPC8240_Config.o \
                   MPC8240_BOARD.o \
                   MPC8240_System.o \
                   MPC8240_Err.o \
                   MPC8240_Interrupt.o \
                   MPC8240_mmu.o \
MPC8240_Dma0.o\
MPC8240_Epic.o\
MPC8240_Pci.o\
MPC8240_Dma1.o\
MPC8240_Ram.o\
MPC8240_Rom.o\
MPC8240_I2c.o\



USR_ENTRY       = usrInit

## The constants ROM_TEXT_ADRS, ROM_SIZE, and RAM_HIGH_ADRS are defined
## in config.h and Makefile. All definitions for these constants must be
## identical.  (can be fine-tuned for various configurations)
##
## The ROMRAM_MODEL construct allows a 'ROM Based' applicated to be 
## relocated to RAM. This allows easy debugging and allows code to be 
## restarted. This is a useful feature when debugging with the emulator.
## The ROMRAM_MODEL variable is equated in the rules.est file.


EST_RCFLAGS          = -DROM_BASED
ROM_BASE_ADRS        = 0xFFF00000 #fff00000         # Physical start of ROM
ROM_TEXT_ADRS        = 0xFFF00100 #fff00100         # ROM entry address
ROM_SIZE             = 0x00080000       #00080000         # number of bytes of ROM space
LOCAL_MEM_LOCAL_ADRS = 0x00000000 #00000000         # Physical start of RAM
LOCAL_MEM_SIZE       = 0x01000000     #01000000         # 16 Megbyte
RAM_LOW_ADRS         = 0x00100000     #00100000         # RAM text/data address
RAM_HIGH_ADRS        = 0x00E00000  #00E00000 - RAM text/data address

##   hex utility parameters
HEX_FLAGS       = -a $(ROM_TEXT_ADRS)

## Debug Information (-g -O0) -gdwarf -O0
#ADDED_CFLAGS =  $(EST_RCFLAGS)
ADDED_CFLAGS = -gdwarf -O2 -mhard-float $(EST_RCFLAGS)

LDFLAGS = -X -N -Map Project.map

## Only redefine make definitions above this point, or the expansion of 
## makefile target dependencies may be incorrect.

include $(TGT_DIR)/h/make/rules.bsp
include $(TGT_DIR)/h/make/rules.$(WIND_HOST_TYPE)

## EST Rules File
##include $(TGT_DIR)/config/$(TARGET_DIR)/rules.est