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