<?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>8-bit Microcontrollers中的主题 MC9S08QG8 and strange reset while debugging</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QG8-and-strange-reset-while-debugging/m-p/178065#M12617</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've been getting a strange reset. Here is when it happens:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;From the main I'm calling ejectarea():&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;void ejectarea(void){ byte categ;&amp;nbsp; byte tarea;&amp;nbsp;&amp;nbsp;&amp;nbsp; categ = concatenar(msgTipRcv[0], msgTipRcv[1]);&amp;nbsp; tarea = concatenar(msgRecRcv[0], msgRecRcv[1]);...&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;The program does the first concatenar() but the reset ocurrs in the second.&lt;BR /&gt;&lt;BR /&gt;concatenar() has:&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;byte concatenar(char char1, char char2){ byte num12;&amp;nbsp; char char12[2] = "";&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; char12[0] = char1;&amp;nbsp; strcat(&amp;amp;char12, &amp;amp;char2);&amp;nbsp; num12 = atoi(&amp;amp;char12);

...
&lt;/PRE&gt;&lt;/DIV&gt;&amp;nbsp;&lt;BR /&gt;&lt;/DIV&gt;The reset ocurrs inside strcat() (of string.c) at this part of the code:&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;LIBDEF_StringPtr strcat(LIBDEF_StringPtr str_d, LIBDEF_ConstStringPtr str_s) {&amp;nbsp; LIBDEF_StringPtr sd = str_d;&amp;nbsp; str_d += strlen(str_d);&amp;nbsp; while(*str_d++ = *str_s++) {}&amp;nbsp; return (sd);}&lt;/PRE&gt;&lt;/DIV&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fimg143.imageshack.us%2Fimg143%2F3632%2Fbeforejk1.png" rel="noopener noreferrer" target="_blank"&gt;&lt;BR /&gt;Screenshot&lt;/A&gt; before the reset.&lt;BR /&gt;&lt;BR /&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fimg186.imageshack.us%2Fimg186%2F900%2Fafterto0.png" rel="noopener noreferrer" target="_blank"&gt;Screenshot&lt;/A&gt; after the reset.&lt;BR /&gt;&lt;BR /&gt;It says: "Error: Unable to go into background mode."&lt;BR /&gt;&lt;BR /&gt;Not sure if it is due to the debugger or what but the hardware is not working well and the only way to check for errors is debuggin the code.&lt;BR /&gt;&lt;BR /&gt;Any ideas?&lt;BR /&gt;&lt;BR /&gt;Thanks a lot&lt;BR /&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Oct 2020 09:27:13 GMT</pubDate>
    <dc:creator>neocronos</dc:creator>
    <dc:date>2020-10-29T09:27:13Z</dc:date>
    <item>
      <title>MC9S08QG8 and strange reset while debugging</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QG8-and-strange-reset-while-debugging/m-p/178065#M12617</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've been getting a strange reset. Here is when it happens:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;From the main I'm calling ejectarea():&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;void ejectarea(void){ byte categ;&amp;nbsp; byte tarea;&amp;nbsp;&amp;nbsp;&amp;nbsp; categ = concatenar(msgTipRcv[0], msgTipRcv[1]);&amp;nbsp; tarea = concatenar(msgRecRcv[0], msgRecRcv[1]);...&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;The program does the first concatenar() but the reset ocurrs in the second.&lt;BR /&gt;&lt;BR /&gt;concatenar() has:&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;byte concatenar(char char1, char char2){ byte num12;&amp;nbsp; char char12[2] = "";&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; char12[0] = char1;&amp;nbsp; strcat(&amp;amp;char12, &amp;amp;char2);&amp;nbsp; num12 = atoi(&amp;amp;char12);

