2024-09-18 06:30 AM
Greetings and thanks for reading.
FreeRTOS has a built in utility function uxTaskGetStackHighWaterMark() that reports on the amount of space unused by the stack. You can use this function to gauge just how much of the stack is used and how close you are to corruption or conversely how much memory you are wasting. Its a way of both preventing crashes (due to blown stacks) and simultaneous allowing you to optimize the size of the stack for applications that may be tight on memory.
Within the Azure ThreadX I could find no such function that will report such useful information. Is there such a utility within ThreadX that I can call?
Thanks,
Hab
Solved! Go to Solution.
2024-09-20 05:09 AM
Thank you for responding. That's not exactly what I was looking for, but I think something I can use all the same. In retrospect I got hung up searching for the term "water-mark" in the documentation.
Thanks,
Hab
2024-09-19 04:25 AM
Hello @Hab Collector ,
you can find a lot of APIs dedicate to thread usage analyses and error detection related to ThreadX .
see the following threadx/common/inc/tx_api.h at master · eclipse-threadx/threadx (github.com)
/* Define the random stack fill number. This can be used to detect stack overflow. */
ULONG tx_thread_stack_fill_value;
#define tx_thread_stack_error_notify _tx_thread_stack_error_notify
/* Add a default macro that can be re-defined in tx_port.h to add processing to the thread stack analyze function.
By default, this is simply defined as whitespace. */
#ifndef TX_THREAD_STACK_ANALYZE_EXTENSION
#define TX_THREAD_STACK_CHECK(a)
here are some examples from the TX_API.h file. Also, in CubleIDE you can find the extension for viewing ThreadX threads memory semaphores Stack usages and other related information using the Serial wire viewer feature.
Hope this might help you.
Regards
2024-09-20 05:09 AM
Thank you for responding. That's not exactly what I was looking for, but I think something I can use all the same. In retrospect I got hung up searching for the term "water-mark" in the documentation.
Thanks,
Hab
2024-09-20 05:29 AM
Just : i dont get this working:
@STea : Also, in CubleIDE you can find the extension for viewing ThreadX threads memory semaphores Stack usages and other related information using the Serial wire viewer feature.
But (for me) : stack usage shows nothing:
What i have to do, to see it ?
2024-09-20 06:10 AM
Stack usage for me also shows nothing, what I was previously doing to check for potential errors was looking at the Stack Start and Stack End and the Stack Ptr - checking to see the Stack Ptr was within said range. You can only do this on break points so in all this was not very effective. Yes it would be nice to see stack usage here - I guess that would be a type of water mark.
2024-09-20 07:37 AM
Hello @AScha.3 ,
check this video minutes 26 (284) MOOC - Azure RTOS workshop - 5 ThreadX lab - step1 - First thread creation - YouTube
you need to click on green table on the right corner to enable it.
Regards
2024-09-20 07:45 AM - edited 2024-09-20 09:22 AM
Thanks @STea ,
this click was the secret. Now :
:)
:)
:)
Great !