Skip to content

Commit

Permalink
The flash rule should depend upon the final .bin file [bootloader]
Browse files Browse the repository at this point in the history
Although OpenOCD supports ELF files, it will erase all the flash area,
(the application firmware will be erased). Flashing a raw binary file
only erases the necessary flash sectors.
  • Loading branch information
augustofg committed Feb 17, 2020
1 parent 8ad3966 commit 69e1a90
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bootloader/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ CFLAGS = -fdata-sections -ffunction-sections -g3 -Wall -mcpu=cortex-m3 -mlit
ASFLAGS = $(CFLAGS)
LDFLAGS = -T $(LDSCRIPT) -Wl,--gc-sections --specs=nano.specs --specs=nosys.specs

.PHONY: all clean flash burn hex bin
.PHONY: all clean flash

all: $(PRJ_NAME).bin

Expand All @@ -33,11 +33,11 @@ $(PRJ_NAME).elf: $(OBJ)
clean:
rm -f $(OBJ) $(PRJ_NAME).elf $(PRJ_NAME)-pad.elf $(PRJ_NAME).hex $(PRJ_NAME).bin $(SRCDIR)/*.d

flash: bin
flash: $(PRJ_NAME).bin
$(PROGRAMMER) $(PGFLAGS)

$(PRJ_NAME)-pad.elf: $(PRJ_NAME).elf
$(OBJCOPY) --gap-fill 0xFF --pad-to 0x10000 $< $@

$(PRJ_NAME).bin: $(PRJ_NAME)-pad.elf
$(OBJCOPY) -O binary $< $(PRJ_NAME).bin
$(OBJCOPY) -O binary $< $@

0 comments on commit 69e1a90

Please sign in to comment.