<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to determine how much stack is used in a task in MQX Software Solutions</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-determine-how-much-stack-is-used-in-a-task/m-p/272987#M8453</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/c0170" rel="nofollow noopener noreferrer" target="_blank"&gt;c0170&lt;/A&gt;​, I came across this post and thought it would be a useful way to debug a problem where I think I am running out of task stack space.&amp;nbsp; I added &lt;STRONG&gt;MQX_MONITOR_STACK&lt;/STRONG&gt; to my preprocessor settings, and initially everything seemed okay with my device, which is based on the &lt;STRONG&gt;MK22FN256VLL12&lt;/STRONG&gt;.&amp;nbsp; However, one of the PWM devices on the board was not working, and after much trial-and-error to determine the cause, I found that with MQX_MONITOR_STACK defined, KSDK 1.2's &lt;STRONG&gt;FTM_DRV_PwmStart()&lt;/STRONG&gt; no longer worked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I set 100% PWM, the output would be remain low.&amp;nbsp; If I remove MQX_MONITOR_STACK, rebuild, and re-run, the PWM output operates as expected.&amp;nbsp; Have you heard of this happening before?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have read that all this does is write the "stak" watermark in the remaining stack space.&amp;nbsp; I am not an expert with the RTOS internals nor with assembly, so I can accept with blind faith that what I'm seeing in dispatch.S supports this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14491991542463090" data-renderedposition="197_8_1232_192" jivemacro_uid="_14491991542463090"&gt;&lt;P&gt;#if MQX_MONITOR_STACK&lt;/P&gt;&lt;P&gt;ASM_LABEL(_fill_stack)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lsrs&amp;nbsp; r1, r1, #2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; adds&amp;nbsp; r1, r1, #1&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Calculate size in _mqx_uints. */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ldr r2, =0x7374616B /* Load pattern "kats". */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b.n _fill_stack_1&lt;/P&gt;&lt;P&gt;ASM_LABEL(_fill_stack_0)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; str.w r2, [r0], #4&amp;nbsp; /* Store pattern to address and increment pointer to next address. */&lt;/P&gt;&lt;P&gt;ASM_LABEL(_fill_stack_1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; subs r1, r1, #1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Decrement size counter. */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bne.n _fill_stack_0&lt;/P&gt;&lt;P&gt;#endif /* MQX_MONITOR_STACK */&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've also read that &lt;STRONG&gt;MQX_KERNEL_LOGGING&lt;/STRONG&gt; has to be added to enable the _klog* functions, but I have verified that kernel logging is NOT enabled, so I'm having trouble seeing how filling the stack would cause the KSDK PWM function to stop working.&amp;nbsp; Can you please help me to understand how these two things are related?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 04 Dec 2015 03:28:01 GMT</pubDate>
    <dc:creator>dave408</dc:creator>
    <dc:date>2015-12-04T03:28:01Z</dc:date>
    <item>
      <title>How to determine how much stack is used in a task</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-determine-how-much-stack-is-used-in-a-task/m-p/272981#M8447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As my project grows, I am finding that I am running out of memory for use in the stacks.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to take away stack space in tasks that seemed very simple, but that is turning into a hit or miss approach that takes a lot of time and even if it doesn't crash the system, I don't want to take away something that will be needed later.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there anywhere I can look in the TAD options or any rules of thumb that I can use for specifying stack space for a task to ensure that I am using enough and no more?&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanx,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;myke&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Apr 2013 16:25:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-determine-how-much-stack-is-used-in-a-task/m-p/272981#M8447</guid>
      <dc:creator>myke_predko</dc:creator>
      <dc:date>2013-04-17T16:25:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine how much stack is used in a task</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-determine-how-much-stack-is-used-in-a-task/m-p/272982#M8448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Myke Predko,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TAD provides the Stack usage feature where you can see how much stack is being used. Another available choice is to use klog (source/io/klog.c). Following functions are defined in the code file:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;_klog_get_task_stack_usage&lt;/P&gt;&lt;P&gt;_klog_get_interrupt_stack_usage&lt;/P&gt;&lt;P&gt;_klog_show_stack_usage&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To use them, an application must enable kernel logging (MQX_KERNEL_LOGGING) and enable monitor stack monitoring (MQX_MONITOR_STACK). Please refer to the source code for more information and MQX RM.&lt;/P&gt;&lt;P&gt;Let us know which one fits your needs and share the result with us! :smileywink:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;c0170&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Apr 2013 16:59:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-determine-how-much-stack-is-used-in-a-task/m-p/272982#M8448</guid>
      <dc:creator>c0170</dc:creator>
      <dc:date>2013-04-17T16:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine how much stack is used in a task</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-determine-how-much-stack-is-used-in-a-task/m-p/272983#M8449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry, I should have been more specific in saying that I was aware of looking at the stack usage from MQX - the problem with these methods is that they show current use, not the maximum.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I follow these values and reduce them what seems appropriate I find problems during execution.&amp;nbsp; For example, if in a task, I see that it is using 21% of the stack available I feel that I should be able to reduce it's stack safely by 50% - BUT, it seems like the stack usage increases with system calls (which I really don't want to go through and look at their local variable usage).&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a flag I have to set for the system to report stack errors?&amp;nbsp; I am presuming that I have a stack error because:&lt;/P&gt;&lt;P&gt;a) I reduced the stack on a number of tasks&lt;/P&gt;&lt;P&gt;b) The application runs erratically&lt;/P&gt;&lt;P&gt;c) When I look at the task summary, the information for different tasks seems to have been overriden&lt;/P&gt;&lt;P&gt;d) When I restore the stack sizes, the application runs as it did, there is no strangeness in the task summary&lt;/P&gt;&lt;P&gt;But, I don't get a halt/panic due to a stack error.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanx,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;myke&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Apr 2013 18:58:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-determine-how-much-stack-is-used-in-a-task/m-p/272983#M8449</guid>
      <dc:creator>myke_predko</dc:creator>
      <dc:date>2013-04-17T18:58:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine how much stack is used in a task</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-determine-how-much-stack-is-used-in-a-task/m-p/272984#M8450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Myke Predko,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe TAD uses the stack monitor feature in MQX which calculates the stack usage based on a pattern (maximum stack usage, how far stack has gone down for each task). If an application enables the stack monitor, the entire stack is filled with the pattern. This can be used as a watermark, therefore open your memory window and run an application for a while to execute deepest calls. Then calculate how deep the stack usage has gone.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pattern to watch in the memory window:&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13662653580941131" jivemacro_uid="_13662653580941131"&gt;
