<?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のトピックHow to create the dead loop by one assembly instruction ?</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-create-the-dead-loop-by-one-assembly-instruction/m-p/145579#M7206</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;I want to added a software trap in my application, I fill the unused ROM location with the SWI instruction.&amp;nbsp;And&amp;nbsp;I want to add the dead loop in the ISR of SWI, so that the watchdog can reset the CPU.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;My 'deadloop' code is as below:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;dead_loop:&lt;/DIV&gt;&lt;DIV&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;&amp;nbsp;&amp;nbsp; NOP;&lt;/DIV&gt;&lt;DIV&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;&amp;nbsp;&amp;nbsp; JMP dead_loop;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I remeber in the MCS-51 MCU, we could invoke&amp;nbsp;a single insrutcion&amp;nbsp;"SJMP &amp;amp;;" to create a deadloop, is there any similar instruction&amp;nbsp;for the HC08?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks,&lt;/DIV&gt;&lt;DIV&gt;Simon&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 13 Sep 2007 13:41:35 GMT</pubDate>
    <dc:creator>admin</dc:creator>
    <dc:date>2007-09-13T13:41:35Z</dc:date>
    <item>
      <title>How to create the dead loop by one assembly instruction ?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-create-the-dead-loop-by-one-assembly-instruction/m-p/145579#M7206</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;I want to added a software trap in my application, I fill the unused ROM location with the SWI instruction.&amp;nbsp;And&amp;nbsp;I want to add the dead loop in the ISR of SWI, so that the watchdog can reset the CPU.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;My 'deadloop' code is as below:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;dead_loop:&lt;/DIV&gt;&lt;DIV&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;&amp;nbsp;&amp;nbsp; NOP;&lt;/DIV&gt;&lt;DIV&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;&amp;nbsp;&amp;nbsp; JMP dead_loop;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I remeber in the MCS-51 MCU, we could invoke&amp;nbsp;a single insrutcion&amp;nbsp;"SJMP &amp;amp;;" to create a deadloop, is there any similar instruction&amp;nbsp;for the HC08?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks,&lt;/DIV&gt;&lt;DIV&gt;Simon&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Sep 2007 13:41:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-create-the-dead-loop-by-one-assembly-instruction/m-p/145579#M7206</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2007-09-13T13:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to create the dead loop by one assembly instruction ?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-create-the-dead-loop-by-one-assembly-instruction/m-p/145580#M7207</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi Simon&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;BRA *&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Sep 2007 13:53:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-create-the-dead-loop-by-one-assembly-instruction/m-p/145580#M7207</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2007-09-13T13:53:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to create the dead loop by one assembly instruction ?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-create-the-dead-loop-by-one-assembly-instruction/m-p/145581#M7208</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi Peg,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Sep 2007 15:07:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-create-the-dead-loop-by-one-assembly-instruction/m-p/145581#M7208</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2007-09-18T15:07:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to create the dead loop by one assembly instruction ?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-create-the-dead-loop-by-one-assembly-instruction/m-p/145582#M7209</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;peg,&lt;BR /&gt;&lt;BR /&gt;Respectfully, this still takes two bytes.&amp;nbsp; Could you use the SWI instruction to cause and endless loop at the interrupt location?&amp;nbsp; I do not have hardware up and running to test this right now.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;Peter House&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Sep 2007 20:11:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-create-the-dead-loop-by-one-assembly-instruction/m-p/145582#M7209</guid>
      <dc:creator>PeterHouse</dc:creator>
      <dc:date>2007-09-18T20:11:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to create the dead loop by one assembly instruction ?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-create-the-dead-loop-by-one-assembly-instruction/m-p/145583#M7210</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;SWI would be the cure - this is recommended technique:&amp;nbsp;filling all unused memory with SWI instruction (use FILL 0x83 directive in .prm file for all Flash areas)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards, Pavel&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Sep 2007 16:13:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-create-the-dead-loop-by-one-assembly-instruction/m-p/145583#M7210</guid>
      <dc:creator>ok2ucx</dc:creator>
      <dc:date>2007-09-24T16:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to create the dead loop by one assembly instruction ?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-create-the-dead-loop-by-one-assembly-instruction/m-p/145584#M7211</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi all,&lt;/DIV&gt;&lt;DIV&gt;We seem to be getting off track here.&lt;/DIV&gt;&lt;DIV&gt;The OP already said he is filling unused memory with SWI.&lt;/DIV&gt;&lt;DIV&gt;What he wanted was a one instruction (should have said one byte) loop to put in the ISR for the SWI.&lt;/DIV&gt;&lt;DIV&gt;My answer is,&amp;nbsp;I believe, as tight as it gets.&lt;/DIV&gt;&lt;DIV&gt;Someone with a few minutes to spare may want to work out what would happen if you were in fact to land on the operand of this instruction.&lt;/DIV&gt;&lt;DIV&gt;Maybe it still works???&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Sep 2007 16:26:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-create-the-dead-loop-by-one-assembly-instruction/m-p/145584#M7211</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2007-09-24T16:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to create the dead loop by one assembly instruction ?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-create-the-dead-loop-by-one-assembly-instruction/m-p/145585#M7212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;STRONG&gt;Hello all&lt;/STRONG&gt;,&lt;BR /&gt;&lt;BR /&gt;I don't even think that a one instruction loop in the SWI ISR (Interrupt Sub Routine) is what Simon Zhu was looking for.&lt;BR /&gt;&lt;BR /&gt;Going to the ISR is using time.&lt;BR /&gt;&lt;BR /&gt;I believe Simon Zhu would like the equivalent of Peg's BRA * to be put anywhere in the code and in one byte, outside any interrupt.&lt;BR /&gt;&lt;BR /&gt;Looking at the HC08 Instruction Table, there is one column dedicated to "Branches" and there is no "one-byte instruction.&lt;BR /&gt;&lt;BR /&gt;Therefore, my answer would be. There is no branch instruction you can use in one-byte.&lt;BR /&gt;Using the SWI is one way to work around by inserting a one-byte instruction to jump somewhere else where you would have the space to do a longer code.&lt;BR /&gt;&lt;BR /&gt;Simon, may you please precise ?&lt;BR /&gt;Do you want to hack into existing ASM code to add this infinite loop ? It looks like it to me.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;David&lt;/STRONG&gt;,&lt;BR /&gt;I don't understand the last part of your contribution on the few minutes to spare. Can you please explain to me what you mean ?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Alfred.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Sep 2007 16:59:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-create-the-dead-loop-by-one-assembly-instruction/m-p/145585#M7212</guid>
      <dc:creator>Nabla69</dc:creator>
      <dc:date>2007-09-24T16:59:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to create the dead loop by one assembly instruction ?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-create-the-dead-loop-by-one-assembly-instruction/m-p/145586#M7213</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Hi Al,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Run out of names?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;My understanding of filling the memory with SWI is to do something predictable when (if?) the code goes bananas jumping off into unused (random) memory. Filling with a one byte jump like SWI means it gets caught immediately and does something you control rather than something random like push the red button. What I was thinking was what happened if it landed on the operand of this BRA (and tried to decode it as an instruction) but actually now I realise (with a little more thought and prodding) that that would be the same as landing on any other valid code anyway. So now the question is raised "Why do you need a one byte loop in the ISR?" or "What's wrong with SWI to achieve this? Why are you looking beyond this solution?"&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Actually on a re-read of the original post:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;"&lt;EM&gt;And&amp;nbsp;I want to add the dead loop in the ISR of SWI&lt;/EM&gt;"&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;seems pretty clear to me!&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by peg on &lt;SPAN class="date_text"&gt;2007-09-24&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;08:26 PM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Sep 2007 17:20:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-create-the-dead-loop-by-one-assembly-instruction/m-p/145586#M7213</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2007-09-24T17:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to create the dead loop by one assembly instruction ?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-create-the-dead-loop-by-one-assembly-instruction/m-p/145587#M7214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Hi Peg,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;We kind of got out of the question then.&lt;/DIV&gt;&lt;DIV&gt;I imagine we have all the space we wish for this loop in SWI then.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Simon, it is important to note that an SWI in the MON08 mode (debug) is generating a break in the software and will stop the execution.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I know it is a bit out of subject now... Still, I prefer using an Illegal Opcode (ILOP) to fill the empty space.&lt;/DIV&gt;&lt;DIV&gt;I consider the code runaway as a very important problem and generate a reset as I am not confident the rest of the flow is valid anymore.&lt;/DIV&gt;&lt;DIV&gt;The ILOP comes from&amp;nbsp;a single byte instruction and is handled after reset.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Alberto &lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" id="smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Sep 2007 17:50:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-create-the-dead-loop-by-one-assembly-instruction/m-p/145587#M7214</guid>
      <dc:creator>Nabla69</dc:creator>
      <dc:date>2007-09-24T17:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to create the dead loop by one assembly instruction ?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-create-the-dead-loop-by-one-assembly-instruction/m-p/145588#M7215</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If someone had of thought of this a long time ago, they would have made sure 00 and FF where invalid opcodes ( and generate an ILOP) and all these conversations on this subject never would have had to happen. Long live backwards compatability!&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Sep 2007 18:28:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-create-the-dead-loop-by-one-assembly-instruction/m-p/145588#M7215</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2007-09-24T18:28:10Z</dc:date>
    </item>
  </channel>
</rss>

