1 # TOP LEVEL Makefile for lx-rocon
2 # Files are copied to _build directory
4 # Installation steps are copied to this makefile
6 CROSS_COMPILE ?= arm-elf-gcc
7 BUILDDIR := $(CURDIR)/_build
8 PATH := $(BUILDDIR):$(PATH)
10 USB_BOOT_VID_PID ?= 0xdead:0x2263
11 USB_APP_VID_PID ?= 0x1669:0x1023
13 PROG_BASE ?= 0x00009000
14 PROG_SIZE ?= 0x00037000
16 # Attempt to create a build directory.
17 $(shell [ -d ${BUILDDIR} ] || mkdir -p ${BUILDDIR})
19 # Verify if it was successful.
20 BUILDDIR_TEST := $(shell cd $(BUILDDIR) && /bin/pwd)
21 $(if $(BUILDDIR_TEST),,$(error build directory "$(BUILDDIR)" does not exist))
24 all: ulboot sw hw host
29 cp -a ulboot/_compiled/bin/ulboot-boot.bin $(BUILDDIR)/
31 .PHONY: install-ulboot
32 install-ulboot: $(BUILDDIR)/lpc21isp $(BUILDDIR)/ulboot-boot.bin
33 lpc21isp -bin $(BUILDDIR)/ulboot-boot.bin /dev/ttyUSB0 38400 12000
38 cp -a sw/_compiled/bin/rocon-app.bin $(BUILDDIR)/
39 cp -a sw/_compiled/bin/rocon-sdram.bin $(BUILDDIR)/
42 install-app: $(BUILDDIR)/usb_sendhex $(BUILDDIR)/rocon-app.bin
43 -usb_sendhex -d $(USB_APP_VID_PID) -r # Fails if we're already in bootloader
45 usb_sendhex -w -d $(USB_BOOT_VID_PID) -s $(PROG_BASE) -l $(PROG_SIZE) -e
47 usb_sendhex -d $(USB_BOOT_VID_PID) -s $(PROG_BASE) -f binary $(BUILDDIR)/rocon-app.bin
51 -usb_sendhex -d $(USB_BOOT_VID_PID) -r # FIXME: broken pipe yo-ho
54 install-sdram: $(BUILDDIR)/usb_sendhex $(BUILDDIR)/rocon-sdram.bin
55 -usb_sendhex -d $(USB_APP_VID_PID) -r # Fails if we're already in bootloader
56 usb_sendhex -w -d $(USB_BOOT_VID_PID) -t 1 -s 0xA0000000 -f binary $(BUILDDIR)/rocon-sdram.bin
60 -usb_sendhex -d $(USB_BOOT_VID_PID) -g `usb_sendhex -d $(USB_BOOT_VID_PID) \
61 -s 0xA0000004 -l 4 -t 1 -u -f dump - | \
62 sed -n -e 's/^.*:\(..\) \(..\) \(..\) \(..\) */0x\4\3\2\1/p'` # FIXME: broken pipe yo-ho
65 install-fpga: $(BUILDDIR)/usb_sendhex $(BUILDDIR)/lx-rocon.pkg
66 usb_sendhex -w -d $(USB_APP_VID_PID) -t 1 -s 0xA1C00000 -f binary $(BUILDDIR)/lx-rocon.pkg
67 usb_sendhex -d $(USB_APP_VID_PID) -c 0xF000
72 cp -a host/_compiled/bin/rocon_cmd $(BUILDDIR)/
73 cp -a host/_compiled/bin/usb_sendhex $(BUILDDIR)/
74 cp -a host/_compiled/bin/lpc21isp $(BUILDDIR)/
79 cp -a hw/_build/lx-rocon.pkg $(BUILDDIR)/