This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

The boundary of stack

Hello,

I have a scatter loading file that defines the stack as below:

ARM_LIB_STACK 0x00BFFFFFF0 EMPTY -0x20000
{}

In the compiled image, I can see these symbols (by running nm -g command):

00000000bffdfff0                    A       Image$$ARM_LIB_STACK$$ZI$$Base
0000000000020000           A       Image$$ARM_LIB_STACK$$ZI$$Length
00000000bffffff0                     A        Image$$ARM_LIB_STACK$$ZI$$Limit

The common practice is to set SP to 0x00BFFFFFF0 in the system initialization code. But armlink_user_guide documents Image$$region_name$$ZI$$Limit as "Address of the byte beyond the end of the ZI output section in the execution region". It sounds like Image$$ARM_LIB_STACK$$ZI$$Limit should not be part of the stack. This is confusing. which address should be regarded as part of the stack,   Image$$ARM_LIB_STACK$$ZI$$Base or   Image$$ARM_LIB_STACK$$ZI$$Limit? Due to the stack alignment requirement, the SP can only be 0x00BFFFFFF0 in my case. Then Image$$ARM_LIB_STACK$$ZI$$Base is not correct. Obviously:

  Image$$ARM_LIB_STACK$$ZI$$Limit -   Image$$ARM_LIB_STACK$$ZI$$Base + 1 = 0x20000 + 1

if both of them are inclusive.

Thanks

-Oscar

Parents Reply Children