summaryrefslogtreecommitdiffstats
path: root/src/occApplet/productApplet/Makefile
blob: f95f41ff7758f2a7969148da527d6de3826c8fde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

ifndef ROOTPATH
ROOTPATH = $(shell pwd)/../../
export OCCROOT = $(ROOTPATH)
endif

#*******************************************************************************
# mk variable Declaration
#*******************************************************************************
OCC = ../../occ
BOOTLOADER = ../../occBootLoader
SSX = ../../ssx
PRODUCTAPPLET = .
LIB = ../../lib

# New product applet source files must to listed in productappletfiles.mk
# Note: New applets must be given an ID in src/occ/aplt/incl/appletId.

LDFLAGS = -L $(SSX)/ssx -L $(SSX)/ppc32 -L $(SSX)/ppc405 -L $(SSX)/pgp \
-L $(OCC) -L $(LIB) -lssx -lppc32 --oformat=elf32-powerpc -melf32ppc

buildImage = $(LD) -R $(OCC)/occ.out $(obj) -Tlinkscript $(LDFLAGS) \
-Map $(basename $(obj)).map -Bstatic -o $(basename $(obj)).out; \
$(OBJCOPY) -I elf32-powerpc -O binary $(basename $(obj)).out $(basename $(obj)).bin; \
$(OBJDUMP) -d $(basename $(obj)).out > $(basename $(obj)).dis; \
$(BOOTLOADER)/imageHdrScript $(basename $(obj)).bin `md5sum $(OCC)/occ.out | cut -c 1-4`; 

image = $(BOOTLOADER)/imageHdrScript $(basename $(obj)).bin combineImage; \
$(BOOTLOADER)/imageHdrScript $(basename $(obj)).out displaySize;
             
#*******************************************************************************
# Includes
#*******************************************************************************
include $(SSX)/pgp/ssx.mk
include productappletfiles.mk

INCLUDES = -I. -I$(OCC)/incl -I$(OCC)/errl -I$(OCC)/trac -I$(LIB) -I$(SSX)/ssx \
-I$(OCC)/sensor -I$(OCC) -I$(OCC)/rtls -I$(OCC)/cmdh -I$(OCC)/pss -I$(OCC)/gpe \
-I$(OCC)/aplt/incl -I$(OCC)/aplt -I$(OCC)/cent -I$(OCC)/proc -I$(OCC)/thread \
-I$(SSX)/ppc405 -I$(SSX)/pgp -I$(SSX)/ppc32 -I$(SSX)/pgp/registers

#*******************************************************************************
# Defs
#*******************************************************************************
DEFS += $(D)
DEFS += -DAPPLET_BUILD=1
DEFS += -DUSE_SSX_APP_CFG_H=1

# Note: Do not use SDA sections for product applet
GCC-CFLAGS = -c -g -Wall -fsigned-char -msoft-float -pipe \
-Wa,-m405 -m32 -mcpu=405 -mmultiple -mstring -meabi \
-ffreestanding -Os -mno-sdata

#*******************************************************************************
# Compilation 
#*******************************************************************************
all: $(PRDTAPLT_OBJECTS) 
	 $(CPP) -P $(DEFS) < linkProductApplet.cmd > linkscript
	 $(foreach obj,$(PRDTAPLT_OBJECTS),$(buildImage))

#*******************************************************************************
# combineImage 
#*******************************************************************************
.PHONY : combineImage
combineImage:
	 $(foreach obj,$(PRDTAPLT_OBJECTS),$(image))
	
#*******************************************************************************
# Clean
#*******************************************************************************
clean: 
	rm -f *.o *.out *.bin *.dis *.map *.hash linkscript

OpenPOWER on IntegriCloud