<?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: lib spifi bug in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/lib-spifi-bug/m-p/575025#M19149</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by peufeu on Thu Aug 07 01:44:51 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt; I imagine the problem you are alluding to is down to the fact the the LPC43xx startup code&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;nbsp; generated in LPCXpresso calls the SystemInit() function in LPCOpen projects before it &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt; does the data/bss initialisation. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt; Assuming you aren't using SDRAM, you may well be able to get away with just moving&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt; the SystemInit() call to later in the ResetHandler() function.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;OK, will try that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt; If you need further assistance, it would be helpful if you could export and post your test project.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;No need, the fix works. I was just posting to inform others of the issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 18:59:03 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T18:59:03Z</dc:date>
    <item>
      <title>lib spifi bug</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/lib-spifi-bug/m-p/575023#M19147</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by pierre on Sun Aug 03 09:01:04 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have used lpcspifi (v0.06) to program the flash on my LPC4330 Xplorer board, and encountered a bug...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My program executes from flash.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;cr_startup_lpc43xx.c starts by setting up the clock and calling a few initialization functions before coping all the executable into RAM.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So, I have set up the linker script to put this init code in flash.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Everything else is set to be loaded in RAM before execution (including all SPIFI related code of course).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, the spifi code calls those :&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_Clock_SetDivider&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_Clock_GetClockInputHz&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;just after taking ownership of the flash... so of course, the CPU can't access those functions, and it crashes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The fix is simple, I removed the call to Chip_Clock_GetClockInputHz (it is just a debug output), and made a copy of Chip_Clock_SetDivider, that I load in RAM along with the rest of the code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now it works. Actually, after fixing this, my flash programming code worked on the first try. The new libspifi interface is easier to use than the previous one...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, cr_startup_xxxx.c needs Chip_Clock_SetDivider to be in flash, but libspifi needs it to be in RAM. A bit of a dilemma here.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;cr_startup_xxxx.c could copy the executable in RAM before doing all initialization (hm...), or we need a RAM copy of Chip_Clock_SetDivider.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:59:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/lib-spifi-bug/m-p/575023#M19147</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: lib spifi bug</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/lib-spifi-bug/m-p/575024#M19148</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lpcxpresso-support on Tue Aug 05 03:01:42 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Without seeing your actual project - and the way you are moving code to RAM - it is hard to comment in detail.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But I imagine the problem you are alluding to is down to the fact the the LPC43xx startup code generated in LPCXpresso calls the &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SystemInit() function in LPCOpen projects before it does the data/bss initialisation. This is done so that things don't break when external SDRAM is being used.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Assuming you aren't using SDRAM, you may well be able to get away with just moving the SystemInit() call to later in the ResetHandler() function.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you need further assistance, it would be helpful if you could export and post your test project.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.lpcware.com%2Fcontent%2Ffaq%2Flpcxpresso%2Fhow-importexport-projects" rel="nofollow" target="_blank"&gt;http://www.lpcware.com/content/faq/lpcxpresso/how-importexport-projects&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;or at least post your linker map file and linker scripts.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPCXpresso Support&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:59:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/lib-spifi-bug/m-p/575024#M19148</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: lib spifi bug</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/lib-spifi-bug/m-p/575025#M19149</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by peufeu on Thu Aug 07 01:44:51 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt; I imagine the problem you are alluding to is down to the fact the the LPC43xx startup code&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;nbsp; generated in LPCXpresso calls the SystemInit() function in LPCOpen projects before it &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt; does the data/bss initialisation. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt; Assuming you aren't using SDRAM, you may well be able to get away with just moving&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt; the SystemInit() call to later in the ResetHandler() function.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;OK, will try that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt; If you need further assistance, it would be helpful if you could export and post your test project.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;No need, the fix works. I was just posting to inform others of the issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:59:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/lib-spifi-bug/m-p/575025#M19149</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:59:03Z</dc:date>
    </item>
  </channel>
</rss>

