Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uf2-verision.h #110

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,16 @@ INCLUDES += -Ilib/samd21/samd21a/include/
endif

ifeq ($(CHIP_FAMILY), samd51)
ifeq ($(findstring SAME51,$(CHIP_VARIANT)),SAME51)
INCLUDES += -Ilib/same51/include/
else
ifeq ($(findstring SAME54,$(CHIP_VARIANT)),SAME54)
INCLUDES += -Ilib/same54/include/
else
INCLUDES += -Ilib/samd51/include/
endif
endif
endif

COMMON_SRC = \
src/flash_$(CHIP_FAMILY).c \
Expand Down Expand Up @@ -138,7 +142,7 @@ qc \n\
" > $(BUILD_PATH)/flash.jlink

jlink-flash: $(BUILD_PATH)/$(NAME).bin $(BUILD_PATH)/flash.jlink
jlinkexe -if swd -device AT$(CHIP_VARIANT) -speed 4000 -CommanderScript $(BUILD_PATH)/flash.jlink
JLinkExe -if swd -device AT$(CHIP_VARIANT) -speed 4000 -CommanderScript $(BUILD_PATH)/flash.jlink

wait:
sleep 5
Expand All @@ -163,14 +167,14 @@ $(EXECUTABLE): $(OBJECTS)
@echo

$(BUILD_PATH)/uf2_version.h: Makefile
echo "#define UF2_VERSION_BASE \"$(UF2_VERSION_BASE)\""> $@
echo #define UF2_VERSION_BASE "$(UF2_VERSION_BASE)"> $@

$(SELF_EXECUTABLE): $(SELF_OBJECTS)
$(CC) -L$(BUILD_PATH) $(LDFLAGS) \
-T$(SELF_LINKER_SCRIPT) \
-Wl,-Map,$(BUILD_PATH)/update-$(NAME).map -o $(BUILD_PATH)/update-$(NAME).elf $(SELF_OBJECTS)
arm-none-eabi-objcopy -O binary $(BUILD_PATH)/update-$(NAME).elf $(BUILD_PATH)/update-$(NAME).bin
python2 lib/uf2/utils/uf2conv.py -b $(BOOTLOADER_SIZE) -c -o $@ $(BUILD_PATH)/update-$(NAME).bin
python lib/uf2/utils/uf2conv.py -b $(BOOTLOADER_SIZE) -c -o $@ $(BUILD_PATH)/update-$(NAME).bin

$(BUILD_PATH)/%.o: src/%.c $(wildcard inc/*.h boards/*/*.h) $(BUILD_PATH)/uf2_version.h
echo "$<"
Expand All @@ -180,7 +184,7 @@ $(BUILD_PATH)/%.o: $(BUILD_PATH)/%.c
$(CC) $(CFLAGS) $(BLD_EXTA_FLAGS) $(INCLUDES) $< -o $@

$(BUILD_PATH)/selfdata.c: $(EXECUTABLE) scripts/gendata.py src/sketch.cpp
python2 scripts/gendata.py $(BOOTLOADER_SIZE) $(EXECUTABLE)
python scripts/gendata.py $(BOOTLOADER_SIZE) $(EXECUTABLE)

clean:
rm -rf build
Expand All @@ -207,8 +211,11 @@ drop-board: all
mkdir -p build/drop/$(BOARD)
cp $(SELF_EXECUTABLE) build/drop/$(BOARD)/
cp $(EXECUTABLE) build/drop/$(BOARD)/
# .ino works only for SAMD21 right now; suppress for SAMD51
ifeq ($(CHIP_FAMILY),samd21)
cp $(SELF_EXECUTABLE_INO) build/drop/$(BOARD)/
cp boards/$(BOARD)/board_config.h build/drop/$(BOARD)/
endif

drop-pkg:
mv build/drop build/uf2-samd21-$(UF2_VERSION_BASE)
Expand All @@ -217,9 +224,10 @@ drop-pkg:
rm -rf build/uf2-samd21-$(UF2_VERSION_BASE)

all-boards:
for f in `cd boards; ls` ; do "$(MAKE)" BOARD=$$f drop-board || break; done
for f in `cd boards; ls` ; do "$(MAKE)" BOARD=$$f drop-board || break -1; done

drop: all-boards drop-pkg

$(SUBMODULES):
git submodule update --init --recursive