<?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>ColdFire/68K Microcontrollers and ProcessorsのトピックRe: AN3470SW CW 6.3 memmove / tk_switch problem</title>
    <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156353#M4566</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;After debugging the system further I found that the guardword overflow is because the default interrupt handler gets called continuously and it uses printf to display something on the console. The problem is the interrupt gets called so often that the UART never has a chance to flush its buffer and send the data. This is when the overflow happens.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The interrupt only starts to be called when the memmove has been called a resonable number of times. What could be happening in the memmove that could be setting off the interrupt?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If I remove the printf statement from the interrupt handler the crash never happens however the program slows to a crawl because it is spending all of it's time in the interrupt handler.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;My main question is, what is happening in the memmove that causes the interrupt to be called, what is the interrupt and why is it being called so often?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Is there any code I could put into the interrupt handler to determine what is causing it?&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, 18 Oct 2007 18:03:56 GMT</pubDate>
    <dc:creator>DarrenSteadman</dc:creator>
    <dc:date>2007-10-18T18:03:56Z</dc:date>
    <item>
      <title>AN3470SW CW 6.3 memmove / tk_switch problem</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156350#M4563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;DIV&gt;This is a bit of a strange one and it has taken me a while to debug things this far. (I'm totally new to Coldfire)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I've been using the demos from the AN3470SW app note to create an application that will talk to some of our existing equipment via serial and pass it along to a PC via ethernet, so a basic serial to ethernet converter. To get this working properly&amp;nbsp;I had to modify the example slightly as well as the size of some of the TCP buffers to get optimal through put for our application.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I then added the HTTP server example to the code so I could work on a way of configuring the device.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This is when things went wrong. If I try to stream serial data through the device the RTOS crashes due to a stack gaurd word on the "Main" task being overridden.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I set a write watchpoint on the guardword and it stops in _tk_switch&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;_tk_switch:&lt;BR /&gt;&amp;nbsp;&amp;nbsp; move.w&amp;nbsp; #0x2700,SR&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* disable ints */&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; move.l&amp;nbsp;&amp;nbsp; 4(A7),D0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* save passed tk pointer in D0 */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; move.l&amp;nbsp;&amp;nbsp; D2,-(A7)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* push the non-volitile gp registers */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; move.l&amp;nbsp;&amp;nbsp; D3,-(A7)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; move.l&amp;nbsp;&amp;nbsp; D4,-(A7)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; move.l&amp;nbsp;&amp;nbsp; D5,-(A7)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; move.l&amp;nbsp;&amp;nbsp; D6,-(A7)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; move.l&amp;nbsp;&amp;nbsp; D7,-(A7)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; move.l&amp;nbsp;&amp;nbsp; A1,-(A7)&amp;nbsp; //Stops here&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The call stack shows that irq_handler is being called continuously and it is trying to print something to the console. I never actually see this output so I assume that the UART is not being processed because so much time is being spent in the IRQ.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I removed the printf statement to see what would happen and tried again. This time the application didn't crash, however our PC app stopped receiving data completely. If I stopped execution of the coldfire it was nearly always in the interrupt handler.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I then decided to put a break point in the interrupt handler to see when it was being called. If I run the application but don't make a TCP connection to it then the interrupt handler never gets called, however as soon as I make a connection the interrupt handler starts being called.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The interrupt handler always gets called for the first time when the main program is in a memmove operation which is called from "arprcv"&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;struct arp_hdr *&amp;nbsp; arphdr;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; struct arptabent *&amp;nbsp;&amp;nbsp; tp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;arphdr = (struct arp_hdr *)(pkt-&amp;gt;nb_buff + ETHHDR_SIZE);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; struct arp_wire * arwp&amp;nbsp; =&amp;nbsp; (struct&amp;nbsp; arp_wire *)arphdr;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MEMMOVE(&amp;amp;arphdr-&amp;gt;ar_tpa, &amp;amp;arwp-&amp;gt;data[AR_TPA], 4);&amp;nbsp;&amp;nbsp; //Could potentially be this line&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MEMMOVE(arphdr-&amp;gt;ar_tha, &amp;amp;arwp-&amp;gt;data[AR_THA], 6);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Debugger shows it has stopped here&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MEMMOVE(&amp;amp;arphdr-&amp;gt;ar_spa, &amp;amp;arwp-&amp;gt;data[AR_SPA], 4);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MEMMOVE(arphdr-&amp;gt;ar_sha, &amp;amp;arwp-&amp;gt;data[AR_SHA], 6);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; }&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The memory addresses of the variables being used in memmove always seem to be the same as well.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The interesting thing is the "Value" (in debugger)&amp;nbsp;of the dest and src pointer are the same.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Is something going wrong in "arprcv" that is causing a problem with the memmove that could then trigger an interrupt?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Is there any code I could put in the interrupt to try and find out the source of it?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Has anyone else had the same kind of problem?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks for your time&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Darren&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2007 17:37:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156350#M4563</guid>
      <dc:creator>DarrenSteadman</dc:creator>
      <dc:date>2007-10-17T17:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: AN3470SW CW 6.3 memmove / tk_switch problem</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156351#M4564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I've looked at the code more closely and the section below that was causing the problem is doing something funny.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;arphdr = (struct arp_hdr *)(pkt-&amp;gt;nb_buff + ETHHDR_SIZE);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; struct arp_wire * arwp&amp;nbsp; =&amp;nbsp; (struct&amp;nbsp; arp_wire *)arphdr;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MEMMOVE(&amp;amp;arphdr-&amp;gt;ar_tpa, &amp;amp;arwp-&amp;gt;data[AR_TPA], 4);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MEMMOVE(arphdr-&amp;gt;ar_tha, &amp;amp;arwp-&amp;gt;data[AR_THA], 6);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MEMMOVE(&amp;amp;arphdr-&amp;gt;ar_spa, &amp;amp;arwp-&amp;gt;data[AR_SPA], 4);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MEMMOVE(arphdr-&amp;gt;ar_sha, &amp;amp;arwp-&amp;gt;data[AR_SHA], 6);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; }&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;From what I can see it is essentially copying data over the top of itself. If I watch the values&amp;nbsp;inside arphdr in the debugger they never actually get changed by the memmove. If I comment out that entire block then everything seems to run perfectly fine.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Could someone tell me why this is there in the first place. I assume it must be doing something. I don't want to remove it permently if it is actually required for some reason.&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by Darren Steadman on &lt;SPAN class="date_text"&gt;2007-10-17&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;04:17 PM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2007 22:17:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156351#M4564</guid>
      <dc:creator>DarrenSteadman</dc:creator>
      <dc:date>2007-10-17T22:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: AN3470SW CW 6.3 memmove / tk_switch problem</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156352#M4565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I suspect that the only reason for this code being there is to make sure that the data received from the FEC is in the correct places in the arp_hdr struct. As this code is supposed to work on several platforms and with several compilers, you can't just assume that the data off the wire will map directly to the struct.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;As to why you get a problem with the task stack guardword, each task&amp;nbsp;has a separate stack. The stack is small and so you have to be careful not to cause a stack overflow. This can happen with code that is too recursive, or if you have code that uses many or large automatic variables. Automatic variables are the local variables that you define in a function. They are created on the stack.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Do you have any large arrays that are created as automatic variables, rather than allocating them on the heap? Or do you have any recursive code or loops that are likely to be creating large numbers of automatic variables?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The fact that your code fails in the&amp;nbsp;NicheLite code&amp;nbsp;is likely to be a side effect of this - there are some problems in the NicheLite code, but the ARP code is exercised a huge amount so it's unlikely to have any serious problems. If you want to see a bug look at memcmp in stdlib .c.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Cheers,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Paul.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Edit: spelling&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by mccp on &lt;SPAN class="date_text"&gt;2007-10-18&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;11:47 AM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Oct 2007 17:46:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156352#M4565</guid>
      <dc:creator>mccPaul</dc:creator>
      <dc:date>2007-10-18T17:46:04Z</dc:date>
    </item>
    <item>
      <title>Re: AN3470SW CW 6.3 memmove / tk_switch problem</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156353#M4566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;After debugging the system further I found that the guardword overflow is because the default interrupt handler gets called continuously and it uses printf to display something on the console. The problem is the interrupt gets called so often that the UART never has a chance to flush its buffer and send the data. This is when the overflow happens.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The interrupt only starts to be called when the memmove has been called a resonable number of times. What could be happening in the memmove that could be setting off the interrupt?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If I remove the printf statement from the interrupt handler the crash never happens however the program slows to a crawl because it is spending all of it's time in the interrupt handler.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;My main question is, what is happening in the memmove that causes the interrupt to be called, what is the interrupt and why is it being called so often?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Is there any code I could put into the interrupt handler to determine what is causing it?&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, 18 Oct 2007 18:03:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156353#M4566</guid>
      <dc:creator>DarrenSteadman</dc:creator>
      <dc:date>2007-10-18T18:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: AN3470SW CW 6.3 memmove / tk_switch problem</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156354#M4567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;If the problem occurs only after the memmove, then it&amp;nbsp;is possible that the memmove is causing an error exception. Because the exception handler doesn't remove the cause of the exception then it will continuously re-occur.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;What do you mean by "default interrupt handler"?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If you break in an interrupt handler, you can look at the exception frame on the stack to find out what caused the exception. The first 32 bits word on the stack will be the exception format, fault status, vector and status register, and the second 32 bit word is the return address. See the Coldfire Programmers Reference manual chapter 11.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Paul.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Oct 2007 23:27:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156354#M4567</guid>
      <dc:creator>mccPaul</dc:creator>
      <dc:date>2007-10-18T23:27:01Z</dc:date>
    </item>
    <item>
      <title>Re: AN3470SW CW 6.3 memmove / tk_switch problem</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156355#M4568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;By default interupt handler&amp;nbsp;I mean the following function that is in int_handlers.c&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;__interrupt__&lt;BR /&gt;void irq_handler (void)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;/*&lt;BR /&gt;&amp;nbsp; * This is the catch all interrupt handler for all user defined&lt;BR /&gt;&amp;nbsp; * interrupts.&amp;nbsp; To create specific handlers, create a new interrupt&lt;BR /&gt;&amp;nbsp; * handler and change vectors.s to point to the new handler.&lt;BR /&gt;&amp;nbsp; */&lt;BR /&gt;&amp;nbsp;printf("irq_handler\n");&lt;BR /&gt;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If you look at the interrupt vector table this function is used for all the interrupt vectors that don't have a handler. Unfortunatly there is over 30 of these vectors that use this function, therefore I'm looking for a way of finding out which vector caused the interrupt.&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>Fri, 19 Oct 2007 15:29:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156355#M4568</guid>
      <dc:creator>DarrenSteadman</dc:creator>
      <dc:date>2007-10-19T15:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: AN3470SW CW 6.3 memmove / tk_switch problem</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156356#M4569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;To find out what vector caused the interrupt, put a breakpoint in the ISR and examine the exception stack frame.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Cheers,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Paul.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Oct 2007 15:51:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156356#M4569</guid>
      <dc:creator>mccPaul</dc:creator>
      <dc:date>2007-10-19T15:51:48Z</dc:date>
    </item>
    <item>
      <title>Re: AN3470SW CW 6.3 memmove / tk_switch problem</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156357#M4570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;I've been looking into the problem further now and I changed some buffer sizes by a few bytes. This has had the effect of making the problem occur in a completely different place however it is the same general problem.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;At some point an interrupt is being activated that uses irq_handler and it gets called continuously.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Any ideas what it could be?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Oct 2007 15:53:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156357#M4570</guid>
      <dc:creator>DarrenSteadman</dc:creator>
      <dc:date>2007-10-19T15:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: AN3470SW CW 6.3 memmove / tk_switch problem</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156358#M4571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;I'll have a look at the exception stuff you recomended.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks for all the help.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Oct 2007 15:55:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156358#M4571</guid>
      <dc:creator>DarrenSteadman</dc:creator>
      <dc:date>2007-10-19T15:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: AN3470SW CW 6.3 memmove / tk_switch problem</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156359#M4572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Sorry if I'm getting annoying here. Is there any chance you could tell me how to see the exception frame in code warrior?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I have the standard stack window up. When my break point hits I get a stack output but it looks like it's showing the stack calls in the main application and then just the irq_handler function. It doesn't give me any information about what called irq_handler. I assume that's what the exeception stuff you said about will show.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I can't find any info in the help docs for code warrior on how to get that information. This is only the second embedded system I've had to work on and the first was ARM based and we had to write everything from scratch.&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>Fri, 19 Oct 2007 16:16:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156359#M4572</guid>
      <dc:creator>DarrenSteadman</dc:creator>
      <dc:date>2007-10-19T16:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: AN3470SW CW 6.3 memmove / tk_switch problem</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156360#M4573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Ok found the exception stack frame definition in the documentation. Found the&amp;nbsp;PC and SR registers in code warrior however the 16 bits that contain the vector that was called does not seem to be listed anywhere.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Which section of the registers view should it be under?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Oct 2007 16:48:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156360#M4573</guid>
      <dc:creator>DarrenSteadman</dc:creator>
      <dc:date>2007-10-19T16:48:51Z</dc:date>
    </item>
    <item>
      <title>Re: AN3470SW CW 6.3 memmove / tk_switch problem</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156361#M4574</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;Do you mean SP? SR is the status register, you want the stack pointer. I don't use CodeWarrior, I use GCC so I can't help with CW specifics. Examine the memory that SP is pointing to, to see the stack.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;When you look at the stack, bear in mind that the compiler will have added its own frame. That means that although you break on the first C instruction in the ISR, the compiler may have added instructions that have added stuff to the stack since the exception module created the exception stack frame.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;In my GCC, the compiler reserves 20 bytes of the stack to push some registers on - you may need to look at a disassembly view to find out exactly what CW is doing.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Paul.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Oct 2007 16:56:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156361#M4574</guid>
      <dc:creator>mccPaul</dc:creator>
      <dc:date>2007-10-19T16:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: AN3470SW CW 6.3 memmove / tk_switch problem</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156362#M4575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&amp;nbsp;This seems to be a RAM memory problem. As Paul said some posts ago and since the problem happens right after a TCP connection had been attempted. I think nichelite port uses a standard stack size of 2048 bytes/task. So, the more tasks you have, less RAM you´ll have for heap memory, and this heap memory is the RAM used for TCP lilbuffs and bigbuffs.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;So, when you say the problem happens when you try to connect to the board, probably you don´t have enough heap memory for a bigbuff allocation and that´s when some task stack&amp;nbsp;RAM space&amp;nbsp; is violated and the exception is generated. I think this shouldn´t happen, but maybe the port has some bugs on that part.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;Anyway, nobody is perfect, Eric did an excelent job on this and i´m using this same port as you. I had similar problems wich i solved carefully looking on tasks stack and researving enough heap memory for my applications.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;Take a look on it&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;Hope it helps&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;Regards&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Oct 2007 20:32:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156362#M4575</guid>
      <dc:creator>Kremer</dc:creator>
      <dc:date>2007-10-19T20:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: AN3470SW CW 6.3 memmove / tk_switch problem</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156363#M4576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;I'm beginning to think my problems are elseware. I'm going to go back to the drawing board and see if I can work out what's going wrong. Thanks for all the help guys, it's good to know there are some people out there with the knowledge if everything goes wrong.&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>Fri, 19 Oct 2007 20:50:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156363#M4576</guid>
      <dc:creator>DarrenSteadman</dc:creator>
      <dc:date>2007-10-19T20:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: AN3470SW CW 6.3 memmove / tk_switch problem</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156364#M4577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I have just found this thread and am very interested in the final resolution as my application and problems are very similar.&lt;BR /&gt;&lt;BR /&gt;As part of my debugging I have also come across the irq_handler being called unexpectedly and never got to&amp;nbsp; the bottom of it. As mentioned here, the actual printf output never appears on the console.&lt;BR /&gt;&lt;BR /&gt;My current problem is that the "Main" task just stops being awoken from the fec receive handler - even though the external client is still sending.&lt;BR /&gt;&lt;BR /&gt;I have also seen conditions where the console is still running and the 'socket' command indicates many sockets that are permanently in CLOSE_WAIT.&lt;BR /&gt;&lt;BR /&gt;I am currently working on the assumption that I have a memory allocation problem and am trying to fine tune the BIGBUFSIZ and NUMBIGBUF settings. This is time consuming since it can take an hour before everything stops.&lt;BR /&gt;&lt;BR /&gt;I will look at my use of local variables to see if there is anything to be gained there.&lt;BR /&gt;&lt;BR /&gt;Any further suggestions would be most welcome.&lt;BR /&gt;&lt;BR /&gt;Many thanks for the help so far,&lt;BR /&gt;Trevor&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>Tue, 23 Oct 2007 16:38:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156364#M4577</guid>
      <dc:creator>TrevorCurry_eu</dc:creator>
      <dc:date>2007-10-23T16:38:50Z</dc:date>
    </item>
    <item>
      <title>Re: AN3470SW CW 6.3 memmove / tk_switch problem</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156365#M4578</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Some further input on my problem:&lt;BR /&gt;&lt;BR /&gt;Having reduced the amount of local (stack) variables I use and changed the buffer sizes, the whole nature of my application has changed.&lt;BR /&gt;&lt;BR /&gt;I no longer see the lock up and the irq_handler calls also seem to have gone away. This all leads me to think the basic problem is a memory overflow not being trapped. Checking mh_totfree and mh_minfree now indicates plenty of free memory.&lt;BR /&gt;&lt;BR /&gt;My persisting CLOSE_WAIT states were due to me not handling an ESHUTDOWN error returned from m_recv() - whoops!&lt;BR /&gt;&lt;BR /&gt;Trevor&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2007 17:57:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156365#M4578</guid>
      <dc:creator>TrevorCurry_eu</dc:creator>
      <dc:date>2007-10-24T17:57:21Z</dc:date>
    </item>
    <item>
      <title>AN3470SW CW 6.3 memory problem causing irq_handler to be called</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156366#M4579</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi guys,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I'm still having strange problems with the irq_handler. Basically it looks like all my problems before were based around RAM in one way or another.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;My problem now is I've been adding a fair bit of code to my project and once again the irq_handler problem has come up.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I was wondering if there is any way of reliably tracking down what is calling the IRQ. From what I can see in the IRQ controller registers all vetors that are using irq_handler are masked off so the IRQ controllers can not call the irq_handler function which would indicate that something else is calling it. Does anyone have any ideas as to how I would go about finding out what is making the jump into the handler?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I've checked my heap when the handler starts getting called and I have about 3k of free RAM the lowest the allocation goes is 3k and there are no reports of any failed allocations.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Could this be a buffer overflow or something along those lines? If so is there a way to get the default exception handlers to tell me there was an invalid address write or something like that?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;At the moment it's a bit like trying to find a needle in a hay stack. Unfortunatly I've got no idea where to start to try and track down whats going wrong&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Nov 2007 17:57:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156366#M4579</guid>
      <dc:creator>DarrenSteadman</dc:creator>
      <dc:date>2007-11-21T17:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: AN3470SW CW 6.3 memory problem causing irq_handler to be called</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156367#M4580</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;Hi&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If something (not the interrupt controller) is calling your ISR, then a simple breakpoint in the ISR will allow you to trace the call stack and to see where the call originated. However, it seems very unlikely that this is the case because the ISR will terminate with an RTE not an RTS so if there was some spurious way for your code to execute the ISR it would almost certainly fail as soon as the RTE was executed.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If the interrupt controller is responsible for the call to the ISR (most likely) then all you need to do is to set a breakpoint at the start of the ISR and&amp;nbsp;look at the exception frame on the stack. This will tell you which exception was rasied to cause the ISR to be executed.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Do you have a file called mcf5xxx.c with a function &lt;FONT size="2"&gt;mcf5xxx_exception_handler() in it?&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;This is called by an assembly stub &lt;B&gt;&lt;FONT color="#7F0055" size="2"&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/FONT&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;B&gt;&lt;FONT color="#7F0055" size="2"&gt;asm_exception_handler&lt;/FONT&gt;&lt;/B&gt;&lt;/FONT&gt;&lt;/P&gt;to decode exceptions that are caused by an error.&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;If you have your error exception vectors pointing to irq_handler then any illegal address access, etc. will call irq_handler. If you are right and all of your user definable exceptions are masked, then this may be what is happening.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Check your vector table is correct and unmodified at run time. Also, if you can find the exception frame on the stack when you have reached a break point in irq_handler then this will _definately_ tell you which exception happened.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Edit:&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;If you do have the code for mcf5xxx_exception_handler()&amp;nbsp; and asm_exception_handler, you could point _all_ the vectors to asm_exception_handler, and break in mcf5xxx_exception_handler to have a look at the exception frame. The assembly stub just points %a1 to the exception frame so that it can be used as a C argument.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Paul.&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by mccp on &lt;SPAN class="date_text"&gt;2007-11-21&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;10:33 AM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Nov 2007 18:29:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156367#M4580</guid>
      <dc:creator>mccPaul</dc:creator>
      <dc:date>2007-11-21T18:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: AN3470SW CW 6.3 memory problem causing irq_handler to be called</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156368#M4581</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;DIV&gt;Yes I have&amp;nbsp;mcf5xxx.c with&amp;nbsp;&lt;FONT size="2"&gt;mcf5xxx_exception_handler() in it.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;asm_exception_handler is pointing to the correct place.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;If I put a break point into the irq_handler the call stack doesn't make any sense, it will be inside a function that is just a normal function. If I then continue execution the next time the irq_handler gets called the call stack will be different, then if I do it again the call stack will once again be different. Some times if I stop the board executing and restart the program from scratch the call stack will be completely different to the first time I ran it.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Which register is the exception vector in? A1-7? PC? SR?&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Do you have a link to a document that could tell me what the value of the register means?&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Nov 2007 18:36:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156368#M4581</guid>
      <dc:creator>DarrenSteadman</dc:creator>
      <dc:date>2007-11-21T18:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: AN3470SW CW 6.3 memory problem causing irq_handler to be called</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156369#M4582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Ok here is an interesting one for you.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I changed all calls to irq_handler to asm_exception_handler by doing the following in mcf5223_vectors.s&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;//#define _irq_handler&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; irq_handler&lt;BR /&gt;#define _irq_handler asm_exception_handler&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This made the program jump into the mcf5xxx_exception_handler once stating there was an illegal instruction somewhere in the uart isr.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The interesting thing is that I then made the debugger continue execution and the irq_handler is still being called. Can you think of any reason as to why the handler is still being called?&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Nov 2007 18:47:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/AN3470SW-CW-6-3-memmove-tk-switch-problem/m-p/156369#M4582</guid>
      <dc:creator>DarrenSteadman</dc:creator>
      <dc:date>2007-11-21T18:47:09Z</dc:date>
    </item>
  </channel>
</rss>

