Build: simplfy makefile by outputting a .bin file

Change-Id: I85cea0011a819fff3789e121a89af05b24ddfbd7
This commit is contained in:
David Banks 2019-10-31 12:53:23 +00:00
parent da3651abf2
commit c2e80e2e4c

View File

@ -37,13 +37,11 @@ working/$(PROJECT).bit:
$(TARGET).bit: $(PROG).mem working/$(PROJECT).bit
data2mem -bm $(BMM_FILE) -bd $(PROG).mem -bt working/$(PROJECT).bit -o b $(TARGET).bit
$(PROG).mem: $(PROG).hex
srec_cat $< -Intel -Byte_Swap 2 -Data_Only -o tmp.mem -vmem 8
gawk ' BEGIN{FS=" ";} { $$1= ""; print}' tmp.mem > $@
rm tmp.mem
$(PROG).mem: $(PROG).bin
od -An -tx1 -w16 -v <$(PROG).bin >$(PROG).mem
$(PROG).hex : $(PROG).out
$(OBJCOPY) -R .eeprom -O ihex $(PROG).out $(PROG).hex
$(PROG).bin : $(PROG).out
$(OBJCOPY) -R .comment --reverse-bytes=2 -O binary $(PROG).out $(PROG).bin
$(PROG).out : $(OBJECTS)
$(CC) $(CFLAGS) -o $(PROG).out -Wl,-Map,$(PROG).map $^
@ -55,7 +53,7 @@ $(PROG).out : $(OBJECTS)
$(CC) $(CFLAGS) -Os -c $<
clean:
rm -f $(TARGET).bit $(TARGET).mcs $(PROG).mem $(PROG).hex $(PROG).out $(PROG).map *.o
rm -f $(TARGET).bit $(TARGET).mcs $(PROG).mem $(PROG).bin $(PROG).out $(PROG).map *.o
clobber: clean
rm -rf $(BMM_FILE) working/ iceconfig/