Skip to content

Commit 9a642fc

Browse files
committed
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.
1 parent f61f8f9 commit 9a642fc

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

ports/atmel-samd/mpconfigport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#define CIRCUITPY_MCU_FAMILY samd21
4343
#define MICROPY_PY_SYS_PLATFORM "Atmel SAMD21"
4444
#define SPI_FLASH_MAX_BAUDRATE 8000000
45+
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE)
4546
#define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (0)
4647
#define MICROPY_PY_FUNCTION_ATTRS (0)
4748
// MICROPY_PY_UJSON depends on MICROPY_PY_IO

py/circuitpy_mpconfig.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@
6464
#define MICROPY_ENABLE_FINALISER (1)
6565
#define MICROPY_ENABLE_GC (1)
6666
#define MICROPY_ENABLE_SOURCE_LINE (1)
67+
#ifndef MICROPY_ERROR_REPORTING
6768
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL)
69+
#endif
6870
#define MICROPY_FLOAT_HIGH_QUALITY_HASH (0)
6971
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
7072
#define MICROPY_GC_ALLOC_THRESHOLD (0)

0 commit comments

Comments
 (0)