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
70 install-tumbl: $(BUILDDIR)/usb_sendhex $(BUILDDIR)/imem.bin $(BUILDDIR)/dmem.bin
71 usb_sendhex -d $(USB_APP_VID_PID) -c 0xF100 -a 0x0001
72 usb_sendhex -w -d $(USB_APP_VID_PID) -t 3 -s 0x00000000 -f binary $(BUILDDIR)/imem.bin
73 usb_sendhex -w -d $(USB_APP_VID_PID) -t 3 -s 0x00001000 -f binary $(BUILDDIR)/dmem.bin
74 usb_sendhex -d $(USB_APP_VID_PID) -c 0xF100 -a 0x0000
76 .PHONY: install-firmware
77 install-firmware: $(BUILDDIR)/usb_sendhex $(BUILDDIR)/fw_lxmaster.bin
78 usb_sendhex -w -d $(USB_APP_VID_PID) -t 1 -s 0xA1C00000 -f binary $(BUILDDIR)/fw_lxmaster.bin
79 usb_sendhex -d $(USB_APP_VID_PID) -c 0xF024 -a `stat -L -c %s $(BUILDDIR)/fw_lxmaster.bin` # Upload LX MASTER firmware
80 usb_sendhex -d $(USB_APP_VID_PID) -c 0xF011 -a 0 # Start IRC
81 usb_sendhex -d $(USB_APP_VID_PID) -c 0xF023 -a 0 # Setup LX Master
82 usb_sendhex -d $(USB_APP_VID_PID) -c 0xF021 -a 0 # Start LX Master
87 cp -a host/_compiled/bin/rocon_cmd $(BUILDDIR)/
88 cp -a host/_compiled/bin/usb_sendhex $(BUILDDIR)/
89 cp -a host/_compiled/bin/lpc21isp $(BUILDDIR)/
94 cp -a hw/_build/lx-rocon.pkg $(BUILDDIR)/
95 cp -a hw/_build/imem.bin $(BUILDDIR)/
96 cp -a hw/_build/dmem.bin $(BUILDDIR)/
97 cp -a firmware/lxmaster.bin $(BUILDDIR)/fw_lxmaster.bin