py/persistentcode: Make ARM Thumb archs support multiple sub-archs.
This commit is contained in:
parent
42c1aed2bb
commit
9ac949cdbd
|
@ -526,10 +526,12 @@ mp_raw_code_t *mp_raw_code_load(mp_reader_t *reader) {
|
|||
|| read_uint(reader, NULL) > QSTR_WINDOW_SIZE) {
|
||||
mp_raise_ValueError("incompatible .mpy file");
|
||||
}
|
||||
if (MPY_FEATURE_DECODE_ARCH(header[2]) != MP_NATIVE_ARCH_NONE
|
||||
&& MPY_FEATURE_DECODE_ARCH(header[2]) != MPY_FEATURE_ARCH) {
|
||||
if (MPY_FEATURE_DECODE_ARCH(header[2]) != MP_NATIVE_ARCH_NONE) {
|
||||
byte arch = MPY_FEATURE_DECODE_ARCH(header[2]);
|
||||
if (!MPY_FEATURE_ARCH_TEST(arch)) {
|
||||
mp_raise_ValueError("incompatible .mpy arch");
|
||||
}
|
||||
}
|
||||
qstr_window_t qw;
|
||||
qw.idx = 0;
|
||||
mp_raw_code_t *rc = load_raw_code(reader, &qw);
|
||||
|
|
|
@ -59,7 +59,18 @@
|
|||
#elif MICROPY_EMIT_X64
|
||||
#define MPY_FEATURE_ARCH (MP_NATIVE_ARCH_X64)
|
||||
#elif MICROPY_EMIT_THUMB
|
||||
#if defined(__thumb2__)
|
||||
#if defined(__ARM_FP) && (__ARM_FP & 8) == 8
|
||||
#define MPY_FEATURE_ARCH (MP_NATIVE_ARCH_ARMV7EMDP)
|
||||
#elif defined(__ARM_FP) && (__ARM_FP & 4) == 4
|
||||
#define MPY_FEATURE_ARCH (MP_NATIVE_ARCH_ARMV7EMSP)
|
||||
#else
|
||||
#define MPY_FEATURE_ARCH (MP_NATIVE_ARCH_ARMV7EM)
|
||||
#endif
|
||||
#else
|
||||
#define MPY_FEATURE_ARCH (MP_NATIVE_ARCH_ARMV7M)
|
||||
#endif
|
||||
#define MPY_FEATURE_ARCH_TEST(x) (MP_NATIVE_ARCH_ARMV6M <= (x) && (x) <= MPY_FEATURE_ARCH)
|
||||
#elif MICROPY_EMIT_ARM
|
||||
#define MPY_FEATURE_ARCH (MP_NATIVE_ARCH_ARMV6)
|
||||
#elif MICROPY_EMIT_XTENSA
|
||||
|
@ -70,6 +81,10 @@
|
|||
#define MPY_FEATURE_ARCH (MP_NATIVE_ARCH_NONE)
|
||||
#endif
|
||||
|
||||
#ifndef MPY_FEATURE_ARCH_TEST
|
||||
#define MPY_FEATURE_ARCH_TEST(x) ((x) == MPY_FEATURE_ARCH)
|
||||
#endif
|
||||
|
||||
// 16-bit little-endian integer with the second and third bytes of supported .mpy files
|
||||
#define MPY_FILE_HEADER_INT (MPY_VERSION \
|
||||
| (MPY_FEATURE_ENCODE_FLAGS(MPY_FEATURE_FLAGS) | MPY_FEATURE_ENCODE_ARCH(MPY_FEATURE_ARCH)) << 8)
|
||||
|
|
Loading…
Reference in New Issue