From 71788f74934e519e2ad48841ae2b14515455fd09 Mon Sep 17 00:00:00 2001 From: Cefn Hoile Date: Tue, 20 Feb 2018 17:59:23 +0000 Subject: [PATCH] Fixed issue with directories being incorrectly filtered. Added bytecode compilation logic since otherwise memory busted. --- .../upload_feather_huzzah_micropython_put.sh | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/python/upload_feather_huzzah_micropython_put.sh b/python/upload_feather_huzzah_micropython_put.sh index 2b7537d..903ea7a 100755 --- a/python/upload_feather_huzzah_micropython_put.sh +++ b/python/upload_feather_huzzah_micropython_put.sh @@ -1,18 +1,31 @@ #!/bin/sh PORT=/dev/ttyUSB0 +# needs a git repo with micropython sharing a top-level directory +# where make has been run in the mpy-cross directory + +# Compile unittest to bytecode +../../micropython/mpy-cross/mpy-cross unittest.py + # filter directories, and create relevant ones on the board find . -type d -mindepth 1 | \ - grep -v -E "(.(git|idea|vscode)|__pycache__)" | \ + grep -v -E "(^./.git|^./.idea|^./.vscode|__pycache__)" | \ xargs -n1 -I {} sh -c "echo Creating directory {} ...; ampy --port ${PORT} mkdir --exists-okay {}" -# put top-level modules in place -for NAME in agnostic unittest +# put top-level .py modules in place +for NAME in agnostic do echo "Copying ${NAME}.py ..." ampy --port ${PORT} put ${NAME}.py ${NAME}.py done +# put top-level .mpy modules in place +for NAME in unittest +do + echo "Copying ${NAME}.mpy ..." + ampy --port ${PORT} put ${NAME}.mpy ${NAME}.mpy +done + # recursively sync folders of nested packages for NAME in board digitalio mcp microcontroller testing do @@ -29,8 +42,11 @@ ampy --port ${PORT} put adafruit_bus_device/__init__.py adafruit_bus_device/__in ampy --port ${PORT} put adafruit_bus_device/i2c_device.py adafruit_bus_device/i2c_device.py cd ../ +# Compile BME280 to bytecode +./micropython/mpy-cross/mpy-cross ./Adafruit_CircuitPython_BME280/adafruit_bme280.py + # BME280 dependencies echo "Copying module adafruit_bme..." cd Adafruit_CircuitPython_BME280 # change into different repo -ampy --port ${PORT} put adafruit_bme280.py adafruit_bme280.py +ampy --port ${PORT} put adafruit_bme280.mpy adafruit_bme280.mpy cd ../ -- 2.49.0