mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-12 18:49:07 +00:00
unix, firmware: more cleanup
This commit is contained in:
parent
d4893add54
commit
ec6c3c2cdc
@ -23,44 +23,36 @@
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// Init peripherals
|
||||
pendsv_init();
|
||||
|
||||
display_orientation(0);
|
||||
|
||||
sdcard_init();
|
||||
touch_init();
|
||||
|
||||
for (;;) {
|
||||
printf("CORE: Starting main loop\n");
|
||||
// Stack limit should be less than real stack size, so we have a chance
|
||||
// to recover from limit hit.
|
||||
mp_stack_set_top(&_estack);
|
||||
mp_stack_set_limit((char*)&_estack - (char*)&_heap_end - 1024);
|
||||
printf("CORE: Preparing stack\n");
|
||||
// Stack limit should be less than real stack size, so we have a chance
|
||||
// to recover from limit hit.
|
||||
mp_stack_set_top(&_estack);
|
||||
mp_stack_set_limit((char*)&_estack - (char*)&_heap_end - 1024);
|
||||
|
||||
// GC init
|
||||
gc_init(&_heap_start, &_heap_end);
|
||||
// GC init
|
||||
printf("CORE: Starting GC\n");
|
||||
gc_init(&_heap_start, &_heap_end);
|
||||
|
||||
// Interpreter init
|
||||
mp_init();
|
||||
mp_obj_list_init(mp_sys_argv, 0);
|
||||
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)
|
||||
// Interpreter init
|
||||
printf("CORE: Starting interpreter\n");
|
||||
mp_init();
|
||||
mp_obj_list_init(mp_sys_argv, 0);
|
||||
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)
|
||||
|
||||
// Run the main script
|
||||
printf("CORE: Executing main script\n");
|
||||
pyexec_frozen_module("main.py");
|
||||
// Execute the main script
|
||||
printf("CORE: Executing main script\n");
|
||||
pyexec_frozen_module("main.py");
|
||||
|
||||
// Run REPL
|
||||
printf("CORE: Executing REPL\n");
|
||||
for (;;) {
|
||||
if (pyexec_friendly_repl() != 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Clean up
|
||||
mp_deinit();
|
||||
}
|
||||
// Clean up
|
||||
printf("CORE: Main script finished, cleaning up\n");
|
||||
mp_deinit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -75,11 +67,7 @@ void PendSV_Handler(void) {
|
||||
pendsv_isr_handler();
|
||||
}
|
||||
|
||||
// MicroPython file I/O stubs
|
||||
|
||||
mp_lexer_t *mp_lexer_new_from_file(const char *filename) {
|
||||
return NULL;
|
||||
}
|
||||
// MicroPython builtin stubs
|
||||
|
||||
mp_import_stat_t mp_import_stat(const char *path) {
|
||||
return MP_IMPORT_STAT_NO_EXIST;
|
||||
@ -89,7 +77,3 @@ mp_obj_t mp_builtin_open(uint n_args, const mp_obj_t *args, mp_map_t *kwargs) {
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open);
|
||||
|
||||
void mp_reader_new_file(mp_reader_t *reader, const char *filename) {
|
||||
mp_raise_OSError(MP_ENOENT); // assume "file not found"
|
||||
}
|
||||
|
@ -31,6 +31,10 @@
|
||||
#ifndef __INCLUDED_MPCONFIGPORT_H
|
||||
#define __INCLUDED_MPCONFIGPORT_H
|
||||
|
||||
// stuff from py/mpconfig.h
|
||||
#define MICROPY_ENABLE_COMPILER (0)
|
||||
#define MICROPY_CPYTHON_COMPAT (0)
|
||||
|
||||
// frozen modules
|
||||
#define MICROPY_MODULE_FROZEN_MPY (1)
|
||||
#define MICROPY_QSTR_EXTRA_POOL (mp_qstr_frozen_const_pool)
|
||||
@ -71,7 +75,7 @@
|
||||
#endif
|
||||
#define MICROPY_STREAMS_NON_BLOCK (1)
|
||||
#define MICROPY_MODULE_WEAK_LINKS (1)
|
||||
#define MICROPY_CAN_OVERRIDE_BUILTINS (1)
|
||||
#define MICROPY_CAN_OVERRIDE_BUILTINS (0)
|
||||
#define MICROPY_USE_INTERNAL_ERRNO (1)
|
||||
#define MICROPY_ENABLE_SCHEDULER (0)
|
||||
#define MICROPY_SCHEDULER_DEPTH (0)
|
||||
@ -82,22 +86,22 @@
|
||||
#define MICROPY_PY_FUNCTION_ATTRS (1)
|
||||
#define MICROPY_PY_BUILTINS_STR_UNICODE (1)
|
||||
#define MICROPY_PY_BUILTINS_STR_CENTER (1)
|
||||
#define MICROPY_PY_BUILTINS_STR_PARTITION (1)
|
||||
#define MICROPY_PY_BUILTINS_STR_SPLITLINES (1)
|
||||
#define MICROPY_PY_BUILTINS_STR_PARTITION (0)
|
||||
#define MICROPY_PY_BUILTINS_STR_SPLITLINES (0)
|
||||
#define MICROPY_PY_BUILTINS_MEMORYVIEW (1)
|
||||
#define MICROPY_PY_BUILTINS_FROZENSET (1)
|
||||
#define MICROPY_PY_BUILTINS_FROZENSET (0)
|
||||
#define MICROPY_PY_BUILTINS_SLICE_ATTRS (1)
|
||||
#define MICROPY_PY_ALL_SPECIAL_METHODS (1)
|
||||
#define MICROPY_PY_BUILTINS_COMPILE (1)
|
||||
#define MICROPY_PY_ALL_SPECIAL_METHODS (0)
|
||||
#define MICROPY_PY_BUILTINS_COMPILE (0)
|
||||
#define MICROPY_PY_BUILTINS_EXECFILE (0)
|
||||
#define MICROPY_PY_BUILTINS_INPUT (1)
|
||||
#define MICROPY_PY_BUILTINS_INPUT (0)
|
||||
#define MICROPY_PY_BUILTINS_POW3 (0)
|
||||
#define MICROPY_PY_BUILTINS_HELP (0)
|
||||
#define MICROPY_PY_BUILTINS_HELP_TEXT stm32_help_text
|
||||
#define MICROPY_PY_BUILTINS_HELP_MODULES (0)
|
||||
#define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
|
||||
#define MICROPY_PY_ARRAY_SLICE_ASSIGN (1)
|
||||
#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (1)
|
||||
#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (0)
|
||||
#define MICROPY_PY_MATH_SPECIAL_FUNCTIONS (0)
|
||||
#define MICROPY_PY_CMATH (0)
|
||||
#define MICROPY_PY_IO (0)
|
||||
|
@ -26,6 +26,9 @@
|
||||
|
||||
// options to control how MicroPython is built
|
||||
|
||||
// stuff from py/mpconfig.h
|
||||
#define MICROPY_CPYTHON_COMPAT (0)
|
||||
|
||||
#define MICROPY_ALLOC_PATH_MAX (PATH_MAX)
|
||||
#define MICROPY_PERSISTENT_CODE_LOAD (1)
|
||||
#if !defined(MICROPY_EMIT_X64) && defined(__x86_64__)
|
||||
@ -70,21 +73,21 @@
|
||||
#ifndef MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE
|
||||
#define MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE (1)
|
||||
#endif
|
||||
#define MICROPY_CAN_OVERRIDE_BUILTINS (1)
|
||||
#define MICROPY_CAN_OVERRIDE_BUILTINS (0)
|
||||
#define MICROPY_PY_FUNCTION_ATTRS (1)
|
||||
#define MICROPY_PY_DESCRIPTORS (1)
|
||||
#define MICROPY_PY_BUILTINS_STR_UNICODE (1)
|
||||
#define MICROPY_PY_BUILTINS_STR_CENTER (1)
|
||||
#define MICROPY_PY_BUILTINS_STR_PARTITION (1)
|
||||
#define MICROPY_PY_BUILTINS_STR_SPLITLINES (1)
|
||||
#define MICROPY_PY_BUILTINS_STR_PARTITION (0)
|
||||
#define MICROPY_PY_BUILTINS_STR_SPLITLINES (0)
|
||||
#define MICROPY_PY_BUILTINS_MEMORYVIEW (1)
|
||||
#define MICROPY_PY_BUILTINS_FROZENSET (1)
|
||||
#define MICROPY_PY_BUILTINS_FROZENSET (0)
|
||||
#define MICROPY_PY_BUILTINS_COMPILE (1)
|
||||
#define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (1)
|
||||
#define MICROPY_PY_BUILTINS_INPUT (1)
|
||||
#define MICROPY_PY_BUILTINS_POW3 (1)
|
||||
#define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
|
||||
#define MICROPY_PY_ALL_SPECIAL_METHODS (1)
|
||||
#define MICROPY_PY_ALL_SPECIAL_METHODS (0)
|
||||
#define MICROPY_PY_ARRAY_SLICE_ASSIGN (1)
|
||||
#define MICROPY_PY_BUILTINS_SLICE_ATTRS (1)
|
||||
#define MICROPY_PY_SYS_EXIT (1)
|
||||
@ -96,7 +99,7 @@
|
||||
#define MICROPY_PY_SYS_MAXSIZE (1)
|
||||
#define MICROPY_PY_SYS_STDFILES (1)
|
||||
#define MICROPY_PY_SYS_EXC_INFO (1)
|
||||
#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (1)
|
||||
#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (0)
|
||||
#ifndef MICROPY_PY_MATH_SPECIAL_FUNCTIONS
|
||||
#define MICROPY_PY_MATH_SPECIAL_FUNCTIONS (0)
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user