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.

TMS320F28335: Assembly file data SOE and FR size

Part Number: TMS320F28335


Tool/software:

Hi,

I am currently debugging an issue in one of our units at field.
From time to time we are getting an unexpected behavior that leads to an external reset. (due to time off )

I am suspecting the we are facing stack overflow, however, I don't have access to use the debugger on this unit.

I am now comparing the .asm files to last working FW version and I have noticed a change in some of the function Properties.


I am wondering what is the meaning of SOE and FR.
(From the documentation I caמ see that FR = Frame Size  and SOE = Save on Entry)
 
However, I did not understand what is the meaning of SOE = 2 and what can change it from 0 to 2.
Does it affected nested Interrupts regarding to Stack? 

Can someone please elaborate on this topic?

Regards,
Michael





Btw, 
the code was compiled by CCS3.3, C2000 Code Generation Tools 6.2.4

  • Please search the C28x compiler manual for the sub-chapter titled Function Structure and Calling Conventions.  Become familiar with this sub-chapter.  Focus on the part titled How a Called Function Responds.  That describes what happens with the stack at the beginning of a function.  This next screenshot comes from this sub-chapter.

    For the purposes of this post, this diagram needs another block.  Call it SOE Registers.  Put it between Previous RPC Value and Local Frame.  The numbers you see in the comment block before each function are:

    • Parameter: Local argument block
    • Auto: Local Frame
    • SOE: SOE Registers
    • FR SIZE: The total of the above three

    All of the numbers represent the number of 16-bit words on the stack.

    In your specific case, the important difference is SOE changes from 0 to 2.  This means 2 SOE registers are pushed at the start of the function, and popped at the end.  This explains the overall change of FR SIZE from 2 to 4.

    Thanks and regards,

    -George

  • Hi George,

    Thank you for your answer, I have another 2 questions,

    1. Since the TI F28335 is working at "word addressing" should I need to calculate my stack size by the factor of 2?
    For example: My stack is 0x700 (1792 decimal). effectively the real size in bytes is 1792/2 = 896   ?

    2. For debugging purpose I am trying to read the values inside the stack by pointers, and I want to see if the stack is keep growing close to its max.
    I am reading locations near the start and end of the Stack (reading near the start is for sanity check).
    The issue is that I see constant values at both start and end.

    I am wondering if maybe those addresses are protected somehow. and I cant use this method for debugging.

    attached snippet of my code and the map:


    volatile int16 *pstack1  = (int16*)0x00000074C;  // PRINTING TO 0X750 - 0X14 == LOOKING FOR THE LAST 20 WORDS OF THE STACK
    volatile int16 *pstack   = (int16*)0x000000055;  // PRINTING TO 0X050 + 0X5 == LOOKING FOR THE START THE STACK (SANITY CHECK)

                IO_printf("    \r\n stack =%ul \r\n",         *pstack);
                IO_printf("    \r\n stack1 =%ul \r\n",        *pstack1);








    Regards,
    Michael


  • Since the TI F28335 is working at "word addressing" should I need to calculate my stack size by the factor of 2?

    An address on C28x corresponds to a 16-bit word.  The same is true every time you see an address, size count, etc. in the linker map file, the debugger, etc. On rare occasions, you may want to convert a size number to a count of 8-bit bytes.  To do that, multiply by 2.

    For debugging purpose I am trying to read the values inside the stack

    If you can insert print calls, then print the address of a local variable.  Use code similar to ...

    IO_printf("0x%lx\n", (long) &local_variable);

    That doesn't show the exact contents of the SP.  But it is close.  Keep in mind the print call itself may use a lot of stack.

    Thanks and regards,

    -George

  • Thanks a lot George!

  • Hi,

    Just to be clear: 

    So if my stack size is 0x700 that means that it is 0x700 words?
    each address corresponded to 2 bytes?
    there difference between  0x0000001 to 0x00000002 is 2 bytes? 

    Thanks,
    Michael

  • if my stack size is 0x700 that means that it is 0x700 words?

    Yes.  When I want to be especially clear I say 0x700 16-bit words.

    each address corresponded to 2 bytes?

    By "byte", I presume you mean an 8-bit byte.  Yes.

    there difference between  0x0000001 to 0x00000002 is 2 bytes? 

    The difference is 2 8-bit bytes.

    Thanks and regards,

    -George

  • Thanks Again George

    last question hopefully.. In which chapter of the C28x compiler manual can I find how the data is saved to the stack while interrupts are triggers? (Nested interrupt in particular)


    for example:
    If I have 3 Interrupts  INT1,INT2 and INT3 with chronological priority (INT1 top priority etc.)
    How the stack will behave in case of nested interrupts?

    Thanks a lot for your support,
    Michael

  • The compiler manual does not describe what happens to the stack when an interrupt occurs.  For those details, please search the C28x CPU manual for the chapter titled CPU Interrupts and Reset.  If that does not answer your questions, then I suggest you start a new thread.  Or, if you prefer, you can ask me to change responsibility for this thread to the C28x CPU experts.

    Thanks and regards,

    -George

  • Thanks a lot for your support,

    I will open new thread.

    Regards,

    Michael