cancel
Showing results for 
Search instead for 
Did you mean: 

Linker scripts always produce a misaligned stack pointer

dszlamp
Associate
Posted on June 14, 2015 at 11:51

All of the ST tools seem to generate a misaligned stack pointer.

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/14269.html

States a multiple of 8 bytes. yet it's always:

<mem base> + <mem size> -1

this seems to be from the early days of 8bit, but even then it was wrong as a push is

SP--;

*SP = <reg>;

and pop

<reg> = *SP;

SP++;

So why is it misaligned?

#stack-pointer #alignment #st-linker
1 REPLY 1
Posted on June 14, 2015 at 15:41

[DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Java/STM32F405RGTx_FLASH.ld%20uses%20unaligned%20SP&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000F9A0E3A95BA69146A17C2E80209ADC21&TopicsView=https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/AllItems.aspx&currentviews=53]https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fSTM32Java%2fSTM32F405RGTx_FLASH%2eld%20uses%20unaligned%20SP&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000F9A0E3A95BA69146A17C2E80209ADC21&TopicsView=https%3A%2F%2Fmy%2Est%2Ecom%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2FSTM32Java%2FAllItems%2Easpx¤tviews=53

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..