<?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 What does _mqx_exit() do? in MQX Software Solutions</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/What-does-mqx-exit-do/m-p/232140#M6346</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everybody,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to start some code after mqx has finished.&lt;/P&gt;&lt;P&gt;In other words, I want mqx to terminate and continue execution from a predefined address in RAM (where I loaded some code).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I modified the bsp and psp so that _mqx_exit is enabled.&lt;/P&gt;&lt;P&gt;Then I modified mqx_main.c like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int main&lt;BR /&gt;&amp;nbsp;&amp;nbsp; (&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; void&lt;BR /&gt;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;{ /* Body */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; extern const MQX_INITIALIZATION_STRUCT MQX_init_struct;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; /* Start MQX */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; _mqx( (MQX_INITIALIZATION_STRUCT_PTR) &amp;amp;MQX_init_struct );&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; // mqx has terminated and is ready to run the loaded program&lt;BR /&gt;&amp;nbsp;&amp;nbsp; (*pFuncPointer)(); &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; return 0;&lt;/P&gt;&lt;P&gt;} /* Endbody */&lt;/P&gt;&lt;P&gt;where pFuncPointer holds the address of the code to be run.&lt;/P&gt;&lt;P&gt;I do not expect this "function" to return.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the debugger (CodeWarrior), I see that a brakpoint at pFuncPointer ist reached, but when I continue execution I stop in the idle task again and again.&lt;/P&gt;&lt;P&gt;I expected _mqx_exit to stop all tasks.&lt;/P&gt;&lt;P&gt;What do I need to do so I have only the code at pFuncPointer running?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and regards,&lt;/P&gt;&lt;P&gt;Martin &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 21 Jan 2013 16:26:28 GMT</pubDate>
    <dc:creator>martinpi</dc:creator>
    <dc:date>2013-01-21T16:26:28Z</dc:date>
    <item>
      <title>What does _mqx_exit() do?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/What-does-mqx-exit-do/m-p/232140#M6346</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everybody,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to start some code after mqx has finished.&lt;/P&gt;&lt;P&gt;In other words, I want mqx to terminate and continue execution from a predefined address in RAM (where I loaded some code).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I modified the bsp and psp so that _mqx_exit is enabled.&lt;/P&gt;&lt;P&gt;Then I modified mqx_main.c like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int main&lt;BR /&gt;&amp;nbsp;&amp;nbsp; (&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; void&lt;BR /&gt;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;{ /* Body */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; extern const MQX_INITIALIZATION_STRUCT MQX_init_struct;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; /* Start MQX */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; _mqx( (MQX_INITIALIZATION_STRUCT_PTR) &amp;amp;MQX_init_struct );&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; // mqx has terminated and is ready to run the loaded program&lt;BR /&gt;&amp;nbsp;&amp;nbsp; (*pFuncPointer)(); &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; return 0;&lt;/P&gt;&lt;P&gt;} /* Endbody */&lt;/P&gt;&lt;P&gt;where pFuncPointer holds the address of the code to be run.&lt;/P&gt;&lt;P&gt;I do not expect this "function" to return.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the debugger (CodeWarrior), I see that a brakpoint at pFuncPointer ist reached, but when I continue execution I stop in the idle task again and again.&lt;/P&gt;&lt;P&gt;I expected _mqx_exit to stop all tasks.&lt;/P&gt;&lt;P&gt;What do I need to do so I have only the code at pFuncPointer running?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and regards,&lt;/P&gt;&lt;P&gt;Martin &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jan 2013 16:26:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/What-does-mqx-exit-do/m-p/232140#M6346</guid>
      <dc:creator>martinpi</dc:creator>
      <dc:date>2013-01-21T16:26:28Z</dc:date>
    </item>
    <item>
      <title>Re: What does _mqx_exit() do?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/What-does-mqx-exit-do/m-p/232141#M6347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello martinpi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;have you read MQX reference manual about _mqx_exit function? Please read this NOTE:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"It is important to ensure that the environment (boot call stack) the MQX is&lt;/P&gt;&lt;P&gt;returning to is in the consistent state. This is not provided by distributed&lt;/P&gt;&lt;P&gt;MQX BSPs, because the boot stack is reused (rewritten) by MQX Kernel&lt;/P&gt;&lt;P&gt;data. Set the boot stack outside of Kernel data section to support correct&lt;/P&gt;&lt;P&gt;_mqx_exit functionality."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;MartinK&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2013 07:52:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/What-does-mqx-exit-do/m-p/232141#M6347</guid>
      <dc:creator>c0170</dc:creator>
      <dc:date>2013-01-24T07:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: What does _mqx_exit() do?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/What-does-mqx-exit-do/m-p/232142#M6348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, thank you, I did read that.&lt;/P&gt;&lt;P&gt;I compared the lcf to "Appendix C: linker command file (.lcf) in Code Warrior" in the document "Ethernet Bootloader for the MCU" and found the same values for bstack and end_of_kd. And, I think, this exactly what the bootloader should do: terminate and hand the control over.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, Martin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2013 11:51:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/What-does-mqx-exit-do/m-p/232142#M6348</guid>
      <dc:creator>martinpi</dc:creator>
      <dc:date>2013-01-24T11:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: What does _mqx_exit() do?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/What-does-mqx-exit-do/m-p/232143#M6349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello martinpi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can you share more code with us or at least detailed description which always helps to duplicate the behavior here on our side &lt;IMG alt="Smiley Wink" class="emoticon emoticon-smileywink" id="smileywink" src="https://community.nxp.com/i/smilies/16x16_smiley-wink.png" title="Smiley Wink" /&gt;&lt;/P&gt;&lt;P&gt;We believe your application enables interrupts because during exiting from MQX, users' interrupt vectors are restored (_int_set_vector_table in&amp;nbsp; int_vtab.c) and interrupts are disabled (. Do you enable INT?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created small application with enabled interrupts after _mqx_exit() and it did not enter the Idle task. To further answer your question what does _mqx_exit do, first it executes _mqx_exit where int are disabled, invokes exit handler if there's any and then jump to the this code which is in mqx.c file also:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_1359120569022162" jivemacro_uid="_1359120569022162"&gt;
