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.

TM4C129 Image stack pointer

I am trying to create  the application image and on inspection of the binary file created, I can see the correct information being loaded into the vector table except for the stack address.  In the first address of the vector table for the application I would expect to see the stack address loaded, but am seeing all zeros instead. 

My question is, when using TI-RTOS and using the IAR compiler/development environment, how do I set the stack location?  I have played around with the linker file (*.icf) and can see some changes in the output but nothing seems to cause the stack pointer to get set. (There are no tags for stack in there)  Since the startup code is generated and resident within TI-RTOS, Is there something that I need to do with the config.cmd file that is used to create TI-RTOS libraries? 

  • Hello Juan

    Moving it to the TI-RTOS forum as the question would be better answered here.
  • With TI-RTOS applications, the zero-th entry of the vector table is supposed to be initialized to this value:

           (UInt32)(&CSTACK$$Limit),

    What value does this symbol have in your .map file? Can you share your .icf file?


    Alan

  • Here is what is set in the Map file:

     

    CSTACK$$Base            0x00000000           Data  Gb  - Linker created -

    CSTACK$$Length          0x00000000            --   Gb  - Linker created -

    CSTACK$$Limit           0x00000000           Data  Gb  - Linker created –

     

    Attached is the .icf file.https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/355/2768.PLV2Release.icf

  • I don't see any CSTACK definition in the .icf file.
    Please add these lines to your .icf file and see if it helps:

    //
    // Define CSTACK block to contain .stack section. This enables the IAR IDE
    // to properly show the stack content during debug. Place stack at end of
    // retention RAM, do not initialize (initializing the stack will destroy the
    // return address from the initialization code, causing the processor to branch
    // to zero and fault)
    //
    define block CSTACK with alignment = 8, size = 0x800 { section .stack };
    place at end of SRAM { block CSTACK };
    do not initialize { section .stack, section .noinit};

    //
    // Export stack top symbol. Used by startup file.
    //
    define exported symbol STACK_TOP = 0x20040000;

    Alan
  • I placed this in my code and now it is putting something in the first 32 bits of the image, but not what I expected: (First 16 words…)

    0000 0420 4D1F 0400 A1E7 0300 A1E7 0300 A1E7 0300 A1E7 0300 A1E7 0300 A1E7 0300

    Changed the value of STACK_TOP to different values and the value loaded in the first 32 bits of the image does not change. Is there something else that is missing?
  • Change your memory view to show 32 bit words.
    I think the first entry is correct.
    0000 0420 is 20040000 in little endian mode.
  • There was a suggested answer and since there has been no active on this thread for more than a week, the suggested answer was marked as verify. Please feel free to select the "Reject Answer" button and reply with more details.