<?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 CPU hangs up to Cpu_Interrupt when using large structures in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/CPU-hangs-up-to-Cpu-Interrupt-when-using-large-structures/m-p/160733#M5040</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i got a really strange problem...&lt;/P&gt;&lt;P&gt;i am using mc9s12dp512 and cw 5.9 &amp;amp; pe multilink to write an c program&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i wrote a routine to check some data and compare it with reference data.&lt;/P&gt;&lt;P&gt;therefore i need the reference data and i collected them in structs like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;typedef struct TEST&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; uint16_t test_number;&lt;BR /&gt;&amp;nbsp; uint8_t from_pin;&lt;BR /&gt;&amp;nbsp; uint8_t to_pin;&lt;BR /&gt;&amp;nbsp; float measurement_voltage;&lt;BR /&gt;&amp;nbsp; uint16_t reference_curve;&lt;BR /&gt;} PIN_TEST;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my largest test is an array of 41 of these structs.&lt;/P&gt;&lt;P&gt;i got 13 different tests which are compared one after the other.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if i step through that code it works quite fine.&lt;/P&gt;&lt;P&gt;but if i try to let it run on its own without braking then it always&lt;/P&gt;&lt;P&gt;make the codewarrior debugger go into halt state and if i step forward i see that it keeps in the following isr&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ISR(Cpu_Interrupt)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; asm(BGND);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my question now is if i got problems with the memory blocks because of too large contiguos code or is there anything wrong in my code (could be this, but will be hard to find &lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif"&gt;&lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;&lt;/A&gt; )?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;maybe theres an unwanted jump through some illegal memory operation bringing the code to the isr?&lt;/P&gt;&lt;P&gt;this is the cpu halt isr for breakpoints and debugging, right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;greetings&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 04 Nov 2010 22:24:08 GMT</pubDate>
    <dc:creator>HarryHirn</dc:creator>
    <dc:date>2010-11-04T22:24:08Z</dc:date>
    <item>
      <title>CPU hangs up to Cpu_Interrupt when using large structures</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/CPU-hangs-up-to-Cpu-Interrupt-when-using-large-structures/m-p/160733#M5040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i got a really strange problem...&lt;/P&gt;&lt;P&gt;i am using mc9s12dp512 and cw 5.9 &amp;amp; pe multilink to write an c program&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i wrote a routine to check some data and compare it with reference data.&lt;/P&gt;&lt;P&gt;therefore i need the reference data and i collected them in structs like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;typedef struct TEST&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; uint16_t test_number;&lt;BR /&gt;&amp;nbsp; uint8_t from_pin;&lt;BR /&gt;&amp;nbsp; uint8_t to_pin;&lt;BR /&gt;&amp;nbsp; float measurement_voltage;&lt;BR /&gt;&amp;nbsp; uint16_t reference_curve;&lt;BR /&gt;} PIN_TEST;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my largest test is an array of 41 of these structs.&lt;/P&gt;&lt;P&gt;i got 13 different tests which are compared one after the other.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if i step through that code it works quite fine.&lt;/P&gt;&lt;P&gt;but if i try to let it run on its own without braking then it always&lt;/P&gt;&lt;P&gt;make the codewarrior debugger go into halt state and if i step forward i see that it keeps in the following isr&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ISR(Cpu_Interrupt)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; asm(BGND);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my question now is if i got problems with the memory blocks because of too large contiguos code or is there anything wrong in my code (could be this, but will be hard to find &lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif"&gt;&lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;&lt;/A&gt; )?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;maybe theres an unwanted jump through some illegal memory operation bringing the code to the isr?&lt;/P&gt;&lt;P&gt;this is the cpu halt isr for breakpoints and debugging, right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;greetings&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Nov 2010 22:24:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/CPU-hangs-up-to-Cpu-Interrupt-when-using-large-structures/m-p/160733#M5040</guid>
      <dc:creator>HarryHirn</dc:creator>
      <dc:date>2010-11-04T22:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: CPU hangs up to Cpu_Interrupt when using large structures</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/CPU-hangs-up-to-Cpu-Interrupt-when-using-large-structures/m-p/160734#M5041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Stack overflow? CW will not use struct padding, yet that is 41 * 10 = 410 bytes of data.&lt;/P&gt;&lt;P&gt;Is the array allocated as global or local?&lt;/P&gt;&lt;P&gt;How large is your stack?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The CPU halts like that when the program has gone bananas, most likely because it did a jump outside valid program space. It will for example happen if return addresses on the stack are corrupted.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Nov 2010 22:53:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/CPU-hangs-up-to-Cpu-Interrupt-when-using-large-structures/m-p/160734#M5041</guid>
      <dc:creator>Lundin</dc:creator>
      <dc:date>2010-11-04T22:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: CPU hangs up to Cpu_Interrupt when using large structures</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/CPU-hangs-up-to-Cpu-Interrupt-when-using-large-structures/m-p/160735#M5042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thx for your reply&lt;/P&gt;&lt;P&gt;when i read that i remembered that i had a similar problem already...&lt;/P&gt;&lt;P&gt;my array is local and after increasing my stack to 512 instead of 128 &lt;IMG alt=":smileysurprised:" class="emoticon emoticon-smileysurprised" id="smileysurprised" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-surprised.gif" title="Smiley Surprised" /&gt; it now all works like a charm &lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" id="smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Nov 2010 15:22:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/CPU-hangs-up-to-Cpu-Interrupt-when-using-large-structures/m-p/160735#M5042</guid>
      <dc:creator>HarryHirn</dc:creator>
      <dc:date>2010-11-05T15:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: CPU hangs up to Cpu_Interrupt when using large structures</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/CPU-hangs-up-to-Cpu-Interrupt-when-using-large-structures/m-p/160736#M5043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since it is so big, I would allocate that array as a global static instead. That way you won't have to worry about the stack, and you can assign a dedicated RAM area to it. This is good practice whenever you are dealing with buffers of any kind.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And since it is structs, there is another advantage of allocating it in a dedicated memory area: should the compiler decide to add struct padding (I doubt CW will, but portable code == good code), you will get a "out of space in segment xxx" linker error, instead of a silent stack overflow.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Nov 2010 16:59:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/CPU-hangs-up-to-Cpu-Interrupt-when-using-large-structures/m-p/160736#M5043</guid>
      <dc:creator>Lundin</dc:creator>
      <dc:date>2010-11-08T16:59:18Z</dc:date>
    </item>
  </channel>
</rss>

