File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -115,7 +115,6 @@ void init_flash_fs(void) {
115115 f_chdrive ("/flash" );
116116}
117117
118- static char * stack_top ;
119118static char heap [16384 ];
120119
121120void reset_mp (void ) {
@@ -519,12 +518,6 @@ int main(void) {
519518 // initialise the cpu and peripherals
520519 samd21_init ();
521520
522- int stack_dummy ;
523- // Store the location of stack_dummy as an approximation for the top of the
524- // stack so the GC can account for objects that may be referenced by the
525- // stack between here and where gc_collect is called.
526- stack_top = (char * )& stack_dummy ;
527-
528521 // Stack limit should be less than real stack size, so we have a chance
529522 // to recover from limit hit. (Limit is measured in bytes.)
530523 mp_stack_ctrl_init ();
@@ -581,7 +574,7 @@ void gc_collect(void) {
581574 gc_collect_start ();
582575 // This naively collects all object references from an approximate stack
583576 // range.
584- gc_collect_root (& dummy , ((mp_uint_t )stack_top - (mp_uint_t )& dummy ) / sizeof (mp_uint_t ));
577+ gc_collect_root (& dummy , ((mp_uint_t )& _estack - (mp_uint_t )& dummy ) / sizeof (mp_uint_t ));
585578 gc_collect_end ();
586579}
587580
Original file line number Diff line number Diff line change 104104
105105#ifdef LOG_HEAP_ACTIVITY
106106volatile uint32_t change_me ;
107-
107+ #pragma GCC push_options
108+ #pragma GCC optimize ("O0")
108109void __attribute__ ((noinline )) gc_log_change (uint32_t start_block , uint32_t length ) {
109110 change_me += start_block ;
110111 change_me += length ; // Break on this line.
111112}
113+ #pragma GCC pop_options
112114#endif
113115
114116// TODO waste less memory; currently requires that all entries in alloc_table have a corresponding block in pool
You can’t perform that action at this time.
0 commit comments