...
&lt;/PRE&gt;&lt;/DIV&gt;&amp;nbsp;&lt;BR /&gt;&lt;/DIV&gt;The reset ocurrs inside strcat() (of string.c) at this part of the code:&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;LIBDEF_StringPtr strcat(LIBDEF_StringPtr str_d, LIBDEF_ConstStringPtr str_s) {&amp;nbsp; LIBDEF_StringPtr sd = str_d;&amp;nbsp; str_d += strlen(str_d);&amp;nbsp; while(*str_d++ = *str_s++) {}&amp;nbsp; return (sd);}&lt;/PRE&gt;&lt;/DIV&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fimg143.imageshack.us%2Fimg143%2F3632%2Fbeforejk1.png" rel="noopener noreferrer" target="_blank"&gt;&lt;BR /&gt;Screenshot&lt;/A&gt; before the reset.&lt;BR /&gt;&lt;BR /&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fimg186.imageshack.us%2Fimg186%2F900%2Fafterto0.png" rel="noopener noreferrer" target="_blank"&gt;Screenshot&lt;/A&gt; after the reset.&lt;BR /&gt;&lt;BR /&gt;It says: "Error: Unable to go into background mode."&lt;BR /&gt;&lt;BR /&gt;Not sure if it is due to the debugger or what but the hardware is not working well and the only way to check for errors is debuggin the code.&lt;BR /&gt;&lt;BR /&gt;Any ideas?&lt;BR /&gt;&lt;BR /&gt;Thanks a lot&lt;BR /&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:27:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QG8-and-strange-reset-while-debugging/m-p/178065#M12617</guid>
      <dc:creator>neocronos</dc:creator>
      <dc:date>2020-10-29T09:27:13Z</dc:date>
    </item>
    <item>
      <title>Re: MC9S08QG8 and strange reset while debugging</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QG8-and-strange-reset-while-debugging/m-p/178066#M12618</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;The usage of the ANSI function strcat is incorrect. The strcat function expects as second parameter a pointer to&lt;BR /&gt;a zero terminated string, and here a pointer to a single char is passed instead.&lt;BR /&gt;Actually just noted that the first argument is incorrect too &lt;IMG alt="Smiley Sad" class="emoticon emoticon-smileysad" id="smileysad" src="https://community.nxp.com/i/smilies/16x16_smiley-sad.png" title="Smiley Sad" /&gt;, the result is probably a 3 byte string (2 char's and a 0 byte), but the dest buffer is only 2 bytes.&lt;BR /&gt;So should probably be:&lt;BR /&gt;&lt;PRE&gt;&lt;/PRE&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;byte concatenar(char char1, char char2){  char char12[3];  char12[0] = char1;  char12[1] = char2;  char12[2] = 0;&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;/DIV&gt;Using atoi should work, although I would not actually use it due to its lack of&lt;BR /&gt;error reporting.&lt;BR /&gt;&lt;BR /&gt;Daniel&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:27:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QG8-and-strange-reset-while-debugging/m-p/178066#M12618</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2020-10-29T09:27:14Z</dc:date>
    </item>
    <item>
      <title>Re: MC9S08QG8 and strange reset while debugging</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QG8-and-strange-reset-while-debugging/m-p/178067#M12619</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;It would also appear from your before shot that neither char1 or char2 are numbers.&lt;BR /&gt;&lt;BR /&gt;Any time you end with a reset or otherwise in the weeds, think stack crash and look for bad pointer use.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Aug 2008 09:10:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QG8-and-strange-reset-while-debugging/m-p/178067#M12619</guid>
      <dc:creator>JimDon</dc:creator>
      <dc:date>2008-08-04T09:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: MC9S08QG8 and strange reset while debugging</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QG8-and-strange-reset-while-debugging/m-p/178068#M12620</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;Why did I use strcat() in first place? ... &lt;SPAN&gt;&lt;IMG alt=":smileytongue:" class="emoticon emoticon-smileytongue" id="smileytongue" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-tongue.gif" title="Smiley Tongue" /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Aug 2008 10:43:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QG8-and-strange-reset-while-debugging/m-p/178068#M12620</guid>
      <dc:creator>neocronos</dc:creator>
      <dc:date>2008-08-04T10:43:09Z</dc:date>
    </item>
  </channel>
</rss>

