py/persistentcode: Clarify ValueError when native emitter disabled.

This commit is contained in:
Andrew Leech 2022-08-17 08:43:17 +10:00
parent bd4e45fd68
commit d521899e18

View File

@ -402,7 +402,13 @@ mp_compiled_module_t mp_raw_code_load(mp_reader_t *reader, mp_module_context_t *
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(MP_ERROR_TEXT("incompatible .mpy arch"));
if (MPY_FEATURE_ARCH_TEST(MP_NATIVE_ARCH_NONE)) {
// On supported ports this can be resolved by enabling feature, eg
// mpconfigboard.h: MICROPY_EMIT_THUMB (1)
mp_raise_ValueError(MP_ERROR_TEXT("native code in .mpy unsupported"));
} else {
mp_raise_ValueError(MP_ERROR_TEXT("incompatible .mpy arch"));
}
}
}