summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--py/obj.c2
-rw-r--r--py/objfun.c2
-rw-r--r--py/runtime.c2
-rw-r--r--py/stackctrl.c12
-rw-r--r--py/stackctrl.h14
-rw-r--r--stmhal/main.c2
-rw-r--r--unix/gccollect.c2
-rw-r--r--unix/main.c4
8 files changed, 20 insertions, 20 deletions
diff --git a/py/obj.c b/py/obj.c
index 12d7898428..3077fd2937 100644
--- a/py/obj.c
+++ b/py/obj.c
@@ -61,7 +61,7 @@ void printf_wrapper(void *env, const char *fmt, ...) {
void mp_obj_print_helper(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind) {
// There can be data structures nested too deep, or just recursive
- STACK_CHECK();
+ MP_STACK_CHECK();
#if !NDEBUG
if (o_in == NULL) {
print(env, "(nil)");
diff --git a/py/objfun.c b/py/objfun.c
index f75e9142a2..74e959f9d3 100644
--- a/py/objfun.c
+++ b/py/objfun.c
@@ -356,7 +356,7 @@ continue2:;
STATIC mp_obj_t fun_bc_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t *args) {
- STACK_CHECK();
+ MP_STACK_CHECK();
DEBUG_printf("Input n_args: %d, n_kw: %d\n", n_args, n_kw);
DEBUG_printf("Input pos args: ");
diff --git a/py/runtime.c b/py/runtime.c
index f08ff9ff40..5490bcbac5 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -70,7 +70,7 @@ const mp_obj_module_t mp_module___main__ = {
};
void mp_init(void) {
- stack_ctrl_init();
+ mp_stack_ctrl_init();
// call port specific initialization if any
#ifdef MICROPY_PORT_INIT_FUNC
diff --git a/py/stackctrl.c b/py/stackctrl.c
index aef9bad9e9..724d54a1be 100644
--- a/py/stackctrl.c
+++ b/py/stackctrl.c
@@ -35,12 +35,12 @@
// Stack top at the start of program
char *stack_top;
-void stack_ctrl_init() {
+void mp_stack_ctrl_init() {
volatile int stack_dummy;
stack_top = (char*)&stack_dummy;
}
-uint stack_usage() {
+uint mp_stack_usage() {
// Assumes descending stack
volatile int stack_dummy;
return stack_top - (char*)&stack_dummy;
@@ -48,14 +48,14 @@ uint stack_usage() {
#if MICROPY_STACK_CHECK
-uint stack_limit = 10240;
+static uint stack_limit = 10240;
-void stack_set_limit(uint limit) {
+void mp_stack_set_limit(uint limit) {
stack_limit = limit;
}
-void stack_check() {
- if (stack_usage() >= stack_limit) {
+void mp_stack_check() {
+ if (mp_stack_usage() >= stack_limit) {
nlr_raise(mp_obj_new_exception_msg(&mp_type_RuntimeError, "maximum recursion depth exceeded"));
}
}
diff --git a/py/stackctrl.h b/py/stackctrl.h
index a9a8d2e2d8..92de882bfa 100644
--- a/py/stackctrl.h
+++ b/py/stackctrl.h
@@ -24,18 +24,18 @@
* THE SOFTWARE.
*/
-void stack_ctrl_init();
-uint stack_usage();
+void mp_stack_ctrl_init();
+uint mp_stack_usage();
#if MICROPY_STACK_CHECK
-void stack_set_limit(uint limit);
-void stack_check();
-#define STACK_CHECK() stack_check()
+void mp_stack_set_limit(uint limit);
+void mp_stack_check();
+#define MP_STACK_CHECK() mp_stack_check()
#else
-#define stack_set_limit(limit)
-#define STACK_CHECK()
+#define mp_stack_set_limit(limit)
+#define MP_STACK_CHECK()
#endif
diff --git a/stmhal/main.c b/stmhal/main.c
index 0cad768adb..0e260e18cd 100644
--- a/stmhal/main.c
+++ b/stmhal/main.c
@@ -188,7 +188,7 @@ int main(void) {
// Stack limit should be less than real stack size, so we
// had chance to recover from limit hit.
- stack_set_limit(&_ram_end - &_heap_end - 512);
+ mp_stack_set_limit(&_ram_end - &_heap_end - 512);
/* STM32F4xx HAL library initialization:
- Configure the Flash prefetch, instruction and Data caches
diff --git a/unix/gccollect.c b/unix/gccollect.c
index be05ff3ebc..d04e5d87fb 100644
--- a/unix/gccollect.c
+++ b/unix/gccollect.c
@@ -32,7 +32,7 @@
#if MICROPY_ENABLE_GC
-extern void *stack_top;
+extern char *stack_top;
#if MICROPY_GCREGS_SETJMP
#include <setjmp.h>
diff --git a/unix/main.c b/unix/main.c
index 1bee639eb2..176cbc6ec3 100644
--- a/unix/main.c
+++ b/unix/main.c
@@ -214,7 +214,7 @@ int usage(char **argv) {
mp_obj_t mem_info(void) {
printf("mem: total=%d, current=%d, peak=%d\n",
m_get_total_bytes_allocated(), m_get_current_bytes_allocated(), m_get_peak_bytes_allocated());
- printf("stack: %u\n", stack_usage());
+ printf("stack: %u\n", mp_stack_usage());
#if MICROPY_ENABLE_GC
gc_dump_info();
#endif
@@ -265,7 +265,7 @@ void pre_process_options(int argc, char **argv) {
#endif
int main(int argc, char **argv) {
- stack_set_limit(32768);
+ mp_stack_set_limit(32768);
pre_process_options(argc, argv);