summaryrefslogtreecommitdiffstatshomepage
path: root/py/persistentcode.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2019-11-30 23:00:56 +1100
committerDamien George <damien.p.george@gmail.com>2019-12-12 20:15:28 +1100
commit9ac949cdbd78d15f5edeaa651859659e8b382181 (patch)
tree39e4f68575cd35a86b6c2dc3fc15e6c4a870b0b5 /py/persistentcode.h
parent42c1aed2bba55b759e54139421044a05ccd4bfc6 (diff)
downloadmicropython-9ac949cdbd78d15f5edeaa651859659e8b382181.tar.gz
micropython-9ac949cdbd78d15f5edeaa651859659e8b382181.zip
py/persistentcode: Make ARM Thumb archs support multiple sub-archs.
Diffstat (limited to 'py/persistentcode.h')
-rw-r--r--py/persistentcode.h29
1 files changed, 22 insertions, 7 deletions
diff --git a/py/persistentcode.h b/py/persistentcode.h
index fde7a4625d..8769ef584d 100644
--- a/py/persistentcode.h
+++ b/py/persistentcode.h
@@ -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