summaryrefslogtreecommitdiff
path: root/platforms/arm_atsam
diff options
context:
space:
mode:
Diffstat (limited to 'platforms/arm_atsam')
-rw-r--r--platforms/arm_atsam/flash.mk11
1 files changed, 11 insertions, 0 deletions
diff --git a/platforms/arm_atsam/flash.mk b/platforms/arm_atsam/flash.mk
index f31d4b4d95..8152610ceb 100644
--- a/platforms/arm_atsam/flash.mk
+++ b/platforms/arm_atsam/flash.mk
@@ -3,9 +3,20 @@
# Architecture or project specific options
#
+MDLOADER_CLI ?= mdloader
+
+define EXEC_MDLOADER
+ $(MDLOADER_CLI) --first --download $(BUILD_DIR)/$(TARGET).bin --restart
+endef
+
+mdloader: bin
+ $(call EXEC_MDLOADER)
+
flash: bin
ifneq ($(strip $(PROGRAM_CMD)),)
$(UNSYNC_OUTPUT_CMD) && $(PROGRAM_CMD)
+else ifeq ($(strip $(ARM_ATSAM)),SAMD51J18A)
+ $(UNSYNC_OUTPUT_CMD) && $(call EXEC_MDLOADER)
else
$(PRINT_OK); $(SILENT) || printf "$(MSG_FLASH_ARCH)"
endif