summaryrefslogtreecommitdiff
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
parentbb03afdb77c95b9cb23e531e5763167ccb09c8e4 (diff)
atmel-samd: Add sys, fix import and increase the size of the heap.
-rw-r--r--atmel-samd/Makefile1
-rw-r--r--atmel-samd/main.c19
-rw-r--r--atmel-samd/mpconfigport.h5
3 files changed, 21 insertions, 4 deletions
diff --git a/atmel-samd/Makefile b/atmel-samd/Makefile
index 1acd8f34e..623e7827f 100644
--- a/atmel-samd/Makefile
+++ b/atmel-samd/Makefile
@@ -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
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) {
diff --git a/atmel-samd/mpconfigport.h b/atmel-samd/mpconfigport.h
index f4e3de936..c8efcac52 100644
--- a/atmel-samd/mpconfigport.h
+++ b/atmel-samd/mpconfigport.h
@@ -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