1 | ############################################################################### |
---|
2 | # |
---|
3 | # Beaglebone Black makefile |
---|
4 | # |
---|
5 | # |
---|
6 | |
---|
7 | ifeq ($(UMONTOP),) |
---|
8 | $(error UMONTOP not set) |
---|
9 | endif |
---|
10 | |
---|
11 | ifeq ($(RTEMSPREFIX),) |
---|
12 | $(error RTEMSPREFIX not set) |
---|
13 | endif |
---|
14 | |
---|
15 | ifeq ($(RTEMSVERSION),) |
---|
16 | $(error RTEMSVERSION not set) |
---|
17 | endif |
---|
18 | |
---|
19 | PLATFORM = BEAGLEBONEBLACK |
---|
20 | TOPDIR = $(UMONTOP) |
---|
21 | TGTDIR = beagleboneblack |
---|
22 | CPUTYPE = arm |
---|
23 | FILETYPE = elf |
---|
24 | TOOLSET = RTEMS |
---|
25 | |
---|
26 | ifeq ($(TOOLSET),RTEMS) |
---|
27 | # |
---|
28 | # Using tools built by RTEMS Source Builder: |
---|
29 | # |
---|
30 | ABIDIR = $(RTEMSPREFIX)/lib/gcc/arm-rtems$(RTEMSVERSION)/4.9.2 |
---|
31 | TOOL_PREFIX = arm-rtems$(RTEMSVERSION) |
---|
32 | else |
---|
33 | # |
---|
34 | # Using tools installed by "sudo apt-get install gcc-arm-none-eabi"... |
---|
35 | # |
---|
36 | ABIDIR = /usr/lib/gcc/arm-none-eabi/4.8.2 |
---|
37 | TOOL_PREFIX = /usr/bin/arm-none-eabi |
---|
38 | endif |
---|
39 | |
---|
40 | LIBABIDIR = -L $(ABIDIR) |
---|
41 | COMMON_AFLAGS = -c -D PLATFORM_$(PLATFORM)=1 -D ASSEMBLY_ONLY |
---|
42 | CUSTOM_CFLAGS = -mcpu=cortex-a8 -O2 -isystem $(ABIDIR)/include -Wno-char-subscripts -mno-unaligned-access |
---|
43 | |
---|
44 | |
---|
45 | ############################################################################### |
---|
46 | # |
---|
47 | # Memory map configuration: |
---|
48 | # The following variables are used to establish the system's memory map. |
---|
49 | # |
---|
50 | BOOTROMBASE=0x402F0400 |
---|
51 | BOOTROMLEN=0x01b000 |
---|
52 | BOOTRAMBASE=0x80000000 |
---|
53 | BOOTRAMLEN=0x010000 |
---|
54 | RAMTSTROMBASE=0x80100000 |
---|
55 | RAMTSTROMLEN=0x100000 |
---|
56 | ATAGSIZE=0x1000 |
---|
57 | |
---|
58 | # These next two hard-coded values are used by the ramtst version of |
---|
59 | # uMon to allow it to know where these flash-based structures are located. |
---|
60 | MACADDRBASE=0x08000020 |
---|
61 | ALTTFSDEVTBLBASE=0x08000040 |
---|
62 | |
---|
63 | include $(TOPDIR)/make/common.make |
---|
64 | |
---|
65 | # Build each variable from a list of individual filenames... |
---|
66 | # |
---|
67 | LOCSSRC = |
---|
68 | CPUSSRC = vectors_arm.S |
---|
69 | LOCCSRC = cpuio.c etherdev.c am335x_sd.c am335x_mmc.c |
---|
70 | COMCSRC = arp.c cast.c cache.c chario.c cmdtbl.c \ |
---|
71 | docmd.c dhcp_00.c dhcpboot.c dns.c edit.c env.c ethernet.c \ |
---|
72 | flash.c gdb.c icmp.c if.c ledit_vt100.c monprof.c \ |
---|
73 | fbi.c font.c mprintf.c memcmds.c malloc.c moncom.c memtrace.c \ |
---|
74 | misccmds.c misc.c nand.c password.c redirect.c \ |
---|
75 | reg_cache.c sbrk.c sd.c \ |
---|
76 | start.c struct.c symtbl.c syslog.c tcpstuff.c tfs.c tfsapi.c \ |
---|
77 | tfsclean1.c tfscli.c tfsloader.c tfslog.c tftp.c timestuff.c \ |
---|
78 | tsi.c xmodem.c dosfs.c fatfs.c |
---|
79 | CPUCSRC = except_arm.c misc_arm.c strace_arm.c |
---|
80 | IODEVSRC = uart16550.c |
---|
81 | FLASHSRC = |
---|
82 | |
---|
83 | |
---|
84 | include $(TOPDIR)/make/objects.make |
---|
85 | |
---|
86 | OBJS = $(LOCSOBJ) $(CPUSOBJ) $(LOCCOBJ) $(CPUCOBJ) $(COMCOBJ) \ |
---|
87 | $(FLASHOBJ) $(IODEVOBJ) |
---|
88 | |
---|
89 | ######################################################################### |
---|
90 | # |
---|
91 | # Targets... |
---|
92 | |
---|
93 | # boot: |
---|
94 | # The default target is "boot", a shortcut to $(BUILDDIR)/boot.$(FILETYPE). |
---|
95 | # This builds the bootflash image that can be used by 'newmon' to |
---|
96 | # load a new version onto an already running system. |
---|
97 | # |
---|
98 | boot: $(BUILDDIR)/boot.$(FILETYPE) |
---|
99 | $(CC) $(ASMFLAGS) -D \ |
---|
100 | BIN_SIZE=$(shell wc --bytes build_$(PLATFORM)/boot.bin | cut -f 1 -d ' ') \ |
---|
101 | -o gp_header.o gp_header.S |
---|
102 | ${CC} ${ASMFLAGS} -o config_header.o config_header.S |
---|
103 | $(OBJCOPY) -O binary gp_header.o build_$(PLATFORM)/gp_header.bin |
---|
104 | ${OBJCOPY} -O binary config_header.o build_${PLATFORM}/config_header.bin |
---|
105 | @cat build_$(PLATFORM)/gp_header.bin build_$(PLATFORM)/boot.bin > build_$(PLATFORM)/MLO |
---|
106 | @cat build_$(PLATFORM)/config_header.bin build_$(PLATFORM)/gp_header.bin \ |
---|
107 | build_$(PLATFORM)/boot.bin > build_$(PLATFORM)/rawboot.bin |
---|
108 | @echo Boot version of uMon built under $(BUILDDIR) ... |
---|
109 | @ls $(BUILDDIR)/boot* |
---|
110 | @echo Boot version of uMon prepended with a GP header built under $(BUILDDIR) ... |
---|
111 | @ls $(BUILDDIR)/MLO |
---|
112 | @echo Boot version of uMon prepended with a Configuration header and a GP header built |
---|
113 | @echo under $(BUILDDIR) ... |
---|
114 | @ls $(BUILDDIR)/rawboot.bin |
---|
115 | |
---|
116 | # ramtst: |
---|
117 | # A shortcut to $(BUILDDIR)/ramtst.$(FILETYPE). This is a version of uMon |
---|
118 | # that resides strictly in RAM and is used for two main purposes: |
---|
119 | # 1. To test new monitor features prior to burning the boot flash. |
---|
120 | # 2. To be downloaded into the RAM space of a board that has no programmed |
---|
121 | # boot flash. This provides a running monitor that can then accept |
---|
122 | # an incoming bootflash image using 'newmon'. |
---|
123 | # |
---|
124 | ramtst: $(BUILDDIR)/ramtst.$(FILETYPE) |
---|
125 | @echo Ram-resident test version of uMon built under $(BUILDDIR) ... |
---|
126 | @ls $(BUILDDIR)/ramtst* |
---|
127 | |
---|
128 | $(BUILDDIR)/boot.$(FILETYPE): $(BUILDDIR) $(OBJS) libz.a \ |
---|
129 | libg.a Makefile |
---|
130 | $(CC) $(ASMFLAGS) -o rom_reset.o rom_reset.S |
---|
131 | $(MAKE_MONBUILT) |
---|
132 | sed -e s/ROMBASE/$(BOOTROMBASE)/ -e s/ROMLEN/$(BOOTROMLEN)/ \ |
---|
133 | -e s/DRAMBASE/$(BOOTRAMBASE)/ -e s/DRAMLEN/$(BOOTRAMLEN)/ -e s/ATAGSIZE/$(ATAGSIZE)/ \ |
---|
134 | $(PLATFORM)_$(@F:.$(FILETYPE)=.ldt) > $(PLATFORM)_$(@F:.$(FILETYPE)=.ld) |
---|
135 | $(LINK) -e coldstart $(OBJS) monbuilt.o libz.a \ |
---|
136 | libg.a $(LIBABIDIR) $(LIBGCC) |
---|
137 | $(MAKE_BINARY) |
---|
138 | $(MAKE_GNUSYMS) |
---|
139 | |
---|
140 | $(BUILDDIR)/ramtst.$(FILETYPE): $(BUILDDIR) $(OBJS) libz.a \ |
---|
141 | libg.a Makefile |
---|
142 | $(CC) $(ASMFLAGS) -o ram_reset.o ram_reset.S |
---|
143 | $(MAKE_MONBUILT) |
---|
144 | sed -e s/RAMTSTROMBASE/$(RAMTSTROMBASE)/ \ |
---|
145 | -e s/RAMTSTROMLEN/$(RAMTSTROMLEN)/ -e s/ATAGSIZE/$(ATAGSIZE)/ \ |
---|
146 | -e s/MACADDRBASE/$(MACADDRBASE)/ -e s/ALTTFSDEVTBLBASE/$(ALTTFSDEVTBLBASE)/ \ |
---|
147 | $(PLATFORM)_$(@F:.$(FILETYPE)=.ldt) > $(PLATFORM)_$(@F:.$(FILETYPE)=.ld) |
---|
148 | |
---|
149 | $(LINK) -e coldstart $(OBJS) monbuilt.o libz.a libg.a $(LIBGCC) |
---|
150 | $(MAKE_BINARY) |
---|
151 | $(MAKE_GNUSYMS) |
---|
152 | |
---|
153 | include $(TOPDIR)/make/rules.make |
---|
154 | |
---|
155 | |
---|
156 | ######################################################################### |
---|
157 | # |
---|
158 | # Miscellaneous... |
---|
159 | cscope_local: |
---|
160 | ls rom_reset.S ram_reset.S >cscope.files |
---|
161 | ls $(FLASHDIR)/s29gl512n_16x1.c >>cscope.files |
---|
162 | ls $(FLASHDIR)/s29gl512n_16x1.h >>cscope.files |
---|
163 | |
---|
164 | help_local: |
---|
165 | |
---|
166 | varcheck: |
---|