From ca7ca4b676595f2d969c42e8e5d01958273c09a2 Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Mon, 10 Aug 2015 19:55:43 +0200 Subject: [PATCH] change firmwares to "b1n" also slight smartflash/Makefile bugfixes and main Makefile enhancement --- .gitignore | 2 +- Makefile | 29 ++++++++--------------------- Makefile.inc | 8 ++++---- bootloader/main.c | 17 ++++++++--------- l0dables/Makefile | 11 ++++++----- smartflash/Makefile | 25 ++++++++++++++----------- 6 files changed, 41 insertions(+), 51 deletions(-) diff --git a/.gitignore b/.gitignore index 7047396..0a2aeab 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ *.dfu *.map *.elf -*.bin +*.b1n *.gen .deps flashapp/xsvf.inc diff --git a/Makefile b/Makefile index c6bf5bc..dc1642a 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,11 @@ -APP?=testapp - -all: lib hackrf subdirs $(APP).dfu $(APP).bin +all: lib hackrf subdirs subdirs: $(MAKE) -C testapp $(MAKE) -C bootloader $(MAKE) -C flashapp $(MAKE) -C l0dables + $(MAKE) -C smartflash libopencm3/README: git submodule init @@ -21,28 +20,16 @@ hackrf/Readme.md: git submodule init git submodule update -hackrf: hackrf/Readme.md +hackrf/hackrf.b1n: + $(MAKE) -C hackrf -$(APP)/$(APP).bin: - $(MAKE) -C $(APP) $(APP).bin - -$(APP)/$(APP).dfu: - $(MAKE) -C $(APP) $(APP).dfu - -$(APP).bin: $(APP)/$(APP).bin - cp $< $@ - -$(APP).dfu: $(APP)/$(APP).dfu - cp $< $@ +hackrf: hackrf/Readme.md hackrf/hackrf.b1n clean: - rm -f *.bin *.dfu - $(MAKE) -C $(APP) clean - $(MAKE) -C flashapp clean + $(MAKE) -C testapp clean $(MAKE) -C bootloader clean + $(MAKE) -C flashapp clean $(MAKE) -C l0dables clean $(MAKE) -C smartflash clean + $(MAKE) -C hackrf hack-clean # cd libopencm3 && make clean - -flash: $(APP).dfu - $(DFUUTIL) --device 1fc9:000c --alt 0 --download $(APP).dfu diff --git a/Makefile.inc b/Makefile.inc index 30e69cd..42076e7 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -42,7 +42,7 @@ df = $(DEPDIR)/$(*F) $(CC) $(CFLAGS) $(INCLUDE_PATHS) -o $@ $< $(CC) -MM $(CFLAGS) $(INCLUDE_PATHS) $< > $(df).d -%.bin: %.elf +%.b1n: %.elf $(OBJCOPY) $(OCFLAGS) -O binary $< $@ %.c1d: %.o $(DEPDIR) $(LDSCRIPT) @@ -57,14 +57,14 @@ df = $(DEPDIR)/$(*F) $(CC) $(LDFLAGS) -o $(*F).elf $< $(LIB_PATHS) $(LIBS) $(OBJCOPY) $(OCFLAGS) -O binary $(*F).elf $@ -%.dfu: %.bin +%.dfu: %.b1n $(DFUTOOL) $< $@ ifdef APP -all: $(APP).dfu $(APP).bin +all: $(APP).dfu $(APP).b1n clean:: - -rm -f $(OBJS) $(APP).elf $(APP).bin $(APP).dfu $(APP).map + -rm -f $(OBJS) $(APP).elf $(APP).b1n $(APP).dfu $(APP).map flash: $(APP).dfu $(DFUUTIL) --device 1fc9:000c --alt 0 --download $(APP).dfu diff --git a/bootloader/main.c b/bootloader/main.c index b800db2..19d8f20 100644 --- a/bootloader/main.c +++ b/bootloader/main.c @@ -74,7 +74,7 @@ void doRealExec(int silent){ FRESULT res; int sres; - sres=selectFile(filename,"BIN"); + sres=selectFile(filename,"B1N"); if(sres<0){ if(!silent){ lcdPrintln("Select ERROR"); @@ -86,18 +86,17 @@ void doRealExec(int silent){ if(sres==0){ lcdPrintln("set as default:"); res=writeFile(BOOTCFG, filename, strlen(filename)+1); - if(res<0){ - lcdPrint("write Error:"); - lcdPrintln(IntToStr(-res,3,0)); - lcdPrintln(f_get_rc_string(res)); - lcdDisplay(); - getInputWait(); - }else{ + if(res<0){ + lcdPrint("write Error:"); + lcdPrintln(IntToStr(-res,3,0)); + lcdPrintln(f_get_rc_string(res)); + lcdDisplay(); + getInputWait(); + }else{ lcdPrint("wrote "); lcdPrint(IntToStr(res,3,0)); lcdPrintln(" bytes."); lcdDisplay(); - getInputWait(); }; }; lcdPrintln("Loading:"); diff --git a/l0dables/Makefile b/l0dables/Makefile index f644960..b94cdcf 100644 --- a/l0dables/Makefile +++ b/l0dables/Makefile @@ -1,9 +1,9 @@ -BIN=blinky.c1d invaders.c1d mandel.c1d snake.c1d bricks.c1d nick_scr0ll.c1d nick_w0rpcore.c1d nick_matrix.c1d nick_plain.c1d nick_invaders.c1d -NIK=nick_scr0ll.n1k nick_w0rpcore.n1k nick_plain.n1k +C1D=blinky.c1d invaders.c1d mandel.c1d snake.c1d bricks.c1d +N1K=nick_scr0ll.n1k nick_w0rpcore.n1k nick_matrix.n1k nick_plain.n1k nick_invaders.n1k TABLEFILES=jumptable.c jumptable.h usetable.h -l0dables: usetable.h $(BIN) $(NIK) +l0dables: usetable.h $(C1D) $(N1K) CFLAGS=-Wno-unused-variable -DRAD1O -DLPC43XX_M4 CFLAGS+=-mlong-calls # XXX: do we need those? @@ -17,5 +17,6 @@ $(TABLEFILES): EXPORTS mktable.pl clean:: $(RM) $(TABLEFILES) - $(RM) $(BIN:%.c1d=%.o) $(BIN:%.c1d=%.elf) $(BIN) - $(RM) $(NIK:%.n1k=%.o) $(NIK:%.n1k=%.elf) $(NIK) + $(RM) -f *.n1k *.c1d *.o *.elf +# $(RM) $(C1D:%.c1d=%.o) $(C1D:%.c1d=%.elf) $(C1D) +# $(RM) $(N1K:%.n1k=%.o) $(N1K:%.n1k=%.elf) $(N1K) diff --git a/smartflash/Makefile b/smartflash/Makefile index a9451ca..4e57bf3 100644 --- a/smartflash/Makefile +++ b/smartflash/Makefile @@ -1,7 +1,9 @@ # Makefile to create filesystem image and flash rad10 badge -default: gather image -all: build gather image run +default: gather +test: build gather + $(MAKE) UDISK=test image +all: build gather run fsdir?=IMG mountpoint?=/mnt @@ -10,26 +12,26 @@ hdrimg?=header.img fullimg?=full.img APP=../flashapp/flashapp.dfu FILEORDER= \ - hackrf.bin \ - testapp.bin + hackrf.b1n \ + testapp.b1n gather: @echo @echo '### Gathering contents for image' [ ! -d $(fsdir) ] && mkdir $(fsdir) || true - cp ../hackrf/firmware/hackrf_usb/build/hackrf_usb.bin $(fsdir)/hackrf.bin - cp ../testapp/testapp.bin $(fsdir)/ + cp ../hackrf/firmware/hackrf_usb/build/hackrf_usb.bin $(fsdir)/hackrf.b1n + cp ../testapp/testapp.b1n $(fsdir)/ -cp ../l0dables/*.c1d $(fsdir)/ -for a in ../l0dables/*.n1k ; do b=$${a##*/}; cp $$a ${fsdir}/$${b#nick_} ; done cp ../hackrf/firmware/cpld/sgpio_if/default.xsvf $(fsdir)/cpld.xsv # Add f0nts, images, l0dables, etc. cp ../files/* $(fsdir)/ - echo -n "testapp.bin" > $(fsdir)/boot.cfg + echo -n "testapp.b1n" > $(fsdir)/boot.cfg cp ../flashapp/flashapp.dfu . @echo @echo '### Creating boot header image' dd if=/dev/zero bs=1024 count=512 |tr "\000" "\377" > $(hdrimg) - dd if=../bootloader/boot.bin of=$(hdrimg) conv=notrunc + dd if=../bootloader/boot.b1n of=$(hdrimg) conv=notrunc run: ./FLASHgui @@ -39,9 +41,10 @@ rebuild: build gather build: @echo @echo '### Building everything' - cd ../hackrf/firmware/hackrf_usb/build && make - cd ../testapp && make testapp.bin - cd ../bootloader && make boot.bin +# cd ../hackrf/firmware/hackrf_usb/build && make + cd ../hackrf && make lib hackrf-usb + cd ../testapp && make testapp.b1n + cd ../bootloader && make boot.b1n cd ../flashapp && make flashapp.dfu cd ../l0dables && make