Skip to main content
moretto
Associate
September 4, 2009
Question

Stack misalignment

  • September 4, 2009
  • 4 replies
  • 940 views
Posted on September 04, 2009 at 23:23

Stack misalignment

    This topic has been closed for replies.

    4 replies

    picguy
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:22

    Did you setup the reset vector? On reset he word at 0000 goes to sp. The word at 0004 goes to pc. One might expect sp=FFFFFFFF if the reset vector is erased and not programmed.

    moretto
    morettoAuthor
    Associate
    May 17, 2011
    Posted on May 17, 2011 at 13:22

    I use IAR toolchain and STM32F101C6T6 as target.

    When I download my code to start debug the J-Link driver return the following error:

    Stack pointer is setup to incorrect alignment. Stack addr=0xFFFFFFFF.

    My application's main is empty. I just include the peripherals driver and IAR's startup file.

    Can anyone help me?

    Thanks.

    Mauro.

    jj_it
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 13:22

    Agree w/picguy.

    However - more basic - have you tried your J-Link with an ''official'' eval/dev board? Always useful to have something ''known good'' to avoid the dreaded, ''maximum randomness.'' (i.e. new hw, new sw, new tool, new IDE etc)

    ST-One32 advises that we check Segger site - download the newest sw for JLink.

    I would beg/borrow/steal basic IAR or ST eval board - and get that to work before the debug of (I assume) your custom C6T6 pcb. Good luck...

    16-32micros
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:22

    Hi Mauro,

    You can try to run first the latest templates from our web site

    http://www.st.com/stonline/products/support/micro/files/stm32f10x_stdperiph_lib.zip

    then go to this subdirectory :

    \stm32f10x_stdperiph_lib\Project\Template\EWARMv5

    Do not forget to change ''your target'' as shown below since you use Low-density devices which is compatible with STM3210B-EVAL board, else you will get a similar error :-).

    Hope this helps you.

    Cheers,

    STOne-32.

    [ This message was edited by: STOne-32 on 05-09-2009 02:54 ]