<?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>Kinetis Microcontrollers中的主题 Re: Editing __pe_initialize_hardware() in MQX</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Editing-pe-initialize-hardware-in-MQX/m-p/148747#M129</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, at least for now it is working.&lt;/P&gt;&lt;P&gt;I am sure at some point it will dawn on you why!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 24 Oct 2012 18:58:15 GMT</pubDate>
    <dc:creator>JimDon</dc:creator>
    <dc:date>2012-10-24T18:58:15Z</dc:date>
    <item>
      <title>Editing __pe_initialize_hardware() in MQX</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Editing-pe-initialize-hardware-in-MQX/m-p/148743#M125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to control (bit-bang) a pin (port A, pin 25, make it GPIO, make it output, make it HIGH) on a K61 device in the earliest stages of processor boot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using MQX for an OS, building in IAR (all fully updated)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The right place for the code &lt;EM&gt;appears&lt;/EM&gt; to be in &lt;SPAN style="font-size: 12pt;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;bsp_cm.c&lt;/STRONG&gt;&lt;/SPAN&gt;, at the top of &lt;SPAN style="font-size: 12pt;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;__pe_initialize_hardware()&lt;/STRONG&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, when I try to add ANY code to that function - code to perform my bit-banging - although I can get it to build and download, I cannot get the code to run very far.&amp;nbsp; Using "Run to main" simply never stops at main.&amp;nbsp; Clicking the "red hand" causes the IDE to basically crash.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Setting a (earlier) breakpoint at (or performing a "Run to")&amp;nbsp; the top of &lt;SPAN style="font-size: 12pt;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;__pe_initialize_hardware &lt;/STRONG&gt;&lt;/SPAN&gt;"works" - I mean it runs to and stops there successfully -&amp;nbsp; but at that point I cannot perform a go or stepover or stepinto (it gets lost just like before) . In addition, the assembly code looks like total gibberish - nothing like it looks when I don't add my bit-banging code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the one line of code I can add that causes it to crash.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;PORTA_PCR25 = PORT_PCR_MUX(0x01);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 19:41:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Editing-pe-initialize-hardware-in-MQX/m-p/148743#M125</guid>
      <dc:creator>mike65535</dc:creator>
      <dc:date>2012-10-23T19:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: Editing __pe_initialize_hardware() in MQX</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Editing-pe-initialize-hardware-in-MQX/m-p/148744#M126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you do this before writing the PCR register?&lt;/P&gt;&lt;P&gt;// Enable clock gate the porta&lt;/P&gt;&lt;P&gt; SIM_SCGC5 |= SIM_SCGC5_PORTA_MASK;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not it will cause a hard fault.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2012 03:36:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Editing-pe-initialize-hardware-in-MQX/m-p/148744#M126</guid>
      <dc:creator>JimDon</dc:creator>
      <dc:date>2012-10-24T03:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: Editing __pe_initialize_hardware() in MQX</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Editing-pe-initialize-hardware-in-MQX/m-p/148745#M127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, that "hard fault" you indicated gave me hope, considering IAR totally crashes if I try to run my code but... that didn't solve the problem...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The equivalent of that line of code was already in the function&lt;STRONG&gt; __pe_initialize_hardware()&lt;/STRONG&gt; ( in &lt;STRONG&gt;bsp_cm.c&lt;/STRONG&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt; /* System clock initialization */&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; /* SIM_SCGC5: PORTE=1,PORTC=1,PORTA=1 */&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; SIM_SCGC5 |= (uint32_t)0x2A00UL;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Enable clock gate for ports to enable pin routing */&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;As you can see, portA is enabled. My code used to be BEFORE that line, so, I moved my code to below all that, but no avail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As I see it, the fact that IAR shows me bogus assembly even BEFORE I step through my new code should tell us something (but I don't know what).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In other words, simply compiling in some code that (potentially) talks to the port causes the assembly view to puke even though I've set a breakpoint before even actually running that code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does that makes sense?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2012 12:47:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Editing-pe-initialize-hardware-in-MQX/m-p/148745#M127</guid>
      <dc:creator>mike65535</dc:creator>
      <dc:date>2012-10-24T12:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: Editing __pe_initialize_hardware() in MQX</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Editing-pe-initialize-hardware-in-MQX/m-p/148746#M128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Interesting and confusing...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Somehwat by accident, I also ORed a ONE into bit 5 (the TSI bit)&amp;nbsp; with&amp;nbsp; this code&lt;/P&gt;&lt;P&gt;SIM_SCGC5 |= (uint32_t)0x2A20UL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and now it works, though I'm not happy to say it...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2012 15:59:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Editing-pe-initialize-hardware-in-MQX/m-p/148746#M128</guid>
      <dc:creator>mike65535</dc:creator>
      <dc:date>2012-10-24T15:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Editing __pe_initialize_hardware() in MQX</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Editing-pe-initialize-hardware-in-MQX/m-p/148747#M129</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, at least for now it is working.&lt;/P&gt;&lt;P&gt;I am sure at some point it will dawn on you why!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2012 18:58:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Editing-pe-initialize-hardware-in-MQX/m-p/148747#M129</guid>
      <dc:creator>JimDon</dc:creator>
      <dc:date>2012-10-24T18:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: Editing __pe_initialize_hardware() in MQX</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Editing-pe-initialize-hardware-in-MQX/m-p/148748#M130</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, as I add another line of code, it breaks again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't know how adding a line of code can cause the entire Assembly view to show garbage.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2012 19:31:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Editing-pe-initialize-hardware-in-MQX/m-p/148748#M130</guid>
      <dc:creator>mike65535</dc:creator>
      <dc:date>2012-10-24T19:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: Editing __pe_initialize_hardware() in MQX</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Editing-pe-initialize-hardware-in-MQX/m-p/148749#M131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try the following code to enable the clocks:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;SIM_SCGC5 |= SIM_SCGC5_PORTE_MASK | SIM_SCGC5_PORTC_MASK | SIM_SCGC5_PORTA_MASK;&amp;nbsp; // Enable clocks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These symbols are defined by the part-specific header file, MKL25Z4.h, if you are using the Freedom board.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;---Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Oct 2012 12:07:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Editing-pe-initialize-hardware-in-MQX/m-p/148749#M131</guid>
      <dc:creator>tom_thompson</dc:creator>
      <dc:date>2012-10-25T12:07:02Z</dc:date>
    </item>
  </channel>
</rss>

