cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 "Stack pointer is setup to incorrect alignment" Error

Rdgn
Associate

Hi there. I am developing a bootloader application in IAR EWARM environment on my STM32f415 card. I'm having trouble uploading it to my stm32 card when I want to debug the bootloader code.Bootloader code starts from 0x08000000 and application code starts from 0x08040000. However, when I want to debug the bootloader code via IAR, I get the error "Warning: Stack pointer is setup to incorrect alignment. Stack addr=0xFFFFFFFF". There is no problem in Debugger and Linker settings. How can I debug the STM32 board? Does anyone have a solution suggestion for this problem?

Thanks.

Best regards.

2 REPLIES 2
TDK
Guru

Well, 0xFFFFFFFF is certainly an invalid stack pointer. The MSP should be set immediately at the start of your bootloader (in the startup file, not in main.c), and again at the start of your main program.

Verify that a valid end of stack pointer is in the flash at 0x08000000 and 0x08040000.

If you feel a post has answered your question, please click "Accept as Solution".
Rdgn
Associate

Thank you for your answer. I couldn't find how to set the address of the stack pointer. The contents of my startup file are as follows:

0693W00000Dlp8MQAR.png 

The starting address is defined as 0x08000000 in the .map file.

0693W00000Dlp7xQAB.png 

VEC_TAB_OFFSET value is defined as 0x00000000 in the system file.

0693W00000Dlp87QAB.pngI don't know where I made a mistake. I will be glad if you help.

Thanks .

Best regards.