Stack pointer is setup to incorrect alignment (STM32)

Technical Note 82023



10/8/2015 9:04 AM


Programming an STM32 device fails with the message:

Warning: Stack pointer is setup to incorrect alignment. Stack addr=0xAAAAAAAA


STM32 devices can be read protected. When read protection is enabled, bytes in flash memory will be read out as 0xAA. When the Cortex-M device starts up, the bytes at 0x00 to 0x03 are read, as they hold the value of the stack pointer, and in that situation the value 0xAAAAAAAA is regarded as invalid.


The flash of the STM32 device needs to be erased. With I-jet, unlock utilities for STM32 devices are provided as C-SPY macros found in the C-SPY Macro Quicklaunch window. With J-Link, arm\bin\JLinkSTM32.exe can be used.

All product names are trademarks or registered trademarks of their respective owners.

Related Tech Notes

© IAR Systems 1995-2021 - All rights reserved.

We use cookies on this website to provide you with a better experience. You need to accept cookies to continue using this site. Cookies