py/persistentcode: Make ARM Thumb archs support multiple sub-archs.
This commit is contained in:
parent
42c1aed2bb
commit
9ac949cdbd
|
@ -526,9 +526,11 @@ 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) {
|
||||
mp_raise_ValueError("incompatible .mpy 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;
|
||||
|
|
|
@ -55,19 +55,34 @@
|
|||
|
||||
// Define the host architecture
|
||||
#if MICROPY_EMIT_X86
|
||||
#define MPY_FEATURE_ARCH (MP_NATIVE_ARCH_X86)
|
||||
#define MPY_FEATURE_ARCH (MP_NATIVE_ARCH_X86)
|
||||
#elif MICROPY_EMIT_X64
|
||||
#define MPY_FEATURE_ARCH (MP_NATIVE_ARCH_X64)
|
||||
#define MPY_FEATURE_ARCH (MP_NATIVE_ARCH_X64)
|
||||
#elif MICROPY_EMIT_THUMB
|
||||
#define MPY_FEATURE_ARCH (MP_NATIVE_ARCH_ARMV7M)
|
||||
#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)
|
||||
#define MPY_FEATURE_ARCH (MP_NATIVE_ARCH_ARMV6)
|
||||
#elif MICROPY_EMIT_XTENSA
|
||||
#define MPY_FEATURE_ARCH (MP_NATIVE_ARCH_XTENSA)
|
||||
#define MPY_FEATURE_ARCH (MP_NATIVE_ARCH_XTENSA)
|
||||
#elif MICROPY_EMIT_XTENSAWIN
|
||||
#define MPY_FEATURE_ARCH (MP_NATIVE_ARCH_XTENSAWIN)
|
||||
#define MPY_FEATURE_ARCH (MP_NATIVE_ARCH_XTENSAWIN)
|
||||
#else
|
||||
#define MPY_FEATURE_ARCH (MP_NATIVE_ARCH_NONE)
|
||||
#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
|
||||
|
|
Loading…
Reference in New Issue