py/stackctrl: Add mp_stack_set_top() to explicitly set stack top value.

Useful for embedded targets with fixed stack layout.
This commit is contained in:
Paul Sokolovsky 2016-02-13 15:43:28 +02:00
parent 419bb26ddc
commit 1d5d4f49d9
2 changed files with 5 additions and 0 deletions

View File

@ -35,6 +35,10 @@ void mp_stack_ctrl_init(void) {
MP_STATE_VM(stack_top) = (char*)&stack_dummy;
}
void mp_stack_set_top(void *top) {
MP_STATE_VM(stack_top) = top;
}
mp_uint_t mp_stack_usage(void) {
// Assumes descending stack
volatile int stack_dummy;

View File

@ -29,6 +29,7 @@
#include "py/mpconfig.h"
void mp_stack_ctrl_init(void);
void mp_stack_set_top(void *top);
mp_uint_t mp_stack_usage(void);
#if MICROPY_STACK_CHECK