altos/stmf0: Construct .bin files for flash loaders
authorKeith Packard <keithp@keithp.com>
Fri, 18 Mar 2016 18:16:59 +0000 (11:16 -0700)
committerKeith Packard <keithp@keithp.com>
Fri, 18 Mar 2016 18:16:59 +0000 (11:16 -0700)
This builds a .bin file which can be used with dfu-util instead of
using openocd to load the initial flash loader.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/stmf0/Makefile-flash.defs

index 706b93eebaeb0e28372c2599c79175413887d8ca..29d6ae45b2eee46453e7444f91d6c5c6ad835a24 100644 (file)
@@ -39,17 +39,24 @@ LDFLAGS=$(CFLAGS) -L$(TOPDIR)/stmf0 -Wl,-Taltos-loader.ld
 
 PROGNAME=altos-flash
 PROG=$(HARDWARE)-$(PROGNAME)-$(VERSION).elf
+BIN=$(HARDWARE)-$(PROGNAME)-$(VERSION).bin
+
+MAKEBIN=$(TOPDIR)/../ao-tools/ao-makebin/ao-makebin
+FLASH_ADDR=0x08000000
+
+all: $(PROG) $(BIN)
 
 $(PROG): Makefile $(OBJ) altos-loader.ld
        $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS)
 
+$(BIN): $(PROG)
+       $(MAKEBIN) --output=$@ --base=$(FLASH_ADDR) $(PROG)
+       
 ao_product.h: ao-make-product.5c $(TOPDIR)/Version
        $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@
 
 $(OBJ): $(INC)
 
-all: $(PROG)
-
 distclean:     clean
 
 clean: