AnsweredAssumed Answered

Possible issue with iMX6 Platform SDK stack alignment at startup.

Question asked by Ed Sutter on May 30, 2013
Latest reply on Jun 25, 2013 by Ed Sutter
Branched to a new discussion

I've been wrestling with stability issues as I am trying to reuse portions of the iMX6 Platform SDK in my boot loader.  What I've found is that the memory map setup and the way stack is initialized, its possible that the stack pointer will not be double-word aligned.  Apparently it is important to start off with this double-word alignment, because I've found that when I build my boot loader and the "top_of_stack" location is NOT double-word aligned (divisible by 8), then my system doesn't boot; however, if I adjust the memory map to force that to a double-word aligned address it does boot.


While I don't fully understand the need for this double-word alignment, there is some information here...


Anyway, the easy fix for this is to simply force this alignment in the linker file...


    .stacks (NOLOAD) :


       . = ALIGN (8);          <<<<<< Add this line

        __stacks_start = .;

        . += 48K;

        __stacks_end = .;

        top_of_stacks = .;

    } > DDR


This apparently is not a problem for folks using the SDK (perhaps something else in the build is forcing this alignment that I'm not aware of), so I'd like to get feedback on this post to see if folks agree or disagree with this suggested change.