Put call to qstr_init and mp_init_emergency_exc_buf in mp_init.
qstr_init is always called exactly before mp_init, so makes sense to just have mp_init call it. Similarly with mp_init_emergency_exception_buf. Doing this makes the ports simpler and less error prone (ie they can no longer forget to call these).
This commit is contained in:
parent
8362bffb2e
commit
8dbbbbc793
@ -53,7 +53,6 @@ void do_str(const char *src) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
qstr_init();
|
|
||||||
mp_init();
|
mp_init();
|
||||||
do_str("print('hello world!', list(x+1 for x in range(10)), end='eol\n')");
|
do_str("print('hello world!', list(x+1 for x in range(10)), end='eol\n')");
|
||||||
mp_deinit();
|
mp_deinit();
|
||||||
|
@ -70,8 +70,13 @@ const mp_obj_module_t mp_module___main__ = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void mp_init(void) {
|
void mp_init(void) {
|
||||||
|
qstr_init();
|
||||||
mp_stack_ctrl_init();
|
mp_stack_ctrl_init();
|
||||||
|
|
||||||
|
#if MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF
|
||||||
|
mp_init_emergency_exception_buf();
|
||||||
|
#endif
|
||||||
|
|
||||||
// call port specific initialization if any
|
// call port specific initialization if any
|
||||||
#ifdef MICROPY_PORT_INIT_FUNC
|
#ifdef MICROPY_PORT_INIT_FUNC
|
||||||
MICROPY_PORT_INIT_FUNC;
|
MICROPY_PORT_INIT_FUNC;
|
||||||
|
@ -53,7 +53,6 @@ void do_str(const char *src) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
qstr_init();
|
|
||||||
mp_init();
|
mp_init();
|
||||||
do_str("print('hello world!')");
|
do_str("print('hello world!')");
|
||||||
mp_deinit();
|
mp_deinit();
|
||||||
|
@ -59,7 +59,6 @@ end:
|
|||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
const char a[] = {"sim"};
|
const char a[] = {"sim"};
|
||||||
qstr_init();
|
|
||||||
mp_init();
|
mp_init();
|
||||||
int r = tinytest_main(1, (const char **) a, groups);
|
int r = tinytest_main(1, (const char **) a, groups);
|
||||||
mp_deinit();
|
mp_deinit();
|
||||||
|
@ -310,9 +310,14 @@ soft_reset:
|
|||||||
|
|
||||||
// GC init
|
// GC init
|
||||||
gc_init(&_heap_start, &_heap_end);
|
gc_init(&_heap_start, &_heap_end);
|
||||||
#if MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF
|
|
||||||
mp_init_emergency_exception_buf();
|
// Micro Python init
|
||||||
#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);
|
||||||
|
|
||||||
// Change #if 0 to #if 1 if you want REPL on UART_6 (or another uart)
|
// Change #if 0 to #if 1 if you want REPL on UART_6 (or another uart)
|
||||||
// as well as on USB VCP
|
// as well as on USB VCP
|
||||||
@ -328,17 +333,7 @@ soft_reset:
|
|||||||
pyb_stdio_uart = NULL;
|
pyb_stdio_uart = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Micro Python init
|
|
||||||
qstr_init();
|
|
||||||
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);
|
|
||||||
|
|
||||||
readline_init();
|
readline_init();
|
||||||
|
|
||||||
pin_init();
|
pin_init();
|
||||||
extint_init();
|
extint_init();
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ soft_reset:
|
|||||||
// GC init
|
// GC init
|
||||||
gc_init(&_heap_start, (void*)HEAP_END);
|
gc_init(&_heap_start, (void*)HEAP_END);
|
||||||
|
|
||||||
qstr_init();
|
// Micro Python init
|
||||||
mp_init();
|
mp_init();
|
||||||
|
|
||||||
readline_init();
|
readline_init();
|
||||||
|
@ -87,7 +87,6 @@ void do_file(const char *file) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
qstr_init();
|
|
||||||
mp_init();
|
mp_init();
|
||||||
|
|
||||||
if (argc == 2) {
|
if (argc == 2) {
|
||||||
|
@ -278,11 +278,7 @@ int main(int argc, char **argv) {
|
|||||||
char *heap = malloc(heap_size);
|
char *heap = malloc(heap_size);
|
||||||
gc_init(heap, heap + heap_size);
|
gc_init(heap, heap + heap_size);
|
||||||
#endif
|
#endif
|
||||||
#if MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF
|
|
||||||
mp_init_emergency_exception_buf();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
qstr_init();
|
|
||||||
mp_init();
|
mp_init();
|
||||||
|
|
||||||
char *home = getenv("HOME");
|
char *home = getenv("HOME");
|
||||||
|
Loading…
Reference in New Issue
Block a user