Post Go back to editing

ADSP21489 Stack usage test

I need a program code for ADSP21489 that fills stack memory with appropriate value before main() execution

Parents
  • Hi,

    Stack and Heap are Run-time storage sections: The compiler uses the run-time stack as the storage area for local variables and returns addresses. During a function call, the calling function pushes the return address onto the stack. During a function call, the calling function pushes the return address onto the stack.

    If you define the memory values before the main() execution, it will act as the global variable and it will be stored on a fixed location decided by the compiler.

    incase you need to store the values in the stack, you need to define the memory value as a local variable within the programming blocks or subroutines.

    Since, we could not understand, why you are trying to declare the stack memory value before the main() execution, could you please share with us more details on this.

    Best Regards,
    Santhakumari.K

  • Hi,

    I would like to fill the Stack area with a dedicated pattern so that at runtime I can check that the fill level of the Stack does not reach some predetermined maximum.

  • Hi,

    For run-time memory usage, the Expert Linker does offer a means to analyze your stack/heap usage. Open your LDF in the Expert Linker, then right-click in the Expert Linker and select "Global Properties". Enable the option "Show stack/heap usage". After running your application, you can zoom in on the Stack/Heap sections in the Expert Linker and view the used/unused space (as illustrated in the help under 'Help: Contents: Graphical Environment: Expert Linker: Overview: Stack/Heap Usage'.

    Please refer "Run-Time Stack Storage" and "Run-Time Heap Storage" in below linked compiler manual:
    www.analog.com/.../50_21k_cc_mn_rev_1.5.pdf

    Regards,
    Santhakumari.K

  • Thanks for the suggested solution. But in my application, the hardware doesn't connect to the VDSP environment via JTAG at runtime, so this solution can't help.
    I need my operational program be able to check at runtime that the stack fill level is not reaching some predetermined maximum.

  • Hi,

    We added support for stack overflow detection capabilities detecting when an application's stack increases beyond its allocated size. This greatly enhances the debugging experience, as it means a pernicious issue can be detected immediately, before data corruption leads to hard-to-resolve second-order effects.

    Please refer in VisualDSP++ help for more information about Stack Overflows:
    C/C++ Compiler and Library Manual for SHARC® Processors > 2 Achieving Optimal Performance From C/C++ Source Code > Analyzing Your Application > Stack Overflow Detection

    For more information about Stack Overflow Detection please refer the following FAQ:
    ez.analog.com/.../faq-what-s-new-in-visualdsp-5-0-update-9

    Also, you can find the example project for the "Stack_Overflow_Detection" from the VisualDSP++ installation path:
    Installation path:\Analog Devices\VisualDSP 5.1.2\214xx\Examples\No Hardware Required\VDK

    Regards,
    Santhakumari.K

Reply
  • Hi,

    We added support for stack overflow detection capabilities detecting when an application's stack increases beyond its allocated size. This greatly enhances the debugging experience, as it means a pernicious issue can be detected immediately, before data corruption leads to hard-to-resolve second-order effects.

    Please refer in VisualDSP++ help for more information about Stack Overflows:
    C/C++ Compiler and Library Manual for SHARC® Processors > 2 Achieving Optimal Performance From C/C++ Source Code > Analyzing Your Application > Stack Overflow Detection

    For more information about Stack Overflow Detection please refer the following FAQ:
    ez.analog.com/.../faq-what-s-new-in-visualdsp-5-0-update-9

    Also, you can find the example project for the "Stack_Overflow_Detection" from the VisualDSP++ installation path:
    Installation path:\Analog Devices\VisualDSP 5.1.2\214xx\Examples\No Hardware Required\VDK

    Regards,
    Santhakumari.K

Children