1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
Description: Use the Debian-packaged MicroPython firmware by default
During repacking of the upstream source, we remove the 2 embedded copies of
the upstream-provided MicroPython runtime. Here we ensure that the MicroPython
firmware provided in package firmware-microbit-micropython{,-dl} is used by
default.
Author: Nick Morrott <knowledgejunkie@gmail.com>
Forwarded: not-needed
Last-Update: 2018-12-19
---
--- a/uflash.py
+++ b/uflash.py
@@ -28,6 +28,9 @@
except ImportError: # pragma: no cover
can_minify = False
+# The default Debian runtime is provided in firmware-microbit-micropython{,-dl}
+DEFAULT_RUNTIME_PATH = "/usr/share/firmware-microbit-micropython/firmware.hex"
+
#: The magic start address in flash memory for a Python script.
_SCRIPT_ADDR = 0x3e000
@@ -319,11 +322,15 @@
elif python_script:
python_hex = hexlify(python_script, minify)
- runtime = _RUNTIME
+ runtime = ''
# Load the hex for the runtime.
if path_to_runtime:
with open(path_to_runtime) as runtime_file:
runtime = runtime_file.read()
+ else:
+ with open(DEFAULT_RUNTIME_PATH) as runtime_file:
+ runtime = runtime_file.read()
+
# Generate the resulting hex file.
micropython_hex = embed_hex(runtime, python_hex)
# Find the micro:bit.
|