<?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: Anyone successful with _task_set_exit_handler and _task_set_exception_handler? in MQX Software Solutions</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/Anyone-successful-with-task-set-exit-handler-and-task-set/m-p/640322#M17071</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dave:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you use MQX4.2 or MQX for KSDK1.3?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Oct 2016 11:57:32 GMT</pubDate>
    <dc:creator>danielchen</dc:creator>
    <dc:date>2016-10-19T11:57:32Z</dc:date>
    <item>
      <title>Anyone successful with _task_set_exit_handler and _task_set_exception_handler?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Anyone-successful-with-task-set-exit-handler-and-task-set/m-p/640321#M17070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We've got a task (MQX for KSDK 1.2) that stops executing, and we have yet to figure out why. &amp;nbsp;It only occurs one in a blue moon, so it is hard to solve.&amp;nbsp; The current solution is to use _task_set_exit_handler and _task_set_exception_handler to trap the MQX task error number, if any.&amp;nbsp; Hopefully, this will give us more information about what's going wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, at the moment I'm not able to get _task_set_exit_handler to work.&amp;nbsp; I've implemented like this in os_tasks.cpp:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-cpp"&gt;&lt;CODE&gt;TASK_EXIT_FPTR &lt;SPAN class="token function"&gt;_task_set_exit_handler&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt; _task_id id&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; TASK_EXIT_FPTR f&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;// get info for the active task when this handler is called&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; _task_id active_task_id &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;_task_get_id&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; _mqx_uint active_task_error &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;_task_get_error&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;// don't really need this since we already have the error code&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; TD_STRUCT_PTR ptd_active &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;TD_STRUCT_PTR&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;_task_get_td&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt; active_task_error&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;




&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;// now get info for the ID that was passed in -- I suppose this is for the failed task...&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; TD_STRUCT_PTR ptd_passed &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;TD_STRUCT_PTR&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;_task_get_td&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt; id&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; _mqx_uint passed_task_error &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; ptd_passed&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;TASK_ERROR_CODE&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; NULL&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here I'm basically checking the active task at the time the exiting task exits to see if they are the same.&amp;nbsp; I then get the error code from each one, also for the purpose of comparison.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem I have is that when this code is executed with a breakpoint set (or if a breakpoint is added after execution), the debugger crashes:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;IMG alt="pastedImage_2.png" src="https://community.nxp.com/t5/image/serverpage/image-id/3489i097C83D5244A088F/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_2.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This behavior is consistent with the known behavior where GDB crashes if a breakpoint is set in code that never gets called by the application.&amp;nbsp; This implies that I'm not setting something up properly, but I do have the preprocessor setting "MQX_EXIT_ENABLED=1" in my project settings.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Has anyone else tried to use these functions and have gotten them to work?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2020 13:54:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Anyone-successful-with-task-set-exit-handler-and-task-set/m-p/640321#M17070</guid>
      <dc:creator>dave408</dc:creator>
      <dc:date>2020-11-02T13:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: Anyone successful with _task_set_exit_handler and _task_set_exception_handler?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Anyone-successful-with-task-set-exit-handler-and-task-set/m-p/640322#M17071</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dave:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you use MQX4.2 or MQX for KSDK1.3?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2016 11:57:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Anyone-successful-with-task-set-exit-handler-and-task-set/m-p/640322#M17071</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2016-10-19T11:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: Anyone successful with _task_set_exit_handler and _task_set_exception_handler?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Anyone-successful-with-task-set-exit-handler-and-task-set/m-p/640323#M17072</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, sorry for missing that level of detail!  MQX for KSDK 1.2.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2016 12:03:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Anyone-successful-with-task-set-exit-handler-and-task-set/m-p/640323#M17072</guid>
      <dc:creator>dave408</dc:creator>
      <dc:date>2016-10-19T12:03:46Z</dc:date>
    </item>
    <item>
      <title>Re: Anyone successful with _task_set_exit_handler and _task_set_exception_handler?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Anyone-successful-with-task-set-exit-handler-and-task-set/m-p/640324#M17073</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dave:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did a quick check with TWR-K65F180M and KSDK1.2.&lt;/P&gt;&lt;P&gt;I enabled MQX_EXIT_ENABLED in user_config.h , add add _mqx_exit(1) in hello task.&lt;/P&gt;&lt;P&gt;My observation is , when _mqx_exit is executed,&amp;nbsp; I can see system jump to _bsp_exit_handler successfully. It is a correct result because in init_bsp.c. the exit handler is set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#if MQX_EXIT_ENABLED&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; extern void&amp;nbsp; _bsp_exit_handler(void);&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Set the bsp exit handler, called by _mqx_exit */&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _mqx_set_exit_handler(_bsp_exit_handler);&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;#endif&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Oct 2016 08:26:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Anyone-successful-with-task-set-exit-handler-and-task-set/m-p/640324#M17073</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2016-10-20T08:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: Anyone successful with _task_set_exit_handler and _task_set_exception_handler?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Anyone-successful-with-task-set-exit-handler-and-task-set/m-p/640325#M17074</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel, I do not think what you have posted is what I am looking for.&amp;nbsp; I'm curious to determine why a specific task has stopped executing, not that the OS itself has stopped running.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Oct 2016 12:46:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Anyone-successful-with-task-set-exit-handler-and-task-set/m-p/640325#M17074</guid>
      <dc:creator>dave408</dc:creator>
      <dc:date>2016-10-20T12:46:07Z</dc:date>
    </item>
    <item>
      <title>Re: Anyone successful with _task_set_exit_handler and _task_set_exception_handler?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Anyone-successful-with-task-set-exit-handler-and-task-set/m-p/640326#M17075</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's my sample project.&amp;nbsp; Sorry, I had forgotten to attach it earlier.&amp;nbsp; This is for the FRDM-K22F development board.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Oct 2016 15:19:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Anyone-successful-with-task-set-exit-handler-and-task-set/m-p/640326#M17075</guid>
      <dc:creator>dave408</dc:creator>
      <dc:date>2016-10-24T15:19:37Z</dc:date>
    </item>
  </channel>
</rss>

