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.

Symbols in stack?



Hi

Just looking at the .map output for a project built using the TI compiler.
Am I reading this right, because to me it seems like its placing variables within the stack area?

...

2000a6dd  chopper_state                
2000a6e4  __stack                      
2000b6e4  __STACK_END                  
2000b6e8  clients                
2000bdf0  atcmcorrection               
2000bdf4  caladc                       
2000be40  buspcb                    
2000be8c  RxHead                       
2000be90  RxTail                       
2000be94  altchar                      
2000bea0  lastchar                     
2000beb4  io_settings                 
2000bee4  __STACK_TOP                  
ffffffff  __binit__    

...

  • Hello Matthew,

    Can you provide which compiler/compiler version you are using? Given you posted originally in the TM4C E2E Forum, can we assume it is the TI ARM compiler being used within CCS? Please also include which linker version you are using.

    In the mean time, I will move this thread to the compiler forum since they would be better suited to answer with in depth explanations/discussion.
  • The TI ARM tools only create these stack related symbols: __stack, __STACK_END, __STACK_SIZE.  I don't know where the symbol __STACK_TOP comes from.

    The boot routine, which initializes the stack, does so using this pseudo-code

        sp = _stack
        sp += __STACK_SIZE

    Thanks and regards,

    -George

  • They symbols __stack and __STACK_END differ by 0x1000, which is correct if you specified a stack of that size. I agree with George, I don't know where __STACK_TOP comes from. It is probably defined in the linker command file.
  • Thanks for the replies.
    I'm using TI compiler in CCS.

    Another micro I'm working with (using GCC) uses the symbols __StackTop and __StackLimit, hence the confusion.

    So in this situation the micro will be using the space between __stack and __STACK_END, which has the correct 0x1000 stack size?

    The __STACK_TOP symbol is defined at the bottom of the CMD file.  I haven't altered this but it may have been adjusted before I got this project.  If this symbol isn't used I'll remove it.  In the mean time I've altered the CMD file to put the .stack at the very top of RAM, so its will away from any other symbols anyway.

    from the original CMD file:

    SECTIONS
    {
        .intvecs:   > APP_BASE
        .text   :   > FLASH
        .const  :   > FLASH
        .cinit  :   > FLASH
        .pinit  :   > FLASH

        .vtable :   > RAM_BASE
        .data   :   > SRAM
        .bss    :   > SRAM
        .sysmem :   > SRAM
        .stack  :   > SRAM
    }

    __STACK_TOP = __stack + 0x1800;

  • Matthew Gillott said:
    So in this situation the micro will be using the space between __stack and __STACK_END, which has the correct 0x1000 stack size?

    Probably.  The default stack size is 0x800.  So you must use the build option --stack=0x1000 .

    Thanks and regards,

    -George