stmhal: Update for static mod sys.

This commit is contained in:
Paul Sokolovsky 2014-04-13 07:00:37 +03:00
parent a3e50eacca
commit 4165cd1c0c
4 changed files with 10 additions and 4 deletions

View File

@ -23,9 +23,11 @@ STATIC const mp_map_elem_t mp_module_sys_globals_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_path), (mp_obj_t)&mp_sys_path_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_path), (mp_obj_t)&mp_sys_path_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_argv), (mp_obj_t)&mp_sys_argv_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_argv), (mp_obj_t)&mp_sys_argv_obj },
#if MICROPY_MOD_SYS_STDFILES
{ MP_OBJ_NEW_QSTR(MP_QSTR_stdin), (mp_obj_t)&mp_sys_stdin_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_stdin), (mp_obj_t)&mp_sys_stdin_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_stdout), (mp_obj_t)&mp_sys_stdout_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_stdout), (mp_obj_t)&mp_sys_stdout_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_stderr), (mp_obj_t)&mp_sys_stderr_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_stderr), (mp_obj_t)&mp_sys_stderr_obj },
#endif
}; };
STATIC const mp_obj_dict_t mp_module_sys_globals = { STATIC const mp_obj_dict_t mp_module_sys_globals = {

View File

@ -125,6 +125,10 @@ typedef double mp_float_t;
#define MICROPY_ENABLE_MOD_SYS (1) #define MICROPY_ENABLE_MOD_SYS (1)
#endif #endif
#ifndef MICROPY_MOD_SYS_STDFILES
#define MICROPY_MOD_SYS_STDFILES (0)
#endif
// Whether to support slice object and correspondingly // Whether to support slice object and correspondingly
// slice subscript operators // slice subscript operators
#ifndef MICROPY_ENABLE_SLICE #ifndef MICROPY_ENABLE_SLICE

View File

@ -263,10 +263,9 @@ soft_reset:
// Micro Python init // Micro Python init
qstr_init(); qstr_init();
mp_init(); mp_init();
mp_obj_t def_path[2]; mp_obj_list_init(mp_sys_path, 0);
def_path[0] = MP_OBJ_NEW_QSTR(MP_QSTR_0_colon__slash_); mp_obj_list_append(mp_sys_argv, MP_OBJ_NEW_QSTR(MP_QSTR_0_colon__slash_));
def_path[1] = MP_OBJ_NEW_QSTR(MP_QSTR_0_colon__slash_lib); mp_obj_list_append(mp_sys_argv, MP_OBJ_NEW_QSTR(MP_QSTR_0_colon__slash_lib));
mp_sys_path = mp_obj_new_list(2, def_path);
readline_init(); readline_init();

View File

@ -13,6 +13,7 @@
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE) #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE)
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ) #define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
#define MICROPY_PATH_MAX (PATH_MAX) #define MICROPY_PATH_MAX (PATH_MAX)
#define MICROPY_MOD_SYS_STDFILES (1)
// type definitions for the specific machine // type definitions for the specific machine