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.

AM2634: vApplicationStackOverflowHook() how do i use it?

Part Number: AM2634
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

hi

I'm using freertos.
It keeps stopping during use.
static portTASK_FUNCTION (prvIdleTask, pvParameters) stops in the function.
Can you tell me why it stops?

And I'd like to check if there's an overflow in the stack.
Tell me how to use vApplicationStackOverflowHook()

  • I use SemaphoreP_pend(), SemaphoreP_post() while uart communication, but the development board stops.
    It stops when you receive and send more than 150,000 times.

    sysconfig 1.20
    sdk+ 9.2.0.5

  • I used vSemaphoreCreateBinary() ,xSemaphoreTake(), xSemaphoreGiveFromISR() as a solution.

  • Hi Gyeongju Kwon,

    When you create a task using xTaskCreate(), then the memory is used as the task's stack is allocated from the FreeRTOS heap. By default for checking the stack overflow, the configCHECK_FOR_STACK_OVERFLOW is set to "1" and the portSTACK_GROWTH is set to "-1". So the "vApplicationStackOverflowHook" is compiled as a part of the port.c file when building the FreeRTOS library.

    You don't need to explicitly call the vApplicationStackOverflowHook function, rather it will catch a stack overflow and throw a DebugP_logError and assert. You can find the implementation in source/kernel/freertos/portable/TI_ARM_CLANG/ARM_R5F/port.c.
     
    My suggestion would be to once set the configCHECK_FOR_STACK_OVERFLOW value to 2 in source/kernel/freertos/config/am263x/r5f/FreeRTOSConfig.h file and recompile the FreeRTOS library in your SDK using the following command
    gmake -sj -f makefile.am263x freertos_r5f.ti-arm-clang_clean PROFILE=debug
    gmake -sj -f makefile.am263x freertos_r5f.ti-arm-clang PROFILE=debug

    Then re-build your application and try running again.
    When the configCHECK_FOR_STACK_OVERFLOW is set to 2, it performs more overflow checks but also results in a higher overhead.
    but the development board stops.
    It stops when you receive and send more than 150,000 times.

    Does it go into some assert or abort handler or cause a memory corruption? Can you explain what exactly happens when development board stops?

    Regards,
    Shaunak

  • I think it's a memory corruption.
    Is there a way to initialize memory while in use?

  • Hi Gyeongju,

    I think it's a memory corruption.

    I would like to understand how we came to this conclusion. Is there any specific function or operation which corrupts your memory? Is there any way you can try to put up a breakpoint  and see the memory browser before/after to confirm this?

    The memory is init by the bootloader and then the application will clear the memory. What memory region do you want to re-initialize at run-time? Do you just want to zero-out the memory or Hardware initialize the memory. Can you elaborate on the "initialize memory while in use" part please?

    Regards,
    Shaunak