Two stage load of ibl from I2C
[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
43 # For the init code a raw image is created as well as the i2c code to verify
44 # endian independent code is generated. The symbols required for linking
45 # the full application are then extracted
46 iblInit: $(MODULES) utils
47         $(LD) -o ibl_$(TARGET)/ibl_$(TARGET)_init.out -m ibl_$(TARGET)/ibl_$(TARGET)_init.map ibl_$(TARGET)/ibl_init.cmd $(RTLIBS)
49         hex6x $(HEX_OPT) ibl_$(TARGET)/ibl_init_image.rmd ibl_$(TARGET)/ibl_$(TARGET)_init.out
50         $(CP) ibl_le.b ibl_$(TARGET)/ibl.b
51         ../util/btoccs/b2ccs ibl_$(TARGET)/ibl.b ibl_$(TARGET)/ibl_init.$(IEXT).ccs
53         hex6x $(HEX_OPT) ibl_$(TARGET)/ibl_init.rmd ibl_$(TARGET)/ibl_$(TARGET)_init.out
54         ../util/bconvert/bconvert64x -$(IEXT) ibl_le.b ibl.b
55         $(CP) ibl.b ibl_$(TARGET)
56         ../util/btoccs/b2i2c ibl_$(TARGET)/ibl.b ibl_$(TARGET)/ibl.i2c.b
57         ../util/btoccs/b2ccs ibl_$(TARGET)/ibl.i2c.b ibl_$(TARGET)/ibl.i2c.$(IEXT).ccs
59         bash ../util/symExtract/symExtract ibl_$(TARGET)/ibl_$(TARGET)_init.map ibl_$(TARGET)/ibl_init_symbols.inc $(COMMON_SYMBOLS)
61         
62 iblMain: iblInit $(MODULES)
63         $(LD) -o ibl_$(TARGET)/ibl_$(TARGET).out -m ibl_$(TARGET)/ibl_$(TARGET).map  ibl_$(TARGET)/ibl.cmd $(RTLIBS)
64         hex6x $(HEX_OPT) ibl_$(TARGET)/ibl.rmd ibl_$(TARGET)/ibl_$(TARGET).out
65         ../util/bconvert/bconvert64x -$(IEXT) ibl_le.b ibl.b
66         $(CP) ibl.b ibl_$(TARGET)
67         ../util/btoccs/b2i2c ibl_$(TARGET)/ibl.b ibl_$(TARGET)/ibl.i2c.b
68         ../util/btoccs/b2ccs ibl_$(TARGET)/ibl.i2c.b ibl_$(TARGET)/ibl.i2c.$(IEXT).ccs
69         ../util/romparse/romparse $(COMPACT) ibl_$(TARGET)/i2crom_$(IEXT).map
70         $(CP) i2crom.ccs ibl_$(TARGET)/i2crom_$(IEXT).ccs
71         $(CP) i2crom.ccs ibl_$(TARGET)/i2crom_$(IEXT).dat
72         $(RM) i2crom.ccs ibl_le.b ibl.b
75 $(MODULES):
76         @echo making $@
77         make -C $(IBL_ROOT)/$@/$(ARCH)/make $@
80 utils:
81         make -C $(IBL_ROOT)/util/btoccs
82         make -C $(IBL_ROOT)/util/romparse TARGET=$(TARGET)
83         make -C $(IBL_ROOT)/util/i2cRead  TARGET=$(TARGET) $(TARGET)
84         make -C $(IBL_ROOT)/util/i2cWrite TARGET=$(TARGET) $(TARGET)
85         make -C $(IBL_ROOT)/util/i2cConfig $(TARGET)
86         make -C $(IBL_ROOT)/util/bconvert
88 clean: $(CLEAN_MODULES)
89         
91 $(CLEAN_MODULES):
92         @echo cleaning $(subst clean_, ,$@)
93         make -C $(IBL_ROOT)/$(subst clean_,,$@)/$(ARCH)/make clean
94         
95 cleant:
96         rm -rf ibl_$(TARGET)/ibl_$(TARGET).out
97         rm -rf ibl_$(TARGET)/ibl_$(TARGET).map
98         rm -rf ibl_$(TARGET)/ibl_le.b
99         rm -rf ibl_$(TARGET)/ibl.b
100         rm -rf ibl_$(TARGET)/ibl.i2c.b
101         rm -rf ibl_$(TARGET)/ibl.i2c.ccs
102         rm -rf ibl_$(TARGET)/i2crom.ccs
103