summaryrefslogtreecommitdiff
path: root/docs/reference
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2022-09-17 23:57:12 +1000
committerDamien George <damien@micropython.org>2022-09-19 23:19:55 +1000
commitd94141e1473aebae0d3c63aeaa8397651ad6fa01 (patch)
tree3bd11ca1a9475836a0812d1eac617a11997ebecb /docs/reference
parentb41aaaa8a918a6645ebc6bfa4483bd17286f9263 (diff)
py/persistentcode: Introduce .mpy sub-version.
The intent is to allow us to make breaking changes to the native ABI (e.g. changes to dynruntime.h) without needing the bytecode version to increment. With this commit the two bits previously used for the feature flags (but now unused as of .mpy version 6) encode a sub-version. A bytecode-only .mpy file can be loaded as long as MPY_VERSION matches, but a native .mpy (i.e. one with an arch set) must also match MPY_SUB_VERSION. This allows 3 additional updates to the native ABI per bytecode revision. The sub-version is set to 1 because the previous commits that changed the layout of mp_obj_type_t have changed the native ABI. Signed-off-by: Jim Mussared <jim.mussared@gmail.com> Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'docs/reference')
-rw-r--r--docs/reference/mpyfiles.rst6
1 files changed, 6 insertions, 0 deletions
diff --git a/docs/reference/mpyfiles.rst b/docs/reference/mpyfiles.rst
index fcb499656..d93a86383 100644
--- a/docs/reference/mpyfiles.rst
+++ b/docs/reference/mpyfiles.rst
@@ -27,6 +27,11 @@ Compatibility is based on the following:
* Version of the .mpy file: the version of the file must match the version
supported by the system loading it.
+* Sub-version of the .mpy file: if the .mpy file contains native machine code
+ then the sub-version of the file must match the version support by the
+ system loading it. Otherwise, if there is no native machine code in the .mpy
+ file, then the sub-version is ignored when loading.
+
* Small integer bits: the .mpy file will require a minimum number of bits in
a small integer and the system loading it must support at least this many
bits.
@@ -55,6 +60,7 @@ If importing an .mpy file fails then try the following:
'armv6', 'armv6m', 'armv7m', 'armv7em', 'armv7emsp', 'armv7emdp',
'xtensa', 'xtensawin'][sys_mpy >> 10]
print('mpy version:', sys_mpy & 0xff)
+ print('mpy sub-version:', sys_mpy >> 8 & 3)
print('mpy flags:', end='')
if arch:
print(' -march=' + arch, end='')