# Makefile - makefile for ppc405_0
#
# Copyright 1984-2002 Wind River Systems, Inc.
# Copyright 2003 Xilinx, Inc.
#
# TODO - Remove the template modification history and begin a new history
#        starting with version 01a and growing the history upward with
#	 each revision.
#
# modification history
# --------------------
#     18feb03,rmm  Created from templatePpc Makefile version 01g
#     05aug03,rmm  Added GETCWD for solaris support
#     13sep03,rmm  CR 177068: Added -g compiler option by default
#
# TODO - Update documentation.
#
# DESCRIPTION
# This file contains rules for building VxWorks for the ppc405_0 BSP.
#
# INCLUDES
#     makeTarget

CPU              = PPC405
TOOL             = gnu

TGT_DIR = $(WIND_BASE)/target

include $(TGT_DIR)/h/make/defs.bsp

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

# TODO - default files are sysLib.c, sysTffs.c and tycoDrv.c. Specify here the
# files to be documented bye make man. If the default files are OK, remove the
# DOC_FILES variable below

DOC_FILES	=

# TODO - Replace these examples with appropriate values.

TARGET_DIR	= ppc405_0
VENDOR		= Xilinx
BOARD		= ppc405_0

#
# 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.
# Specify values in hexadecimal, without a leading 0x.
#

# TODO - Setup the appropriate values here and in config.h

ROM_TEXT_ADRS	= ff800000 # ROM cold entry address
ROM_WARM_ADRS	= ff800008 # ROM warm entry address
ROM_SIZE	= 00040000 # number of bytes of ROM space
RAM_LOW_ADRS	= 00010000 # RAM text/data address for vxWorks
#RAM_HIGH_ADRS	= 00200000 # RAM text/data address for bootrom
RAM_HIGH_ADRS	= 04000000 # RAM text/data address for bootrom

USR_ENTRY	= usrInit

# Xilinx Chip Support Package modifications start here
#
# Notes about the values of CSP_DIR and EXTRA_INCLUDE
#
#   CSP_DIR is used to tell the compiler where Xilinx chip support package
#   header files are located. Its value is relative to the BSP directory
#   and is legal under Tornado 2.2 BSP design rules. Its definition is added
#   to EXTRA_INCLUDE.
#
#   So why not define CSP_DIR as csp/xsrc? This works fine when building
#   vxWorks from the command line using this makefile. The problem is that
#   the Project facility errors out when creating a project based on this
#   BSP. It seems that Project requires absolute paths in order to create
#   its dependency file list. Additionally, it seems to have problems dealing
#   with "\" characters in the path name. The complex syntax used to define
#   CSP_DIR works around both these issues and doesn't break the command line
#   make. These issues were seen with the Windows version of Tornado 2.2.
#   
# Notes about the values of EXTRA_DEFINE and MACH_EXTRA
#   
#   EXTRA_DEFINE is extended with -DXENV_VXWORKS so that the CSP drivers 
#   know they are being compiled in the VxWorks environment.
#
#   MACH_EXTRA is extended to contain all the csp wrappers
#

# Figure out how to find the current working directory based on host OS
ifeq ($(WIND_HOST_TYPE),x86-win32)
GETCWD = $(shell cd)
else
GETCWD = $(shell pwd)
endif

CSP_DIR = $(subst \,/,$(shell pwd)/ppc405_0_drv_csp/xsrc)
ADDED_CFLAGS   = -g
EXTRA_INCLUDE  = -I$(CSP_DIR)
EXTRA_DEFINE  += -DXENV_VXWORKS
MACH_EXTRA    += $(patsubst %.c, %.o, $(wildcard ppc405_0_drv_*.c))
#
#
# Xilinx Chip Support Package modifications end here


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

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

# TODO - Add any additional make targets or rules below this point.