&lt;P&gt;#define MQX_STACK_MONITOR_VALUE (_mqx_uint)(0x7374616B)&lt;/P&gt;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The name of the function which fills stack with the pattern located in _mqx function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="_jivemacro_uid_13662653580719855 jive_text_macro jive_macro_code" jivemacro_uid="_13662653580719855"&gt;
&lt;P&gt;#if MQX_MONITOR_STACK&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _task_fill_stack_internal((_mqx_uint_ptr)stack_ptr, result);&lt;/P&gt;
&lt;P&gt;#endif&lt;/P&gt;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should end up approximately with same numbers as stack usage percentages in TAD plugin. This brings up the question if my assumptions about TAD were correct, how come your application faces stack corruptions. You can prove this with watching memory window, each stack has own size and a base address. Please verify each stack space in memory window after a reduction of stack sizes if there's still the defined pattern within its own space, that would prove there's no stack overflow.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are some static methods which could help you to find out an application's deepest call. They usually need a help from a linker to be accurate (indirect calls), like in KEIL there's callgraph and IAR has own plugin stack.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;c0170&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Apr 2013 06:08:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-determine-how-much-stack-is-used-in-a-task/m-p/272984#M8450</guid>
      <dc:creator>c0170</dc:creator>
      <dc:date>2013-04-18T06:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine how much stack is used in a task</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-determine-how-much-stack-is-used-in-a-task/m-p/272985#M8451</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I understand your suggestions, you are saying:&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; Fill each stack area with a known pattern.&amp;nbsp; The one you suggest is a 32 bit value, the ASCII string "stak", in each word of the stack area.&amp;nbsp; &lt;/P&gt;&lt;P&gt;2.&amp;nbsp; Run the application for a while.&amp;nbsp; &lt;/P&gt;&lt;P&gt;3.&amp;nbsp; Identify the locations of the stacks for each task and open a memory window in CW.&amp;nbsp; &lt;/P&gt;&lt;P&gt;4.&amp;nbsp; Look at how much of the "stak" pattern is overrun for each task.&amp;nbsp; &lt;/P&gt;&lt;P&gt;5.&amp;nbsp; Correlate what I am finding with the percentages provided by TAD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, when I look at the actual stack contents, it seems like they are initially already filled with the "stak" words and when I validate them, the percentages are off by a rounding error (they algorithm doesn't seem to round up/down properly or as expected).&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, my next step is to reduce the stacks for the various tasks and see if I can replicate what I saw before AND understand where the problem lies.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanx for the pointers - I'll let you know how I make out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;myke&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Apr 2013 15:48:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-determine-how-much-stack-is-used-in-a-task/m-p/272985#M8451</guid>
      <dc:creator>myke_predko</dc:creator>
      <dc:date>2013-04-19T15:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine how much stack is used in a task</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-determine-how-much-stack-is-used-in-a-task/m-p/272986#M8452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Martin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanx for the explanation - I think you gave me the background I needed to understand how to see how much stack was being used.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm still going to keep stack usage below 50% and size at 512 bytes or above for safety, but even this allows me to save a few k in the application.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanx Again!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;myke&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 20 Apr 2013 03:20:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-determine-how-much-stack-is-used-in-a-task/m-p/272986#M8452</guid>
      <dc:creator>myke_predko</dc:creator>
      <dc:date>2013-04-20T03:20:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine how much stack is used in a task</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-determine-how-much-stack-is-used-in-a-task/m-p/272987#M8453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/c0170" rel="nofollow noopener noreferrer" target="_blank"&gt;c0170&lt;/A&gt;​, I came across this post and thought it would be a useful way to debug a problem where I think I am running out of task stack space.&amp;nbsp; I added &lt;STRONG&gt;MQX_MONITOR_STACK&lt;/STRONG&gt; to my preprocessor settings, and initially everything seemed okay with my device, which is based on the &lt;STRONG&gt;MK22FN256VLL12&lt;/STRONG&gt;.&amp;nbsp; However, one of the PWM devices on the board was not working, and after much trial-and-error to determine the cause, I found that with MQX_MONITOR_STACK defined, KSDK 1.2's &lt;STRONG&gt;FTM_DRV_PwmStart()&lt;/STRONG&gt; no longer worked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I set 100% PWM, the output would be remain low.&amp;nbsp; If I remove MQX_MONITOR_STACK, rebuild, and re-run, the PWM output operates as expected.&amp;nbsp; Have you heard of this happening before?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have read that all this does is write the "stak" watermark in the remaining stack space.&amp;nbsp; I am not an expert with the RTOS internals nor with assembly, so I can accept with blind faith that what I'm seeing in dispatch.S supports this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14491991542463090" data-renderedposition="197_8_1232_192" jivemacro_uid="_14491991542463090"&gt;&lt;P&gt;#if MQX_MONITOR_STACK&lt;/P&gt;&lt;P&gt;ASM_LABEL(_fill_stack)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lsrs&amp;nbsp; r1, r1, #2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; adds&amp;nbsp; r1, r1, #1&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Calculate size in _mqx_uints. */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ldr r2, =0x7374616B /* Load pattern "kats". */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b.n _fill_stack_1&lt;/P&gt;&lt;P&gt;ASM_LABEL(_fill_stack_0)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; str.w r2, [r0], #4&amp;nbsp; /* Store pattern to address and increment pointer to next address. */&lt;/P&gt;&lt;P&gt;ASM_LABEL(_fill_stack_1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; subs r1, r1, #1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Decrement size counter. */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bne.n _fill_stack_0&lt;/P&gt;&lt;P&gt;#endif /* MQX_MONITOR_STACK */&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've also read that &lt;STRONG&gt;MQX_KERNEL_LOGGING&lt;/STRONG&gt; has to be added to enable the _klog* functions, but I have verified that kernel logging is NOT enabled, so I'm having trouble seeing how filling the stack would cause the KSDK PWM function to stop working.&amp;nbsp; Can you please help me to understand how these two things are related?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Dec 2015 03:28:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-determine-how-much-stack-is-used-in-a-task/m-p/272987#M8453</guid>
      <dc:creator>dave408</dc:creator>
      <dc:date>2015-12-04T03:28:01Z</dc:date>
    </item>
  </channel>
</rss>

