Skip to content

Commit d521899

Browse files
committed
py/persistentcode: Clarify ValueError when native emitter disabled.
1 parent bd4e45f commit d521899

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

py/persistentcode.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,13 @@ mp_compiled_module_t mp_raw_code_load(mp_reader_t *reader, mp_module_context_t *
402402
if (MPY_FEATURE_DECODE_ARCH(header[2]) != MP_NATIVE_ARCH_NONE) {
403403
byte arch = MPY_FEATURE_DECODE_ARCH(header[2]);
404404
if (!MPY_FEATURE_ARCH_TEST(arch)) {
405-
mp_raise_ValueError(MP_ERROR_TEXT("incompatible .mpy arch"));
405+
if (MPY_FEATURE_ARCH_TEST(MP_NATIVE_ARCH_NONE)) {
406+
// On supported ports this can be resolved by enabling feature, eg
407+
// mpconfigboard.h: MICROPY_EMIT_THUMB (1)
408+
mp_raise_ValueError(MP_ERROR_TEXT("native code in .mpy unsupported"));
409+
} else {
410+
mp_raise_ValueError(MP_ERROR_TEXT("incompatible .mpy arch"));
411+
}
406412
}
407413
}
408414

0 commit comments

Comments
 (0)