summaryrefslogtreecommitdiff
path: root/docs/reference/mpyfiles.rst
diff options
context:
space:
mode:
authorAlessandro Gatti <a.gatti@frob.it>2025-09-23 22:52:44 +0200
committerAlessandro Gatti <a.gatti@frob.it>2025-10-24 18:30:55 +0200
commit64971f1a65aed54e6a1c041d069c2cb75f2dd64b (patch)
tree34c6b0b7db8424842b81a88681a565dc85768f67 /docs/reference/mpyfiles.rst
parenta6bc1ccbe51e582d39c6bf7b484c75bfb662357b (diff)
py/persistentcode: Add architecture flags check for RV32 platforms.
This commit introduces the MPY architecture flags checking code specific for the RV32 target, currently checking for the only additional extension that is supported by the runtime: Zba. The warnings inside "mpy-cross" have also been removed since now there is a way to reject incompatible MPY files at runtime. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Diffstat (limited to 'docs/reference/mpyfiles.rst')
-rw-r--r--docs/reference/mpyfiles.rst15
1 files changed, 13 insertions, 2 deletions
diff --git a/docs/reference/mpyfiles.rst b/docs/reference/mpyfiles.rst
index b2d552d09..9687f5e46 100644
--- a/docs/reference/mpyfiles.rst
+++ b/docs/reference/mpyfiles.rst
@@ -179,8 +179,19 @@ If bit #6 of the header's feature flags byte is set, then a vuint containing
optional architecture-specific information will follow the header. The contents
of this integer depends on which native architecture the file is meant for.
-See also ``mpy-tool.py``'s ``-march-flags`` command-line option to set this
-value when creating MPY files.
+This is currently used to store which RISC-V processor extensions the MPY file
+needs to operate correctly besides I, M, C, and Zicsr. Different flavours of
+ArmV7 are identified by their native architecture number, but reusing that
+mechanism would complicate things for RV32 and RV64.
+
+MPY files targeting RV32 or RV64 that do not need any particular processor
+extensions do not need to provide a flags integer (along with setting the
+appropriate bit in the header). The lack of a flags value for RV32 and RV64
+MPY files is used to indicate that no specific extensions are needed, and saves
+one byte in the final output binary.
+
+See also the ``-march-flags`` command-line option in both ``mpy-tool.py`` and
+``mpy-cross`` to set this value when creating MPY files.
The global qstr and constant tables
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~