2021-06-12 10:19:31 +00:00
|
|
|
#include "py/mpthread.h"
|
|
|
|
#include "py/runtime.h"
|
|
|
|
#include "py/stackctrl.h"
|
2021-05-12 13:50:25 +00:00
|
|
|
#ifdef USE_SECP256K1_ZKP
|
|
|
|
#include "zkp_context.h"
|
|
|
|
#endif
|
2021-06-12 10:19:31 +00:00
|
|
|
|
|
|
|
#include "common.h"
|
2024-08-08 15:12:57 +00:00
|
|
|
#include "entropy.h"
|
2021-06-12 10:19:31 +00:00
|
|
|
|
|
|
|
MP_NOINLINE int main_(int argc, char **argv);
|
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
2024-08-08 15:12:57 +00:00
|
|
|
entropy_init();
|
2021-06-12 10:19:31 +00:00
|
|
|
|
2021-05-12 13:50:25 +00:00
|
|
|
#ifdef USE_SECP256K1_ZKP
|
2021-11-03 21:25:16 +00:00
|
|
|
ensure(sectrue * (zkp_context_init() == 0), NULL);
|
2021-05-12 13:50:25 +00:00
|
|
|
#endif
|
|
|
|
|
2021-06-12 10:19:31 +00:00
|
|
|
#if MICROPY_PY_THREAD
|
|
|
|
mp_thread_init();
|
|
|
|
#endif
|
|
|
|
// 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);
|
|
|
|
}
|