samd21: Enable terse error reporting on resource constrained chip family

This reclaims over 1kB of flash space by simplifying certain exception
messages.  e.g., it will no longer display the requested/actual length
when a fixed list/tuple of N items is needed:

        if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) {
            mp_raise_ValueError(translate("tuple/list has wrong length"));
        } else {
            mp_raise_ValueError_varg(translate("requested length %d but object has length %d"),
                (int)len, (int)seq_len);

Other chip families including samd51 keep their current error reporting
capabilities.
This commit is contained in:
Jeff Epler 2020-11-18 20:37:26 -06:00
parent f61f8f999b
commit 9a642fc049
2 changed files with 3 additions and 0 deletions

View File

@ -42,6 +42,7 @@
#define CIRCUITPY_MCU_FAMILY samd21 #define CIRCUITPY_MCU_FAMILY samd21
#define MICROPY_PY_SYS_PLATFORM "Atmel SAMD21" #define MICROPY_PY_SYS_PLATFORM "Atmel SAMD21"
#define SPI_FLASH_MAX_BAUDRATE 8000000 #define SPI_FLASH_MAX_BAUDRATE 8000000
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE)
#define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (0) #define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (0)
#define MICROPY_PY_FUNCTION_ATTRS (0) #define MICROPY_PY_FUNCTION_ATTRS (0)
// MICROPY_PY_UJSON depends on MICROPY_PY_IO // MICROPY_PY_UJSON depends on MICROPY_PY_IO

View File

@ -64,7 +64,9 @@
#define MICROPY_ENABLE_FINALISER (1) #define MICROPY_ENABLE_FINALISER (1)
#define MICROPY_ENABLE_GC (1) #define MICROPY_ENABLE_GC (1)
#define MICROPY_ENABLE_SOURCE_LINE (1) #define MICROPY_ENABLE_SOURCE_LINE (1)
#ifndef MICROPY_ERROR_REPORTING
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL) #define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL)
#endif
#define MICROPY_FLOAT_HIGH_QUALITY_HASH (0) #define MICROPY_FLOAT_HIGH_QUALITY_HASH (0)
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT) #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
#define MICROPY_GC_ALLOC_THRESHOLD (0) #define MICROPY_GC_ALLOC_THRESHOLD (0)