atmel-samd: Add sys, fix import and increase the size of the heap.

This commit is contained in:
Scott Shawcroft 2016-09-19 16:56:42 -07:00
parent bb03afdb77
commit 0f4f4c7544
3 changed files with 21 additions and 4 deletions

View File

@ -156,7 +156,6 @@ SRC_C = \
lib/fatfs/option/ccsbcs.c \
lib/timeutils/timeutils.c \
lib/utils/stdout_helpers.c \
lib/utils/printf.c \
lib/utils/pyexec.c \
lib/libc/string0.c \
lib/mp-readline/readline.c

View File

@ -157,13 +157,18 @@ void init_flash_fs() {
}
static char *stack_top;
static char heap[8192];
static char heap[16384];
void reset_mp() {
#if MICROPY_ENABLE_GC
gc_init(heap, heap + sizeof(heap));
#endif
mp_init();
mp_obj_list_init(mp_sys_path, 0);
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR_)); // current dir (or base dir of the script)
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_flash));
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_flash_slash_lib));
mp_obj_list_init(mp_sys_argv, 0);
MP_STATE_PORT(mp_kbd_exception) = mp_obj_new_exception(&mp_type_KeyboardInterrupt);
@ -225,12 +230,24 @@ void gc_collect(void) {
gc_dump_info();
}
mp_lexer_t *fat_vfs_lexer_new_from_file(const char *filename);
mp_lexer_t *mp_lexer_new_from_file(const char *filename) {
#if MICROPY_VFS_FAT
return fat_vfs_lexer_new_from_file(filename);
#else
(void)filename;
return NULL;
#endif
}
mp_import_stat_t fat_vfs_import_stat(const char *path);
mp_import_stat_t mp_import_stat(const char *path) {
#if MICROPY_VFS_FAT
return fat_vfs_import_stat(path);
#else
(void)path;
return MP_IMPORT_STAT_NO_EXIST;
#endif
}
void mp_keyboard_interrupt(void) {

View File

@ -27,7 +27,7 @@
#define MICROPY_HELPER_LEXER_UNIX (0)
#define MICROPY_ENABLE_SOURCE_LINE (0)
#define MICROPY_ENABLE_DOC_STRING (0)
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE)
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL)
#define MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG (0)
#define MICROPY_PY_ASYNC_AWAIT (0)
#define MICROPY_PY_BUILTINS_BYTEARRAY (1)
@ -49,7 +49,7 @@
#define MICROPY_PY_CMATH (1)
#define MICROPY_PY_IO (0)
#define MICROPY_PY_STRUCT (1)
#define MICROPY_PY_SYS (0)
#define MICROPY_PY_SYS (1)
#define MICROPY_MODULE_FROZEN_MPY (1)
#define MICROPY_CPYTHON_COMPAT (0)
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_NONE)
@ -70,6 +70,7 @@
#define MICROPY_REPL_AUTO_INDENT (1)
#define MICROPY_HW_ENABLE_DAC (1)
#define MICROPY_ENABLE_FINALISER (1)
#define MICROPY_USE_INTERNAL_PRINTF (1)
// type definitions for the specific machine