File tree 3 files changed +13
-8
lines changed 3 files changed +13
-8
lines changed Original file line number Diff line number Diff line change 27
27
#include "py/gc.h"
28
28
#include "py/mpthread.h"
29
29
#include "shared/runtime/gchelper.h"
30
- // #include "shared/runtime/softtimer.h"
31
30
32
31
void gc_collect (void ) {
32
+ /* Check the flag byte to make sure the stack isn't corrupted. */
33
+ if (* (uint8_t * )0x80bc00 != 42 )
34
+ mp_printf (& mp_plat_print , "mpy: stack corrupted! About to crash!\n" );
35
+
33
36
// start the GC
34
37
gc_collect_start ();
35
38
@@ -41,9 +44,6 @@ void gc_collect(void) {
41
44
mp_thread_gc_others ();
42
45
#endif
43
46
44
- // trace soft timer nodes
45
- // soft_timer_gc_mark_all();
46
-
47
47
// end the GC
48
48
gc_collect_end ();
49
49
}
Original file line number Diff line number Diff line change @@ -72,9 +72,13 @@ MP_NOINLINE static void hard_init() {
72
72
MP_NOINLINE static void soft_init () {
73
73
74
74
/* The Telink SDK doesn't define any symbols for these, so we just hard code
75
- * it. The stack starts at the end of memory, 0x80c000. We leave 2kB for it,
76
- * meaning that our heap needs to end at 0x80b800. */
77
- gc_init ((void * )& _end_bss_ , (void * )0x80b800 );
75
+ * it. The stack starts at the end of memory, 0x80c000. We leave 1kB for it,
76
+ * meaning that our heap needs to end at 0x80bc00. */
77
+ gc_init ((void * )& _end_bss_ , (void * )0x80bc00 );
78
+
79
+ /* Set up the stack corruption flag byte. */
80
+ * (uint8_t * )0x80bc00 = 42 ;
81
+
78
82
mp_init ();
79
83
machine_init ();
80
84
}
Original file line number Diff line number Diff line change 18
18
#define MICROPY_DEBUG_PRINTERS (0)
19
19
#define MICROPY_ENABLE_FINALISER (1)
20
20
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
21
+ #define MICROPY_STACKLESS (1)
21
22
22
23
// This doesn't work. Maybe Telink's floating point emulation is broken.
23
- // #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
24
+ #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
24
25
25
26
#define MICROPY_PY_MACHINE (1)
26
27
#define MICROPY_PY_MACHINE_INCLUDEFILE "ports/tc32/modmachine.c"
You can’t perform that action at this time.
0 commit comments