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.

F28M35H52C: No stack?

Part Number: F28M35H52C


Hello.

I have to place some sections in RAM and in order to have the maximal amount of space there I started reducing other sections. As a test, I wanted to see how small the stack could be (still allowing the program to work fine) and, surprisingly I found that I could set it to 0x0 and the program still worked (and I had the same results that I had had with -stack=0x1000).

I frankly can not understand how this is possible. Could someone please give me an explanation?

The .map (.txt) file is attached.

0160.RAM_management_c28.txt

  • Hello user,
    From the map file, I can see that stack is allocated to RAMM0 region (0x1A2). on C28x stack grows from LOW to HIGH, so as long as RAM from 0x1A2 is not used by any other part of your application your application will run.

    The default SP value that the boot ROM leaves SP at before branching to application in flash and the default SP on device reset is 0x400. User application should set the SP to a RAM that is allocated for stack. So here again the RAMM1 from 0x400 looks like is free and not used by any other part of your application, so your application will run fine.

    To find out how much stack exactly the application has used, try something like below. I means apply this your use case as you see fit.

    1.> assuming your SP at program start is 0x400.
    2.> After your program is loaded and before your program starts, go to memory window and fill a known pattern of data (like 0xFOOD or 0xDEAD) in the stack memory (0x400 to 0x800 for ex:).
    3.> now run your application for however long you think it will take to hit most of the code execution and PAUSE the applicaiton or HALT the applicaiton
    4.> go to memory window and inspect the last address that still has the pattern you filled

    This will tell you how much memory is used for stack by your application. Also if your code uses any local variable assuming they are initialized to zero, your application might break now because your stack is initialized to 0xDEAD instead of 0x0 now.

    Hope this helps.


    Best Regards
    Santosh Athuru