aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George2017-02-22 12:49:42 +1100
committerDamien George2017-02-22 12:58:11 +1100
commite859ddf3e131cc04275779667e125092a5f3be99 (patch)
tree14abbe73a4db4c68027517163777e1f58d75f1a6
parentb1b090255c5156987b36711e929544546603029c (diff)
cc3200: Enable uerrno module with short, custom list of error codes.
Since we recently replaced the OSError string messages with simple error codes, having the uerrno module gets back some user friendly error messages. The total code size (after removing strings, replacing with uerrno module) is decreased.
-rw-r--r--cc3200/mpconfigport.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/cc3200/mpconfigport.h b/cc3200/mpconfigport.h
index 91d14dd1e..ad1e8ef2b 100644
--- a/cc3200/mpconfigport.h
+++ b/cc3200/mpconfigport.h
@@ -107,6 +107,8 @@
#define MICROPY_PY_CMATH (0)
#define MICROPY_PY_IO (1)
#define MICROPY_PY_IO_FILEIO (1)
+#define MICROPY_PY_UERRNO (1)
+#define MICROPY_PY_UERRNO_ERRORCODE (0)
#define MICROPY_PY_THREAD (1)
#define MICROPY_PY_THREAD_GIL (1)
#define MICROPY_PY_UBINASCII (0)
@@ -122,6 +124,14 @@
#define MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF (1)
#define MICROPY_EMERGENCY_EXCEPTION_BUF_SIZE (0)
+// We define our own list of errno constants to include in uerrno module
+#define MICROPY_PY_UERRNO_LIST \
+ X(EPERM) \
+ X(EIO) \
+ X(ENODEV) \
+ X(EINVAL) \
+ X(ETIMEDOUT) \
+
// TODO these should be generic, not bound to fatfs
#define mp_type_fileio fatfs_type_fileio
#define mp_type_textio fatfs_type_textio
@@ -161,6 +171,7 @@ extern const struct _mp_obj_module_t mp_module_ussl;
{ MP_OBJ_NEW_QSTR(MP_QSTR_ussl), (mp_obj_t)&mp_module_ussl }, \
#define MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS \
+ { MP_OBJ_NEW_QSTR(MP_QSTR_errno), (mp_obj_t)&mp_module_uerrno }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_struct), (mp_obj_t)&mp_module_ustruct }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_re), (mp_obj_t)&mp_module_ure }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_json), (mp_obj_t)&mp_module_ujson }, \