From 430837996b3cbb85849be92cc4d9ce98ce2a0905 Mon Sep 17 00:00:00 2001 From: Alessandro Gatti Date: Wed, 24 Sep 2025 22:26:39 +0200 Subject: py/modsys: Add architecture flags to MicroPython metadata. This commit adds the currently supported architecture flags value as the upper part of "sys.implementation._mpy". This had the side effect of perturbing quite a bit of testing infrastructure and invalidating documentation related to MPY files. To make the test suite run successfully and keep the documentation in sync the following changes have been made: * The target info feature check file now isolates eventual architecture flags and adds them as a separate field * The test runner now picks up the new architecture flags field, reports it to STDOUT if needed and stores it for future uses * Relevant test files for MPY files import code had to be updated to mask out the architecture flags bits in order to perform correctly * MPY file format documentation was updated to show how to mask off and properly display the architecture flags information. This works out of the box if the flag bits can fit in a smallint value once merged with the MPY file header value. Signed-off-by: Alessandro Gatti --- tests/micropython/import_mpy_native.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/micropython/import_mpy_native.py') diff --git a/tests/micropython/import_mpy_native.py b/tests/micropython/import_mpy_native.py index 7a9bb8edd..b7908b5a6 100644 --- a/tests/micropython/import_mpy_native.py +++ b/tests/micropython/import_mpy_native.py @@ -54,11 +54,11 @@ class UserFS: # these are the test .mpy files small_int_bits = 30 -valid_header = bytes([77, 6, mpy_arch, small_int_bits]) +valid_header = bytes([77, 6, (mpy_arch & 0x3F), small_int_bits]) # fmt: off user_files = { # bad architecture (mpy_arch needed for sub-version) - '/mod0.mpy': bytes([77, 6, 0xfc | mpy_arch, small_int_bits]), + '/mod0.mpy': bytes([77, 6, 0xfc | (mpy_arch & 3), small_int_bits]), # test loading of viper and asm '/mod1.mpy': valid_header + ( -- cgit v1.2.3