<?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: CW v10.4 / CF V1 core stack frame structure in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/CW-v10-4-CF-V1-core-stack-frame-structure/m-p/222827#M8830</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much for your response! It was very helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I may have identified a problem with the FS USB stack v4.1.1:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the file Freescale USB Stack v4.1.1\Source\Device\source\common\usb_framework.c, function &lt;STRONG&gt;USB_Strd_Req_Get_Status()&lt;/STRONG&gt;, the function &lt;STRONG&gt;USB_Desc_Get_Descriptor()&lt;/STRONG&gt; is called with the size parameter equal to &lt;STRONG&gt;(USB_PACKET_SIZE *)&amp;amp;u16DescSize&lt;/STRONG&gt;. The problem is that &lt;STRONG&gt;u16DescSize&lt;/STRONG&gt; is a local variable declared as a uint_16, and (USB_PACKET_SIZE *) is a uint_32 pointer. When &lt;STRONG&gt;USB_Desc_Get_Descriptor()&lt;/STRONG&gt; is called from &lt;STRONG&gt;USB_Strd_Req_Get_Status()&lt;/STRONG&gt; and the line &lt;STRONG&gt;*size = g_std_desc_size[type]&lt;/STRONG&gt; is executed, the descriptor parameter ends up getting corrupted because it's using a uint_32 pointer to write to a uint_16 object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This led to my problem because the descriptor parameter ended up pointing into unimplemented memory space and when the calling function tried to dereference the descriptor pointer, the processor threw an 'operand read' exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried declaring &lt;STRONG&gt;u16DescSize&lt;/STRONG&gt; as a uint_32 instead of a uint_16. This indeed fixed my problem, and I'm no longer throwing the exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have you heard of this before? Does this make sense to you, or am I deluded?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for your kind assistance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. I'm telling you all of this because I think that you're a Freescale employee. If you're not, my apologies.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 Oct 2013 03:51:14 GMT</pubDate>
    <dc:creator>chicagomike</dc:creator>
    <dc:date>2013-10-25T03:51:14Z</dc:date>
    <item>
      <title>CW v10.4 / CF V1 core stack frame structure</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/CW-v10-4-CF-V1-core-stack-frame-structure/m-p/222825#M8828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone point me to documentation on function stack frame structure for the MCF51JF128 in CW 10.4?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm throwing an "Error on operand read" exception and I'm trying to debug it. I suspect it has to do with deep call nesting and/or large stack frames, but I can't be sure because I don't understand the stack frame structure well enough.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I looked through all of the PDF files in Freescale\CW MCU v10.4\MCU\Help\PDF, but I can't find any documentation that deals with this subject.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Oct 2013 02:58:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/CW-v10-4-CF-V1-core-stack-frame-structure/m-p/222825#M8828</guid>
      <dc:creator>chicagomike</dc:creator>
      <dc:date>2013-10-22T02:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: CW v10.4 / CF V1 core stack frame structure</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/CW-v10-4-CF-V1-core-stack-frame-structure/m-p/222826#M8829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mike,&lt;/P&gt;&lt;P&gt;Head to the product page for the MCF51JF128, click Documentation tab and filter on Reference Manuals.&lt;/P&gt;&lt;P&gt;Click on the &lt;A href="http://cache.freescale.com/files/dsp/doc/ref_manual/CFPRM.pdf?fpsp=1&amp;amp;WT_TYPE=Reference%20Manuals&amp;amp;WT_VENDOR=FREESCALE&amp;amp;WT_FILE_FORMAT=pdf&amp;amp;WT_ASSET=Documentation"&gt;CFPRM.pdf &lt;/A&gt;and it has exception stack frame information.&lt;/P&gt;&lt;P&gt;Chapter 11 &lt;/P&gt;&lt;P&gt;Exception Processing&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The &lt;A href="http://cache.freescale.com/files/32bit/doc/ref_manual/MCF51JF128RM.pdf?fpsp=1&amp;amp;WT_TYPE=Reference%20Manuals&amp;amp;WT_VENDOR=FREESCALE&amp;amp;WT_FILE_FORMAT=pdf&amp;amp;WT_ASSET=Documentation"&gt;MCF51JF128RM.pdf &lt;/A&gt;has information as well.&lt;/P&gt;&lt;P&gt;11.3.2.1 Exception Stack Frame Definition&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Oct 2013 22:25:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/CW-v10-4-CF-V1-core-stack-frame-structure/m-p/222826#M8829</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2013-10-22T22:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: CW v10.4 / CF V1 core stack frame structure</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/CW-v10-4-CF-V1-core-stack-frame-structure/m-p/222827#M8830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much for your response! It was very helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I may have identified a problem with the FS USB stack v4.1.1:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the file Freescale USB Stack v4.1.1\Source\Device\source\common\usb_framework.c, function &lt;STRONG&gt;USB_Strd_Req_Get_Status()&lt;/STRONG&gt;, the function &lt;STRONG&gt;USB_Desc_Get_Descriptor()&lt;/STRONG&gt; is called with the size parameter equal to &lt;STRONG&gt;(USB_PACKET_SIZE *)&amp;amp;u16DescSize&lt;/STRONG&gt;. The problem is that &lt;STRONG&gt;u16DescSize&lt;/STRONG&gt; is a local variable declared as a uint_16, and (USB_PACKET_SIZE *) is a uint_32 pointer. When &lt;STRONG&gt;USB_Desc_Get_Descriptor()&lt;/STRONG&gt; is called from &lt;STRONG&gt;USB_Strd_Req_Get_Status()&lt;/STRONG&gt; and the line &lt;STRONG&gt;*size = g_std_desc_size[type]&lt;/STRONG&gt; is executed, the descriptor parameter ends up getting corrupted because it's using a uint_32 pointer to write to a uint_16 object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This led to my problem because the descriptor parameter ended up pointing into unimplemented memory space and when the calling function tried to dereference the descriptor pointer, the processor threw an 'operand read' exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried declaring &lt;STRONG&gt;u16DescSize&lt;/STRONG&gt; as a uint_32 instead of a uint_16. This indeed fixed my problem, and I'm no longer throwing the exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have you heard of this before? Does this make sense to you, or am I deluded?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for your kind assistance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. I'm telling you all of this because I think that you're a Freescale employee. If you're not, my apologies.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Oct 2013 03:51:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/CW-v10-4-CF-V1-core-stack-frame-structure/m-p/222827#M8830</guid>
      <dc:creator>chicagomike</dc:creator>
      <dc:date>2013-10-25T03:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: CW v10.4 / CF V1 core stack frame structure</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/CW-v10-4-CF-V1-core-stack-frame-structure/m-p/222828#M8831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mike,&lt;/P&gt;&lt;P&gt;yes I'm with Freescale.&lt;/P&gt;&lt;P&gt;I will find correct USB people to pass this along too.&lt;/P&gt;&lt;P&gt;Very good debugging.&amp;nbsp; Thank you for posting.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Oct 2013 12:34:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/CW-v10-4-CF-V1-core-stack-frame-structure/m-p/222828#M8831</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2013-10-25T12:34:41Z</dc:date>
    </item>
  </channel>
</rss>

