-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix core1 startup #1286
Fix core1 startup #1286
Conversation
19c3401
to
3973b17
Compare
I can confirm its working for me. |
The original code tried to set the stack pointer and call the closure _in the same stack frame_. This isn't possible, so the actual stack being used was the 8K stack setup by ROM code. If this stack overflowed, it could corrupt the ROM function .bss and .data which is why I was seeing intermittent panic messages. I still don't understand all the failure cases, but I know that now we are using the correct stack properly.
5e51b80
to
84a6280
Compare
Thank you for sticking it out with this! I can take a peek in the morning. |
84a6280
to
7d93d2e
Compare
Shouldn't the same change be done for ESP32, too? |
Oops, I forgot they weren't sharing the code. I will do the same for the ESP32 tomorrow, thanks! |
Not really related to the PR but I really wonder what the initial SP is when core-1 gets out of reset. I guess it's hardwired in hardware (assuming the boot address is really the first instruction the core will execute) 🤔 |
Nevermind - found the information |
It seems like the curtain of mystery is being lifted on the ESP32 issue: #1085 (comment) |
e0e18e1
to
365dcc3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good to me and examples work fine. However, I never had code to reproduce the original issue. Seems @yanshay was already able to confirm this fixes the issues I guess we have a solution for the original problem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks again!
* Fix core1 startup The original code tried to set the stack pointer and call the closure _in the same stack frame_. This isn't possible, so the actual stack being used was the 8K stack setup by ROM code. If this stack overflowed, it could corrupt the ROM function .bss and .data which is why I was seeing intermittent panic messages. I still don't understand all the failure cases, but I know that now we are using the correct stack properly. * Improve multicore example * Change log * apply fix to esp32
The original code tried to set the stack pointer and call the closure in the same stack frame. This isn't possible, so the actual stack being used was the 8K stack setup by ROM code. If this stack overflowed, it could corrupt the ROM function .bss and .data which is why I was seeing intermittent panic messages. I still don't understand all the failure cases, but I know that now we are using the correct stack.