File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -148,7 +148,18 @@ uint32_t *port_stack_get_limit(void) {
148
148
}
149
149
150
150
uint32_t * port_stack_get_top (void ) {
151
- return port_stack_get_limit () + CONFIG_ESP_MAIN_TASK_STACK_SIZE / (sizeof (uint32_t ) / sizeof (StackType_t ));
151
+ // The sizeof-arithmetic is so that the pointer arithmetic is done on units
152
+ // of uint32_t instead of units of StackType_t. StackType_t is an alias
153
+ // for a byte sized type.
154
+ //
155
+ // The main stack is bigger than CONFIG_ESP_MAIN_TASK_STACK_SIZE -- an
156
+ // "extra" size is added to it (TASK_EXTRA_STACK_SIZE). This total size is
157
+ // available as ESP_TASK_MAIN_STACK. Presumably TASK_EXTRA_STACK_SIZE is
158
+ // additional stack that can be used by the esp-idf runtime. But what's
159
+ // important for us is that some very outermost stack frames, such as
160
+ // pyexec_friendly_repl, could lie inside the "extra" area and be invisible
161
+ // to the garbage collector.
162
+ return port_stack_get_limit () + ESP_TASK_MAIN_STACK / (sizeof (uint32_t ) / sizeof (StackType_t ));
152
163
}
153
164
154
165
supervisor_allocation _fixed_stack ;
You can’t perform that action at this time.
0 commit comments