-
Notifications
You must be signed in to change notification settings - Fork 0
/
footer.mk
78 lines (50 loc) · 2.33 KB
/
footer.mk
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
74
75
PKG_BASE ?= $(CURDIR)/../../..
BASE=$(realpath $(PKG_BASE))
NF_TOOLS ?= $(BASE)/compiler/lib
# allow object files to be declared this way also
OBJS=${SRC:.c=.o}
$(TARGET): $(OBJS)
TARGETS ?= $(TARGET)
all: $(TARGETS)
$(START): nf2.s
$(SPE_AS) -O3 -march=sp $< -o $@
nf2.s: nf2.S
$(SPE_CPP) $(EXTRA_DEFINES) $< $@
########################################################
$(TARGETS): $(FUNC_LIB) $(START) $(MATH) $(FLOATING) $(EXTRA_LIB) $(ULIBS) $(NEW_ALLOC)
$(SPE_LD) $(filter %.o,$^) $(NEW_ALLOC) $(ULIBS) $(LDFLAGS) $(EXTRA_LIB) -o $@ --print-map > [email protected]
egrep "^ *0x0000000004" [email protected] |grep -v PROVIDE > [email protected]
#############################################################
#############################################################
clean:
rm -f $(TARGETS) $(TARGETS:=.haz) $(TARGETS:=.hcode) $(TARGETS:=.instr.enc) $(TARGETS:=.instr.hmif) $(TARGETS:=.map) $(TARGETS:=.*.mif) $(TARGETS:=.static) *.o *.s *.S debug_sched*
OBJDUMP=$(SPE_DIS)
OBJCOPY=$(SPE_PREFIX)-objcopy
embed: mif
exec:
$(NF_HOME)/bin/embed.sh
rif: $(TARGETS:=.instr.rif) $(TARGETS:=.data.rif) $(TARGETS:=.instr.mif) $(TARGETS:=.data.mif)
%.instr.rif: %.instr.mif
mif2rif $< $@ >&/dev/null; [ -s $@ ]
%.data.rif: %.data.mif
mif2rif $< $@ >&/dev/null; [ -s $@ ]
######################## Mif creation ##########################
mif: $(TARGETS:=.instr.mif) $(TARGETS:=.data.mif)
%.dmp : %
$(OBJDUMP) -D -z $< | awk '/^$$/{next;}$$2~"<"{next;}{print $0}' | cut -f 1,2 | tr -d ":" > $*.dmp
%.data.mif: %.dmp
awk 'BEGIN{mp=0;printf("WIDTH=32;\nDEPTH=65536;\n\nADDRESS_RADIX=HEX;\nDATA_RADIX=HEX;\n\nCONTENT BEGIN\n\n");} \
/data/{mp=1;next;}/bss/{mp=1;next;}/eh_/{mp=1;next;}/section/{mp=0;next;} \
(mp==1){v=strtonum("0x"$$1)/4-0x1010000; if($$2 == "Address") tt = "00000000"; else tt = $$2; printf("%08x : %s;\n",v,tt);} \
END {print "END;";}' \
$*.dmp > $@
%.instr.mif: %.dmp
awk 'BEGIN{mp=0;printf("WIDTH=32;\nDEPTH=65536;\n\nADDRESS_RADIX=HEX;\nDATA_RADIX=HEX;\n\nCONTENT BEGIN\n\n");} \
/text/{mp=1;next;}/section/{mp=0;next;} \
(mp==1){v=and(strtonum("0x"$$1),262143)/4;printf("%08x : %s;\n",v,$$2);} \
END {print "END;";}' \
$*.dmp > $@
embed_clean:
rm -f $(TARGETS:=.instr.rif) $(TARGETS:=.data.rif) $(TARGETS:=.instr.mif) $(TARGETS:=.data.mif)
rm -f instr.rif data.rif *.t *.rif *.mif *.raw debug_sched*.txt *.hcode *.haz *.hmif *.enc
redo: clean all embed