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.
This commit is contained in:
Damien George 2017-02-22 12:49:42 +11:00
parent b1b090255c
commit e859ddf3e1
1 changed files with 11 additions and 0 deletions

View File

@ -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 }, \