This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C123GH6PM: About Stack Addresses

Part Number: TM4C123GH6PM

Hi team,

The stack size is described in the cmd file as "__STACK_TOP = __stack + 1024;".
However, when I checked the MAP file, I found the following

Add:0x20000928 = __stack
Add:0x20000d28 = __STACK_END
Add:0x20000d28 = __STACK_TOP

Why are the address values of __STACK_END and __STACK_TOP the same?
Also, if I want to change the addresses of __STACK_END and __STACK_TOP, what kind of operation should I do?
The version of CCS I was using is (Ver:11.1.0.00011)

Sincerely.
Ryu

  • Please show exactly how the linker is invoked, including all the options, and all the system response.  Please copy and paste the text, and do not use a screen shot.

    What is the version of the compiler and linker?  This appears in the first few lines of the map file. 

    Please attach the linker command file to your next post.  So the forum accepts it, add the file extension .txt to it.

    Thanks and regards,

    -George

  • Linker version was v20.2.5
    First of all, I would like to know what __STACK_END and __STACK_TOP mean.
    I would like to know how the address is determined.

    Sincerely.
    Ryu

  • By default, the linker creates these symbols related to the stack.

    • __stack : base address of the .stack section
    • __STACK_SIZE : the size (counted as bytes) of the .stack section
    • __STACK_END : the address of the first byte after the .stack section

    It is likely that the symbol __STACK_TOP is created, in the linker command file, because that name is more descriptive than the name __STACK_END.  On ARM systems, the stack grows from higher address to lower addresses.  Thus, when the SP register is initialized, it is not set to the base address of the .stack section, but an address near the end of the .stack section (aligned to an 8 byte address).  The code which does that makes a little more sense using a symbol named __STACK_TOP rather than a symbol named __STACK_END.

    Thanks and regards,

    -George

  • Thanks for the reply.
    So STACK_TOP and STACK_END mean the same thing?
    Is there any way that only one of the addresses can be changed?

    Sincerely.
    Ryu

  • So STACK_TOP and STACK_END mean the same thing?

    They correspond to the same address.

    Is there any way that only one of the addresses can be changed?

    It is harmless to have multiple symbols for the same address.  What is the overall problem you want to solve?

    Thanks and regards,

    -George

  • Thanks for the reply.
    I was able to solve what I needed to know.

    Sincerely.
    Ryu