]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/lx-rocon.git/commitdiff
Update top level Makefile, add installation commands
authorMartin Meloun <meloumar@cmp.felk.cvut.cz>
Thu, 22 Aug 2013 14:48:22 +0000 (16:48 +0200)
committerMartin Meloun <meloumar@cmp.felk.cvut.cz>
Thu, 22 Aug 2013 14:48:22 +0000 (16:48 +0200)
Please not that top level Makefile uses its own commands for installation.

Makefile

index 50f85a39f4e2f686887f949aab3dc1e37d3a0a72..1baa58d1daea7187ef23074ab48adcbce320b4b2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,35 +1,74 @@
 # TOP LEVEL Makefile for lx-rocon
+# Files are copied to _build directory
+
+# Installation steps are copied to this makefile
 
-# 1) SW (match rocon config)
 CROSS_COMPILE ?= arm-elf-gcc
+BUILDDIR := $(CURDIR)/_build
+PATH := $(BUILDDIR):$(PATH)
+
+USB_BOOT_VID_PID ?= 0xdead:0x2263
+USB_APP_VID_PID ?= 0x1669:0x1023
+
+PROG_BASE ?= 0x9000
+PROG_SIZE ?= 0x37000
+
+# Attempt to create a build directory.
+$(shell [ -d ${BUILDDIR} ] || mkdir -p ${BUILDDIR})
+
+# Verify if it was successful.
+BUILDDIR_TEST := $(shell cd $(BUILDDIR) && /bin/pwd)
+$(if $(BUILDDIR_TEST),,$(error build directory "$(BUILDDIR)" does not exist))
 
 .PHONY: all
-all: post
+all: ulboot sw hw host
+
+.PHONY: ulboot
+ulboot:
+       make -C ulboot V=1
+       cp -a ulboot/_compiled/bin/ulboot-boot.bin $(BUILDDIR)/
+
+.PHONY: install-ulboot
+install-ulboot: $(BUILDDIR)/lpc21isp $(BUILDDIR)/ulboot-boot.bin
+       lpc21isp -bin $(BUILDDIR)/ulboot-boot.bin /dev/ttyUSB0 38400 12000
 
 .PHONY: sw
 sw:
        make -C sw V=1
+       cp -a sw/_compiled/bin/rocon-app.bin $(BUILDDIR)/
+       cp -a sw/_compiled/bin/rocon-sdram.bin $(BUILDDIR)/
+
+.PHONY: install-app
+install-app: $(BUILDDIR)/usb_sendhex $(BUILDDIR)/rocon-app.bin 
+       -usb_sendhex -d $(USB_APP_VID_PID) -r # Fails if we're already in bootloader
+       usb_sendhex -w -d $(USB_BOOT_VID_PID) -s $(PROG_BASE) -l $(PROG_SIZE)
+       sleep 2
+       usb_sendhex -d $(USB_BOOT_VID_PID) -s $(PROG_BASE) -f binary $(BUILDDIR)/rocon-app.bin
+       -usb_sendhex -d $(USB_BOOT_VID_PID) -r # FIXME: broken pipe yo-ho
+
+.PHONY: install-sdram
+install-sdram: $(BUILDDIR)/usb_sendhex $(BUILDDIR)/rocon-sdram.bin 
+       -usb_sendhex -d $(USB_APP_VID_PID) -r # Fails if we're already in bootloader
+       usb_sendhex -w -d $(USB_BOOT_VID_PID) -t 1 -s 0xA0000000 -f binary $(BUILDDIR)/rocon-sdram.bin
+       -usb_sendhex -d $(USB_BOOT_VID_PID) -g `usb_sendhex -d $(USB_BOOT_VID_PID) \
+       -s 0xA0000004 -l 4 -t 1 -u -f dump - | \
+       sed -n -e 's/^.*:\(..\) \(..\) \(..\) \(..\) */0x\4\3\2\1/p'`  # FIXME: broken pipe yo-ho
 
 .PHONY: host
 host:
        make -C host V=1
+       cp -a host/_compiled/bin/rocon_cmd $(BUILDDIR)/
+       cp -a host/_compiled/bin/usb_sendhex $(BUILDDIR)/
+       cp -a host/_compiled/bin/lpc21isp $(BUILDDIR)/
 
 .PHONY: hw
 hw:
        make -C hw
-
-.PHONY: post
-post: sw hw host
-       rm -rf _build
-       mkdir _build
-       cp -a hw/_build/lx-rocon.bin _build/
-       cp -a host/_compiled/bin/rocon_cmd _build/
-       cp -a host/_compiled/bin/usb_sendhex _build/
-       cp -a sw/_compiled/bin/rocon-app.bin _build/
-       cp -a sw/_compiled/bin/rocon-sdram.bin _build/
+       cp -a hw/_build/lx-rocon.bin $(BUILDDIR)/
 
 .PHONY: clean
 clean:
        make -C sw clean
        make -C host clean
        make -C hw clean
+       rm -rf $(BUILDDIR)