summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrobert-hh <robert@hammelrath.com>2021-05-17 12:31:11 +0200
committerDamien George <damien@micropython.org>2021-06-01 23:52:45 +1000
commit745b4319a21cfebefead76c7fcacd0b619d48063 (patch)
treea11b5d1398c6f4b503900b83a682c8a17594fc4e
parentdfd4324eb1b758e37cfc77da8467e7f5d72f519c (diff)
mimxrt/boards/TEENSY40: Re-create the flash FS after deploy.
This is required since the Teensy Halfkay loader attempts to erase all of the flash but fails to do so, at least in my tests. Formatting brings it back to a known state.
-rw-r--r--ports/mimxrt/Makefile2
-rw-r--r--ports/mimxrt/boards/TEENSY40/format.py11
-rw-r--r--ports/mimxrt/boards/TEENSY40/mpconfigboard.mk2
3 files changed, 15 insertions, 0 deletions
diff --git a/ports/mimxrt/Makefile b/ports/mimxrt/Makefile
index 7feab6cd7..956291b32 100644
--- a/ports/mimxrt/Makefile
+++ b/ports/mimxrt/Makefile
@@ -2,6 +2,8 @@ BOARD ?= TEENSY40
BOARD_DIR ?= boards/$(BOARD)
BUILD ?= build-$(BOARD)
+PORT ?= /dev/ttyACM0
+
CROSS_COMPILE ?= arm-none-eabi-
ifeq ($(wildcard $(BOARD_DIR)/.),)
diff --git a/ports/mimxrt/boards/TEENSY40/format.py b/ports/mimxrt/boards/TEENSY40/format.py
new file mode 100644
index 000000000..75e5aa95c
--- /dev/null
+++ b/ports/mimxrt/boards/TEENSY40/format.py
@@ -0,0 +1,11 @@
+# format.py
+# Re-create the file system
+
+import os
+import mimxrt
+
+bdev = mimxrt.Flash()
+
+os.VfsLfs2.mkfs(bdev, progsize=256)
+vfs = os.VfsLfs2(bdev, progsize=256)
+os.mount(vfs, "/")
diff --git a/ports/mimxrt/boards/TEENSY40/mpconfigboard.mk b/ports/mimxrt/boards/TEENSY40/mpconfigboard.mk
index 6b939a3af..79365d0da 100644
--- a/ports/mimxrt/boards/TEENSY40/mpconfigboard.mk
+++ b/ports/mimxrt/boards/TEENSY40/mpconfigboard.mk
@@ -3,3 +3,5 @@ MCU_VARIANT = MIMXRT1062DVJ6A
deploy: $(BUILD)/firmware.hex
teensy_loader_cli --mcu=imxrt1062 -v -w $<
+ sleep 1
+ $(PYTHON) $(TOP)/tools/pyboard.py --device $(PORT) $(BOARD_DIR)/format.py