&lt;P&gt;#if MQX_EXIT_ENABLED || MQX_CRIPPLED_EVALUATION&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Setup a longjmp buffer using setjmp, so that if an error occurs&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * in mqx initialization, we can perform a longjmp to this location.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Also _mqx_exit will use this jumpbuffer to longjmp to here in order&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * to cleanly exit MQX.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( MQX_SETJMP( _mqx_exit_jump_buffer_internal ) ) {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _GET_KERNEL_DATA(kernel_data);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _int_set_vector_table(kernel_data-&amp;gt;USERS_VBR);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return kernel_data-&amp;gt;USERS_ERROR;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } /* Endif */&lt;/P&gt;
&lt;P&gt;#endif&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;BR /&gt;&lt;/SPAN&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;MartinK&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2020 12:59:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/What-does-mqx-exit-do/m-p/232143#M6349</guid>
      <dc:creator>c0170</dc:creator>
      <dc:date>2020-11-02T12:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: What does _mqx_exit() do?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/What-does-mqx-exit-do/m-p/232144#M6350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your answer and sorry for not anwering for so lang time. I had an influenza. &lt;/P&gt;&lt;P&gt;I started with the serial_to_telnet example for the K60F120 tower.&lt;/P&gt;&lt;P&gt;When I found that still get into the idle task, I tried to disable the interrupts befor entering the code to be executed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(for some reasons I cannot paste code here, it looks somewhat like this:)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;void (*pFuncPointer)() = 0; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;in main (void) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; extern const MQX_INITIALISATION_STRUCT MQX_init_struct; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; mqx ( (MQX_INITIALISATION_STRUCT_PTR) &amp;amp;MQX_init_struct);&amp;nbsp;&amp;nbsp; //the normal mqx call &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; // now mqx has terminated and is ready to run the loaded program &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; if (pFuncPointer != 0) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _int_disable();&amp;nbsp;&amp;nbsp; // just to see if I can prevent mqx from entering the idle task again &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (*pFuncPointer)(); &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // should never reach this point here as pFuncPointer should contain a program with an infinite loop &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; return 0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;} // endbody&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, Martin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Feb 2013 16:35:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/What-does-mqx-exit-do/m-p/232144#M6350</guid>
      <dc:creator>martinpi</dc:creator>
      <dc:date>2013-02-07T16:35:58Z</dc:date>
    </item>
  </channel>
</rss>

