int main() { mp_stack_ctrl_init(); mp_stack_set_limit(10240); heap = malloc(HEAP_SIZE); upytest_set_heap(heap, (char*)heap + HEAP_SIZE); int r = tinytest_main(0, NULL, groups); printf("status: %d\n", r); return r; }
int main() { const char a[] = {"sim"}; mp_stack_ctrl_init(); mp_stack_set_limit(10240); heap = malloc(HEAP_SIZE); int r = tinytest_main(1, (const char **) a, groups); printf( "status: %i\n", r); return r; }
int main(int argc, char **argv) { // We should capture stack top ASAP after start, and it should be // captured guaranteedly before any other stack variables are allocated. // For this, actual main (renamed main_) should not be inlined into // this function. main_() itself may have other functions inlined (with // their own stack variables), that's why we need this main/main_ split. mp_stack_ctrl_init(); return main_(argc, argv); }
void mp_run(void) { int stack_dummy; stack_top = (char*)&stack_dummy; mp_stack_ctrl_init(); mp_stack_set_limit(1800); // stack is 2k // allocate the heap statically in the bss static uint32_t heap[9820 / 4]; gc_init(heap, (uint8_t*)heap + sizeof(heap)); /* // allocate the heap using system malloc extern void *malloc(int); void *mheap = malloc(2000); gc_init(mheap, (byte*)mheap + 2000); */ /* // allocate the heap statically (will clash with BLE) gc_init((void*)0x20000100, (void*)0x20002000); */ mp_init(); mp_hal_init(); readline_init0(); microbit_init(); if (APPENDED_SCRIPT->header[0] == 'M' && APPENDED_SCRIPT->header[1] == 'P') { // run appended script do_strn(APPENDED_SCRIPT->str, APPENDED_SCRIPT->len); } else if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL) { // from microbit import * mp_import_all(mp_import_name(MP_QSTR_microbit, mp_const_empty_tuple, MP_OBJ_NEW_SMALL_INT(0))); } for (;;) { if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) { if (pyexec_raw_repl() != 0) { break; } } else { if (pyexec_friendly_repl() != 0) { break; } } } mp_hal_stdout_tx_str("soft reboot\r\n"); memset(&MP_STATE_PORT(async_data)[0], 0, sizeof(MP_STATE_PORT(async_data))); MP_STATE_PORT(async_music_data) = NULL; mp_deinit(); }
int main() { const char a[] = {"sim"}; mp_stack_ctrl_init(); mp_stack_set_limit(10240); void *heap = malloc(256 * 1024); gc_init(heap, (char*)heap + 256 * 1024); mp_init(); int r = tinytest_main(1, (const char **) a, groups); mp_deinit(); printf( "status: %i\n", r); return r; }
int main(int argc, char **argv) { mp_stack_ctrl_init(); return main_(argc, argv); }