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.

Determining stack and heap usage.

Other Parts Discussed in Thread: MSP430G2755

MSP430G2755, CCS 6.1.0.00104.  I'm trying to get a handle on my stack and heap usage.  First I tried to set a stack overflow breakpoint as shown in the compiler user's guide - but I was not able to find that attribute for a breakpoint anywhere on the breakpoints view.  I then tried to use memset() in int _system_pre_init(void) to fill the stack with a pattern but it doesn't seem to be called (a breakpoint set in the routine never fires) and the memory isn't being set.

I also want to fill a pattern in the heap but I can find no reference in the .map file as to where it has been placed.

Thanks

Doug

  • I cannot vouch for how CCS does it, but when using IAR there is an option to have the map file contain a static stack usage analysis.

    Also, the heap isn't a defined region per se. Variables are put at the bottom of RAM and the stack at the top of RAM. Anything unused in between is the heap. (Again, this is how IAR does it).

  • Thanks, I should have figured that the heap would be all that wasn't variables and stack. CCS does not have a static stack usage analyzer (that I'm aware of).
    Doug
  • Doug Broadwell said:
    CCS does not have a static stack usage analyzer (that I'm aware of).

    While not integrated into CCS, there is the call_graph executable in the cg_xml package which can perform static stack usage analysis - see Finding out static stack usage

  • Hi Doug,

    This app note www.ti.com/.../slaa393 section 3.3 does make it seem like you should be able to set up a break on stack overflow breakpoint. Please let me know if the app note is not matching the options CCS is giving you. It looks like an example is even provided (Section A.2 of same app note, it's referring to an example project from http://www.ti.com/lit/zip/slaa393 as a demonstration).

    Regards,
    Katie

  • I think this feature is not supported by G2xx.
  • Jianyi Bao said:
    I think this feature is not supported by G2xx

    I think it depends upon the exact G2xx device.

    From an investigation:

    1) The SLAA393C Application Report explains that the "Break on Stack Overflow" is implemented as a compare on a register write to the stack pointer.

    2) Table 1. Emulation Module Overview in SLAA393C omits the capability of the EMM in G2xx devices.

    3) Table 28.3 EEM Configurations in MSP430x2xx Family User's Guide SLAU144J shows that a device with a "XS" EEM configuration doesn't have any CPU Register-Write Triggers, and thus a "XS" EEM configuration doesn't support a "Break on Stack Overflow".

    4) The MSP430G2755 datasheet SLAS800 doesn't appear to define which EEM configuration is used in the MSP430G2755.

    5) The SLAC460L source code for the MSP430.dll shows that a MSP430G2xx5 device has a "LowEemMode" configuration which doesn't support Register-Write Triggers. [Note the source code use the term "LOW" EEM rather than the "XS" EEM in MSP430x2xx Family User's Guide SLAU144J]

    Therefore, your MSP430G2755 device doesn't support the "Break on Stack Overflow", but others G2xx devices might do (I haven't checked the other G2xx devices).

    The above does suggest that the documentation about the EEM capabilities of different devices could be improved / clarified.

  • Table 1. Emulation Module Overview in SLAA393C contains no entry for G2xx, so does it indicate that it's not supported? I guess it is probably true because G2xx is lost cost.

  • Hi Chester,

    I'll file feedback on the SLAA393 document - the Table 1 Emulation Module Overview in section 10 looks like it is pretty out of date because it does not show entries for G2xx or any FRxx parts. I'll file this to hopefully be updated.

    Regards,
    Katie

**Attention** This is a public forum