-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Ensure that stack pointer is correctly aligned during thread creation on MSP430 #881
Conversation
Maybe would it be a good idea to ensure correct alignment of stack in |
|
||
*stk = (unsigned short) sched_task_exit; | ||
--stk; | ||
*stackptr = (unsigned short) sched_task_exit; |
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.
Doesn't the decreasing need to come before the setting, like it was before? In the start stk
points to the byte after the end of the stack, doesn't it?
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.
Aah, indeed. My bad.
I'm correcting that right away.
Done. SP should now have the right value after thread creation on MSP430 (it surely seems to be so under Cooja). |
I have no means to test this, but the change looks good. 👍 |
Will test ASAP, but agree with @Kijewski: looks good. Concerning the alignment check in |
Tested on MSB-430h. ACK and go. |
Ensure that stack pointer is correctly aligned during thread creation on MSP430
I encountered an error on my beta Z1 port during
enter_ISR()
, because of an odd (mis-aligned SP register).When debugging, I noticed the lack of a correct check for misalignment during thread creation on MSP430. This is my proposed correction.