summaryrefslogtreecommitdiff
path: root/atmel-samd/main.c
diff options
context:
space:
mode:
authorScott Shawcroft <scott@chickadee.tech>2016-09-19 16:56:42 -0700
committerScott Shawcroft <scott@chickadee.tech>2016-09-19 16:56:42 -0700
commit0f4f4c754430dd956fd5fadef68dc8f17efbc8ac (patch)
tree9161d0d400b141d593905a1f94bf025b2f5ec4fb /atmel-samd/main.c
parentbb03afdb77c95b9cb23e531e5763167ccb09c8e4 (diff)
atmel-samd: Add sys, fix import and increase the size of the heap.
Diffstat (limited to 'atmel-samd/main.c')
-rw-r--r--atmel-samd/main.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/atmel-samd/main.c b/atmel-samd/main.c
index 4b7cafd4d..fa9838c7a 100644
--- a/atmel-samd/main.c
+++ b/atmel-samd/main.c
@@ -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) {