1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-04-27 04:29:03 +00:00

core: enable PYSTACK

This commit is contained in:
matejcik 2020-06-30 14:42:29 +02:00 committed by Tomas Susanka
parent d568afa80d
commit f723dca7b1
5 changed files with 13 additions and 0 deletions

View File

@ -282,6 +282,7 @@ SOURCE_MICROPYTHON = [
SOURCE_MICROPYTHON_SPEED = [ SOURCE_MICROPYTHON_SPEED = [
'vendor/micropython/py/gc.c', 'vendor/micropython/py/gc.c',
'vendor/micropython/py/pystack.c',
'vendor/micropython/py/vm.c', 'vendor/micropython/py/vm.c',
] ]

View File

@ -97,6 +97,11 @@ int main(void) {
mp_stack_set_top(&_estack); mp_stack_set_top(&_estack);
mp_stack_set_limit((char *)&_estack - (char *)&_heap_end - 1024); mp_stack_set_limit((char *)&_estack - (char *)&_heap_end - 1024);
#if MICROPY_ENABLE_PYSTACK
static mp_obj_t pystack[1024];
mp_pystack_init(pystack, &pystack[MP_ARRAY_SIZE(pystack)]);
#endif
// GC init // GC init
printf("CORE: Starting GC\n"); printf("CORE: Starting GC\n");
gc_init(&_heap_start, &_heap_end); gc_init(&_heap_start, &_heap_end);

View File

@ -39,6 +39,7 @@
// memory allocation policies // memory allocation policies
#define MICROPY_ALLOC_PATH_MAX (128) #define MICROPY_ALLOC_PATH_MAX (128)
#define MICROPY_ENABLE_PYSTACK (1)
// emitters // emitters
#define MICROPY_PERSISTENT_CODE_LOAD (0) #define MICROPY_PERSISTENT_CODE_LOAD (0)

View File

@ -468,6 +468,11 @@ MP_NOINLINE int main_(int argc, char **argv) {
gc_init(heap, heap + heap_size); gc_init(heap, heap + heap_size);
#endif #endif
#if MICROPY_ENABLE_PYSTACK
static mp_obj_t pystack[1024];
mp_pystack_init(pystack, &pystack[MP_ARRAY_SIZE(pystack)]);
#endif
mp_init(); mp_init();
char *home = getenv("HOME"); char *home = getenv("HOME");

View File

@ -44,6 +44,7 @@
#define MICROPY_ALLOC_PATH_MAX (PATH_MAX) #define MICROPY_ALLOC_PATH_MAX (PATH_MAX)
#define MICROPY_MALLOC_USES_ALLOCATED_SIZE (1) #define MICROPY_MALLOC_USES_ALLOCATED_SIZE (1)
#define MICROPY_MEM_STATS (1) #define MICROPY_MEM_STATS (1)
#define MICROPY_ENABLE_PYSTACK (1)
// emitters // emitters
#define MICROPY_PERSISTENT_CODE_LOAD (0) #define MICROPY_PERSISTENT_CODE_LOAD (0)