<?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>LPC MicrocontrollersのトピックSpifi library problem: reading from invalid address</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Spifi-library-problem-reading-from-invalid-address/m-p/552474#M14390</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by hlsa on Tue Sep 03 22:27:04 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Since I have not received an answer regarding a spifi problem in the peripherals forum (see &lt;/SPAN&gt;&lt;A _jive_internal="true" class="" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fhttp%3A%2F%2Fwww.lpcware.com%2Fcontent%2Fforum%2Fspifi-library-non-keil-development"&gt;http://www.lpcware.com/content/forum/spifi-library-non-keil-development&lt;/A&gt;&lt;SPAN&gt;), I will give it another try here.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is quite simple: the SPIFI-library does not work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; void FvSpifiInit(void)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; int32_t ret = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; LPC_SCU-&amp;gt;SFSP3_3 = SSP_IO | 3; /* P3_3: SPIFI_SCLK */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; LPC_SCU-&amp;gt;SFSP3_4 = SSP_IO | 3; /* P3_4: SPIFI_IO3 */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; LPC_SCU-&amp;gt;SFSP3_5 = SSP_IO | 3; /* P3_5: SPIFI_IO2 */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; LPC_SCU-&amp;gt;SFSP3_6 = SSP_IO | 3; /* P3_6: SPIFI_IO1 */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; LPC_SCU-&amp;gt;SFSP3_7 = SSP_IO | 3; /* P3_7: SPIFI_IO0 */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; LPC_SCU-&amp;gt;SFSP3_8 = SSP_IO | 3; /* P3_8: SPIFI_/CS */&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; /* Enable clock source for SPIFI */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; LPC_CGU-&amp;gt;BASE_SPIFI_CLK = 1&amp;lt;&amp;lt;24 | 1&amp;lt;&amp;lt;11; /* clock source IRC 12 MHz */&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; ret = pSpifi-&amp;gt;spifi_init(&amp;amp;obj, 3, S_RCVCLK | S_FULLCLK, 12); &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;pSpifi points correctly to spifi_table, which is linked into my program code (0x1a035198). The spifi functions from the library are also correctly linked into the program (e.g. spifi_init at 0x1a01309c).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;During linking, I get the following warning:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; ld.exe: warning: C:\T\IPD10G2\M4\Bsp\Cmsis\spifi_drv_M4.lib(spifi_rom_api.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Running the program ends in an exception.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; I debugged the assembler code of the spifi library: in the init function a ldr-Instruction loads data from 0x29004018 (see screenshot), which is obviously an invalid address.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I use the library which is mentioned above (file size: 35468 bytes). My controller is a LPC4357.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What's going wrong?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Holger&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 18:36:00 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T18:36:00Z</dc:date>
    <item>
      <title>Spifi library problem: reading from invalid address</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Spifi-library-problem-reading-from-invalid-address/m-p/552474#M14390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by hlsa on Tue Sep 03 22:27:04 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Since I have not received an answer regarding a spifi problem in the peripherals forum (see &lt;/SPAN&gt;&lt;A _jive_internal="true" class="" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fhttp%3A%2F%2Fwww.lpcware.com%2Fcontent%2Fforum%2Fspifi-library-non-keil-development"&gt;http://www.lpcware.com/content/forum/spifi-library-non-keil-development&lt;/A&gt;&lt;SPAN&gt;), I will give it another try here.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is quite simple: the SPIFI-library does not work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; void FvSpifiInit(void)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; int32_t ret = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; LPC_SCU-&amp;gt;SFSP3_3 = SSP_IO | 3; /* P3_3: SPIFI_SCLK */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; LPC_SCU-&amp;gt;SFSP3_4 = SSP_IO | 3; /* P3_4: SPIFI_IO3 */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; LPC_SCU-&amp;gt;SFSP3_5 = SSP_IO | 3; /* P3_5: SPIFI_IO2 */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; LPC_SCU-&amp;gt;SFSP3_6 = SSP_IO | 3; /* P3_6: SPIFI_IO1 */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; LPC_SCU-&amp;gt;SFSP3_7 = SSP_IO | 3; /* P3_7: SPIFI_IO0 */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; LPC_SCU-&amp;gt;SFSP3_8 = SSP_IO | 3; /* P3_8: SPIFI_/CS */&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; /* Enable clock source for SPIFI */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; LPC_CGU-&amp;gt;BASE_SPIFI_CLK = 1&amp;lt;&amp;lt;24 | 1&amp;lt;&amp;lt;11; /* clock source IRC 12 MHz */&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; ret = pSpifi-&amp;gt;spifi_init(&amp;amp;obj, 3, S_RCVCLK | S_FULLCLK, 12); &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;pSpifi points correctly to spifi_table, which is linked into my program code (0x1a035198). The spifi functions from the library are also correctly linked into the program (e.g. spifi_init at 0x1a01309c).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;During linking, I get the following warning:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; ld.exe: warning: C:\T\IPD10G2\M4\Bsp\Cmsis\spifi_drv_M4.lib(spifi_rom_api.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Running the program ends in an exception.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; I debugged the assembler code of the spifi library: in the init function a ldr-Instruction loads data from 0x29004018 (see screenshot), which is obviously an invalid address.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I use the library which is mentioned above (file size: 35468 bytes). My controller is a LPC4357.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What's going wrong?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Holger&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:36:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Spifi-library-problem-reading-from-invalid-address/m-p/552474#M14390</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: Spifi library problem: reading from invalid address</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Spifi-library-problem-reading-from-invalid-address/m-p/552475#M14391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by bavarian on Wed Sep 11 04:44:00 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello Holger,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;GCC assumes that &lt;/SPAN&gt;&lt;STRONG&gt;wchar_t&lt;/STRONG&gt;&lt;SPAN&gt; is a 4-bytes type by default. ARMCC assumes it is a 2-bytes type by default.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This means that creating a library with ARMCC and use it in GCC (and also vice versa) creates a warning, and in case of the SPIFI lib even a runtime error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;There are options in both toolsets to force usage of 4-bytes and 2-bytes types, but in fact the problem goes a little bit deeper than that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In NXP we currently work on a solution of this conflict for the Cortex-M3/M4 SPIFI libs.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;We will keep you updated on this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There is an LPCXpresso example which deals with the SPIFI but not using the library, maybe it can help you:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&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%2Fforum%2Fspifi-errata-and-part-version-information%23comment-1023028" rel="nofollow" target="_blank"&gt;http://www.lpcware.com/content/forum/spifi-errata-and-part-version-information#comment-1023028&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Bernhard.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:36:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Spifi-library-problem-reading-from-invalid-address/m-p/552475#M14391</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:36:01Z</dc:date>
    </item>
  </channel>
</rss>

