Bug fix - added endian swap for MDIO parameters
[keystone-rtos/ibl.git] / src / make / makestg2
1 #*****************************************************************************
2 #* FILE PURPOSE: 2nd stage makefile for the intermediate boot loader
3 #*****************************************************************************
4 #* FILE NAME: makestg2
5 #*
6 #* DESCRIPTION: This makefile is invoked with build specific options
7 #*
8 #******************************************************************************
10 ifndef IBL_ROOT
11         IBL_ROOT=..
12 endif
14 MODULES= main device ethboot nandboot driver hw interp ecc
15 CLEAN_MODULES=$(addprefix clean_,$(MODULES))
17 TARGETS= c6472 c6474 c6474l c6455 c6457
19 COMMON_SYMBOLS= hwI2Cinit hwI2cMasterRead iblBootBtbl
21 ifeq ($(ENDIAN),little)
22         HEX_OPT= -order L
23         IEXT=     le
24 else
25         HEX_OPT= -order M
26         IEXT=     be
27 endif
29 ifeq ($(TARGET),c6474)
30   COMPACT= -compact
31 else
32   COMPACT=
33 endif
35 include $(IBL_ROOT)/make/$(ARCH)/makedefs.mk
37 export ARCH
38 export TARGET
40 $(TARGETS): iblMain
42 i2cRom:
43         ../util/romparse/romparse $(COMPACT) ibl_$(TARGET)/i2crom.map
44         $(CP) i2crom.ccs ibl_$(TARGET)/i2crom.ccs
45         $(CP) i2crom.ccs ibl_$(TARGET)/i2crom.dat
46         $(RM) i2crom.ccs ibl_le.b ibl.b
48 # Target compare checks if the iblInit is compiled the same for both endians
49 compare:
50         @echo -
51         @sh -c 'if diff -q ibl_$(TARGET)/ibl_init.le.ccs ibl_$(TARGET)/ibl_init.be.ccs ; then echo IBL init endian neutral ; else echo !!! WARNING !!!! IBL ini NOT endian neutral !!! ; fi '
52         @echo -
54 # For the init code a raw image is created as well as the i2c code to verify
55 # endian independent code is generated. The symbols required for linking
56 # the full application are then extracted
57 iblInit: $(MODULES) utils
58         cat ibl_$(TARGET)/ibl_init_objs_template.inc | sed -e s/ENDIAN_TAG/$(IEXT)/g > ibl_$(TARGET)/ibl_init_objs.inc
59         $(LD) -o ibl_$(TARGET)/ibl_$(TARGET)_init.out -m ibl_$(TARGET)/ibl_$(TARGET)_init.map ibl_$(TARGET)/ibl_init.cmd $(RTLIBS)
60         cp ibl_$(TARGET)/ibl_$(TARGET)_init.out ibl_$(TARGET)/ibl_$(TARGET)_init.$(IEXT).out
61         rm -f ibl_$(TARGET)/ibl_init_obj.inc
63         hex6x $(HEX_OPT) ibl_$(TARGET)/ibl_init_image.rmd ibl_$(TARGET)/ibl_$(TARGET)_init.out
64         $(CP) ibl_le.b ibl_$(TARGET)/ibl.b
65         ../util/btoccs/b2ccs ibl_$(TARGET)/ibl.b ibl_$(TARGET)/ibl_init.$(IEXT).ccs
67         hex6x $(HEX_OPT) ibl_$(TARGET)/ibl_init.rmd ibl_$(TARGET)/ibl_$(TARGET)_init.out
68         ../util/bconvert/bconvert64x -$(IEXT) ibl_le.b ibl.b
69         $(CP) ibl.b ibl_$(TARGET)
70         ../util/btoccs/b2i2c ibl_$(TARGET)/ibl.b ibl_$(TARGET)/ibl.i2c.b
71         ../util/btoccs/b2ccs ibl_$(TARGET)/ibl.i2c.b ibl_$(TARGET)/ibl_init.i2c.$(IEXT).ccs
73         bash ../util/symExtract/symExtract ibl_$(TARGET)/ibl_$(TARGET)_init.map ibl_$(TARGET)/ibl_init_symbols.inc $(COMMON_SYMBOLS)
75         
76 iblMain: iblInit $(MODULES)
77         cat ibl_$(TARGET)/ibl_objs_template.inc | sed -e s/ENDIAN_TAG/$(IEXT)/g > ibl_$(TARGET)/ibl_objs.inc
78         $(LD) -o ibl_$(TARGET)/ibl_$(TARGET).out -m ibl_$(TARGET)/ibl_$(TARGET).$(IEXT).map  ibl_$(TARGET)/ibl.cmd $(RTLIBS)
79         cp ibl_$(TARGET)/ibl_$(TARGET).out ibl_$(TARGET)/ibl_$(TARGET).$(IEXT).out
80         rm -f ibl_$(TARGET)/ibl_obj.inc
82         hex6x $(HEX_OPT) ibl_$(TARGET)/ibl.rmd ibl_$(TARGET)/ibl_$(TARGET).out
83         ../util/bconvert/bconvert64x -$(IEXT) ibl_le.b ibl.b
84         $(CP) ibl.b ibl_$(TARGET)
85         ../util/btoccs/b2i2c ibl_$(TARGET)/ibl.b ibl_$(TARGET)/ibl.i2c.b
86         ../util/btoccs/b2ccs ibl_$(TARGET)/ibl.i2c.b ibl_$(TARGET)/ibl.i2c.$(IEXT).ccs
89 $(MODULES):
90         @echo making $@
91         make -C $(IBL_ROOT)/$@/$(ARCH)/make $@
93 utils:
94         make -C $(IBL_ROOT)/util/btoccs
95         make -C $(IBL_ROOT)/util/romparse TARGET=$(TARGET)
96         make -C $(IBL_ROOT)/util/i2cRead  TARGET=$(TARGET) $(TARGET)
97         make -C $(IBL_ROOT)/util/i2cWrite TARGET=$(TARGET) $(TARGET)
98         make -C $(IBL_ROOT)/util/i2cConfig $(TARGET)
99         make -C $(IBL_ROOT)/util/bconvert
101 clean: $(CLEAN_MODULES)
102         
104 $(CLEAN_MODULES):
105         @echo cleaning $(subst clean_, ,$@)
106         make -C $(IBL_ROOT)/$(subst clean_,,$@)/$(ARCH)/make clean
107         
108 cleant:
109         rm -rf ibl_$(TARGET)/ibl_$(TARGET).out
110         rm -rf ibl_$(TARGET)/ibl_$(TARGET).map
111         rm -rf ibl_$(TARGET)/ibl_le.b
112         rm -rf ibl_$(TARGET)/ibl.b
113         rm -rf ibl_$(TARGET)/ibl.i2c.b
114         rm -rf ibl_$(TARGET)/ibl.i2c.ccs
115         rm -rf ibl_$(TARGET)/i2crom.ccs
116