forked from dlove24/brickos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.user
68 lines (50 loc) · 2.25 KB
/
Makefile.user
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
### ==========================================================================
### $Id: Makefile.user,v 1.9 2003/02/14 05:48:49 stephmo Exp $
### FILE: Makefile.user - support for building programs run under brickOS
### brickOS - the independent LEGO Mindstorms OS
### --------------------------------------------------------------------------
### (this file is included by the demo/ and demo/c++ Makefiles)
# User application libraries. Comment out if linking
# them statically to kernel in Makefile.kernel.
LIBS = -lc -lmint -lfloat -lc++
# Linker command files dynamic executables.
DYNAMIC_LDS = $(KERNEL).lds
DLDFLAGS = -T $(DYNAMIC_LDS) -relax -L$(BRICKOS_ROOT)/lib
# Base addresses to determine relocation info.
BASE1 = 0xb000
BASE2 = 0xb210
# Add config.h to include path
CINC += -I$(BRICKOS_ROOT)/boot
# Allow setting LNP Host Address on command line
ifdef LNP_HOSTADDR
CDEFINES = -DCONF_LNP_HOSTADDR=$(LNP_HOSTADDR)
endif
############ new dynamic executables stuff
# How to build executables dynamically linked to the kernel
# Set DYNAMIC_TEXT, DOBJECTS, DYNAMIC_LDS appropriately.
%.dcoff: %.o $(DOBJECTS) $(DYNAMIC_LDS)
$(LD) $(DLDFLAGS) $*.o $(DOBJECTS) $(LIBS) -o $@ -Ttext $(BASE1) --oformat coff-h8300
# How to make barebones dymanic executable map files
%.dmap: %.dcoff
$(NM) $< | sort > $@
# How to disassemble coff kernel
%.dis: %.dcoff
$(OBJDUMP) $(ODFLAGS) $*.dcoff > $@
# How to merge map files with symbols
%.dis2: %.dmap %.dis
$(MERGEMAP) $*.dmap $*.dis > $@
# How to make coff files of dynamic executables (twice, for makelx)
%.dc1: %.o $(DOBJECTS) $(DYNAMIC_LDS)
$(LD) $(DLDFLAGS) $*.o $(DOBJECTS) $(LIBS) -o $@ --oformat coff-h8300 -Ttext $(BASE1)
%.dc2: %.o $(DOBJECTS) $(DYNAMIC_LDS)
$(LD) $(DLDFLAGS) $*.o $(DOBJECTS) $(LIBS) -o $@ --oformat coff-h8300 -Ttext $(BASE2)
# How to make srec files from coff files (twice, for makelx)
%.ds2: %.dc2
$(OBJCOPY) -I coff-h8300 -O symbolsrec $< $@
%.ds1: %.dc1
$(OBJCOPY) -I coff-h8300 -O symbolsrec $< $@
%.lx: %.ds1 %.ds2
$(MAKELX) $*.ds1 $*.ds2 $@
### --------------------------------------------------------------------------
### End of FILE: Makefile.user
### ==========================================================================