Skip to content

Commit 0f4f4c7

Browse files
committed
atmel-samd: Add sys, fix import and increase the size of the heap.
1 parent bb03afd commit 0f4f4c7

3 files changed

Lines changed: 21 additions & 4 deletions

File tree

atmel-samd/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ SRC_C = \
156156
lib/fatfs/option/ccsbcs.c \
157157
lib/timeutils/timeutils.c \
158158
lib/utils/stdout_helpers.c \
159-
lib/utils/printf.c \
160159
lib/utils/pyexec.c \
161160
lib/libc/string0.c \
162161
lib/mp-readline/readline.c

atmel-samd/main.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,18 @@ void init_flash_fs() {
157157
}
158158

159159
static char *stack_top;
160-
static char heap[8192];
160+
static char heap[16384];
161161

162162
void reset_mp() {
163163
#if MICROPY_ENABLE_GC
164164
gc_init(heap, heap + sizeof(heap));
165165
#endif
166166
mp_init();
167+
mp_obj_list_init(mp_sys_path, 0);
168+
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR_)); // current dir (or base dir of the script)
169+
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_flash));
170+
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_flash_slash_lib));
171+
mp_obj_list_init(mp_sys_argv, 0);
167172

168173
MP_STATE_PORT(mp_kbd_exception) = mp_obj_new_exception(&mp_type_KeyboardInterrupt);
169174

@@ -225,12 +230,24 @@ void gc_collect(void) {
225230
gc_dump_info();
226231
}
227232

233+
mp_lexer_t *fat_vfs_lexer_new_from_file(const char *filename);
228234
mp_lexer_t *mp_lexer_new_from_file(const char *filename) {
235+
#if MICROPY_VFS_FAT
236+
return fat_vfs_lexer_new_from_file(filename);
237+
#else
238+
(void)filename;
229239
return NULL;
240+
#endif
230241
}
231242

243+
mp_import_stat_t fat_vfs_import_stat(const char *path);
232244
mp_import_stat_t mp_import_stat(const char *path) {
245+
#if MICROPY_VFS_FAT
246+
return fat_vfs_import_stat(path);
247+
#else
248+
(void)path;
233249
return MP_IMPORT_STAT_NO_EXIST;
250+
#endif
234251
}
235252

236253
void mp_keyboard_interrupt(void) {

atmel-samd/mpconfigport.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#define MICROPY_HELPER_LEXER_UNIX (0)
2828
#define MICROPY_ENABLE_SOURCE_LINE (0)
2929
#define MICROPY_ENABLE_DOC_STRING (0)
30-
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE)
30+
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL)
3131
#define MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG (0)
3232
#define MICROPY_PY_ASYNC_AWAIT (0)
3333
#define MICROPY_PY_BUILTINS_BYTEARRAY (1)
@@ -49,7 +49,7 @@
4949
#define MICROPY_PY_CMATH (1)
5050
#define MICROPY_PY_IO (0)
5151
#define MICROPY_PY_STRUCT (1)
52-
#define MICROPY_PY_SYS (0)
52+
#define MICROPY_PY_SYS (1)
5353
#define MICROPY_MODULE_FROZEN_MPY (1)
5454
#define MICROPY_CPYTHON_COMPAT (0)
5555
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_NONE)
@@ -70,6 +70,7 @@
7070
#define MICROPY_REPL_AUTO_INDENT (1)
7171
#define MICROPY_HW_ENABLE_DAC (1)
7272
#define MICROPY_ENABLE_FINALISER (1)
73+
#define MICROPY_USE_INTERNAL_PRINTF (1)
7374

7475
// type definitions for the specific machine
7576

0 commit comments

Comments
 (0)