Skip to content

Some linker script has the stack pointer __NOT__ 8-byte aligned #137

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

Merged
merged 1 commit into from
Oct 23, 2017

Conversation

fpistm
Copy link
Member

@fpistm fpistm commented Oct 23, 2017

Ex: 0x20001FFF is the last valid byte address of RAM for NUCLEO_L053R8,
but the error is that it is not aligned and there is no reason to put
this value as stack pointer.
When Cortex-M push something in the stack, it first decrement the stack
pointer and then writes at the new address.
So using initial value 0x20002000 is ok.
The first word will be at address _estack-4, in RAM

Ex: 0x20001FFF is the last valid byte address of RAM for NUCLEO_L053R8,
but the error is that it is not aligned and there is no reason to put
this value as stack pointer.
When Cortex-M push something in the stack, it first decrement the stack
pointer and then writes at the new address.
So using initial value 0x20002000 is ok.
The first word will be at address _estack-4, in RAM

Signed-off-by: Frederic.Pillon <frederic.pillon@st.com>
@fpistm fpistm added the bug 🐛 Something isn't working label Oct 23, 2017
@fpistm fpistm self-assigned this Oct 23, 2017
@fpistm fpistm requested review from cparata and a user October 23, 2017 08:50
@fpistm fpistm merged commit 22eb2bf into stm32duino:master Oct 23, 2017
@fpistm fpistm deleted the Fix_ld_stack_alignement branch October 23, 2017 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants