<?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: ColdFire MCF 5208 trap exceptions in ColdFire/68K Microcontrollers and Processors</title>
    <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Coldfire-MCF-5208-trap-exceptions/m-p/128013#M578</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;You should reference the ColdFire Family Programmers Reference Manual (http://www.freescale.com/files/dsp/doc/ref_manual/CFPRM.pdf) for more details on the instruction set including the TRAP instruction.&lt;BR /&gt;&lt;BR /&gt;The register contents will be retained after the TRAP exception is taken. Therefore, any values loaded into the data or address registers will be available to the TRAP interrupt handler. It looks like this code is calling the system call routines in the dBUG ROM monitor that is programmed as the bootable image in most ColdFire evaluation boards. The dBUG system calls are as follows:&lt;BR /&gt;&lt;BR /&gt;_dbug_sc_handler:&lt;BR /&gt;lea -12(sp),sp /* room for used regs */&lt;BR /&gt;movem.l d2/a0-a1,(sp)&lt;BR /&gt;ext.l d0&lt;BR /&gt;&lt;BR /&gt;/* Serial I/O routines */&lt;BR /&gt;cmpi.l #0x0010,d0&lt;BR /&gt;beq.w _in_char&lt;BR /&gt;cmpi.l #0x0013,d0&lt;BR /&gt;beq.w _out_char&lt;BR /&gt;cmpi.l #0x0014,d0&lt;BR /&gt;beq.w _char_present&lt;BR /&gt;&lt;BR /&gt;/* Not a supported system call, jump back to monitor */&lt;BR /&gt;movem.l (sp),d2/a0-a1&lt;BR /&gt;lea 12(sp),sp&lt;BR /&gt;move.l sp,-(sp)&lt;BR /&gt;jsr _asm_sc_exit_to_dbug&lt;BR /&gt;&lt;BR /&gt;_in_char:&lt;BR /&gt;jsr _board_getchar /* char returned in D0 */&lt;BR /&gt;move.l d0,d1&lt;BR /&gt;moveq.l #0,d0&lt;BR /&gt;bra.w _done&lt;BR /&gt;&lt;BR /&gt;_out_char:&lt;BR /&gt;move.l d1,-(sp)&lt;BR /&gt;jsr _board_putchar&lt;BR /&gt;lea 4(sp),sp&lt;BR /&gt;moveq.l #0,d0&lt;BR /&gt;bra.w _done&lt;BR /&gt;&lt;BR /&gt;_char_present:&lt;BR /&gt;jsr _board_getchar_present /* value returned in D0 */&lt;BR /&gt;bra.w _done&lt;BR /&gt;&lt;BR /&gt;_done:&lt;BR /&gt;movem.l (sp),d2/a0-a1&lt;BR /&gt;lea 12(sp),sp&lt;BR /&gt;rte&lt;P&gt;Message Edited by mnorman on &lt;SPAN class="date_text"&gt;03-08-2006&lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;10:55 AM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 Mar 2006 00:49:23 GMT</pubDate>
    <dc:creator>mnorman</dc:creator>
    <dc:date>2006-03-09T00:49:23Z</dc:date>
    <item>
      <title>Coldfire MCF 5208 trap exceptions</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Coldfire-MCF-5208-trap-exceptions/m-p/128012#M577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am an engineering student doing a project on interrupt handlers and have a question on trap instructions for the Coldfire MCF5208 microcontroller. How do they pass parameters to address and data registers? I have code that I am able to understand except for the trap instructions. It looks like the data registers are being used in coordination with the traps somehow. My resources are very limited. The only classbooks that we have are the technical manuals and they mention nothing of trap functionality. I have included a copy of the code if anyone can add any insight. It is an interrupt handler for counting from 0 to 9 with screen display of the digit. Thanks for any help that anyone can offer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;----&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;jmp main&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pit_handle:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;link %A6,#0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;move.l %D0,-(%A7)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;move.l %D1,-(%A7)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;move.l %A0,-(%A7)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;movea.l #0x40040000,%A0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;move.l (%A0),%D1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;move.l #0x13,%d0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;trap #15&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;move.l #0x13,%d0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;move.l #13,%D1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;trap #15&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;add.l #1,(%A0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;move.l (%A0),%D0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;cmpi.l #0x3A,%D0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;blt exit&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;move.l #0x30,(%A0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;exit: move.l -4(%A6),%D0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;move.l -8(%A6),%D1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;move.l -12(%A6),%A0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;unlk %a6&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rts&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;main:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;movea.l #0x80003FF0,%A7&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;movea.l %A7,%A6&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;movea.l #0x40040000,%A0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;move.l #0x30,(%A0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;movea.l #0xFC080000,%A0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;move.l #0x0D1F,%D0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;move.W %D0,(%A0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;movea.l #0xFC080002,%A0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;move.l #0xFFFF,%D0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;move.l %D0,(%A0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;move.l #0x40,%D0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;move.l #0x44,%D1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lea pit_handle,%A0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;move.l %A0,%D2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;move.l #0,%D3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;move.l #0,%D4&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;trap #15&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;move.l #0xFC048044,%A0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;move.l #3,%D0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;move.b %D0,(%A0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;move.l #0xFC04800C,%A0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;move.l (%A0),%D0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;andi.l #0xFFFFFFEF,%D0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;move.l %D0,(%A0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;loop:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;nop&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;jmp loop&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 05 Mar 2006 09:27:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Coldfire-MCF-5208-trap-exceptions/m-p/128012#M577</guid>
      <dc:creator>quahogChowda</dc:creator>
      <dc:date>2006-03-05T09:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: ColdFire MCF 5208 trap exceptions</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Coldfire-MCF-5208-trap-exceptions/m-p/128013#M578</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;You should reference the ColdFire Family Programmers Reference Manual (http://www.freescale.com/files/dsp/doc/ref_manual/CFPRM.pdf) for more details on the instruction set including the TRAP instruction.&lt;BR /&gt;&lt;BR /&gt;The register contents will be retained after the TRAP exception is taken. Therefore, any values loaded into the data or address registers will be available to the TRAP interrupt handler. It looks like this code is calling the system call routines in the dBUG ROM monitor that is programmed as the bootable image in most ColdFire evaluation boards. The dBUG system calls are as follows:&lt;BR /&gt;&lt;BR /&gt;_dbug_sc_handler:&lt;BR /&gt;lea -12(sp),sp /* room for used regs */&lt;BR /&gt;movem.l d2/a0-a1,(sp)&lt;BR /&gt;ext.l d0&lt;BR /&gt;&lt;BR /&gt;/* Serial I/O routines */&lt;BR /&gt;cmpi.l #0x0010,d0&lt;BR /&gt;beq.w _in_char&lt;BR /&gt;cmpi.l #0x0013,d0&lt;BR /&gt;beq.w _out_char&lt;BR /&gt;cmpi.l #0x0014,d0&lt;BR /&gt;beq.w _char_present&lt;BR /&gt;&lt;BR /&gt;/* Not a supported system call, jump back to monitor */&lt;BR /&gt;movem.l (sp),d2/a0-a1&lt;BR /&gt;lea 12(sp),sp&lt;BR /&gt;move.l sp,-(sp)&lt;BR /&gt;jsr _asm_sc_exit_to_dbug&lt;BR /&gt;&lt;BR /&gt;_in_char:&lt;BR /&gt;jsr _board_getchar /* char returned in D0 */&lt;BR /&gt;move.l d0,d1&lt;BR /&gt;moveq.l #0,d0&lt;BR /&gt;bra.w _done&lt;BR /&gt;&lt;BR /&gt;_out_char:&lt;BR /&gt;move.l d1,-(sp)&lt;BR /&gt;jsr _board_putchar&lt;BR /&gt;lea 4(sp),sp&lt;BR /&gt;moveq.l #0,d0&lt;BR /&gt;bra.w _done&lt;BR /&gt;&lt;BR /&gt;_char_present:&lt;BR /&gt;jsr _board_getchar_present /* value returned in D0 */&lt;BR /&gt;bra.w _done&lt;BR /&gt;&lt;BR /&gt;_done:&lt;BR /&gt;movem.l (sp),d2/a0-a1&lt;BR /&gt;lea 12(sp),sp&lt;BR /&gt;rte&lt;P&gt;Message Edited by mnorman on &lt;SPAN class="date_text"&gt;03-08-2006&lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;10:55 AM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Mar 2006 00:49:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Coldfire-MCF-5208-trap-exceptions/m-p/128013#M578</guid>
      <dc:creator>mnorman</dc:creator>
      <dc:date>2006-03-09T00:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: Coldfire MCF 5208 trap exceptions</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Coldfire-MCF-5208-trap-exceptions/m-p/128014#M579</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;Try looking at the ColdFire Programmers Reference (CFPRM.pdf) manual Rev.3 page 3-11 where the interaction of the Trap instructions with registers is described. The CFPRM can be downloaded at - &lt;A href="http://www.freescale.com/webapp/sps/site/overview.jsp?nodeId=0162468rH3YTLC00M9" rel="nofollow" target="_blank"&gt;http://www.freescale.com/webapp/sps/site/overview.jsp?nodeId=0162468rH3YTLC00M9&lt;/A&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Under the Reference Manuals section on this page. I hope this helps.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Mar 2006 01:08:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Coldfire-MCF-5208-trap-exceptions/m-p/128014#M579</guid>
      <dc:creator>PBH</dc:creator>
      <dc:date>2006-03-09T01:08:14Z</dc:date>
    </item>
  </channel>
</rss>

