<?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のトピックRunning Code from Multiple Builds</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Running-Code-from-Multiple-Builds/m-p/614795#M24043</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have built two code images on my LPC11U68, one that resides in Flash based at 0x00000000 and one that's based at 0x00005000.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The one at 0x00000000 takes care of all the vector stuff. &amp;nbsp;The idea is for some code in the 0x00000000 space (lower space) to call some of the functions located in the 0x00005000 space (higher space). &amp;nbsp;Each function in the higher space is located at a known fixed address as specified by assigning a section in the linker script for each function. &amp;nbsp;I am able to confirm that these functions are in flash where they should be. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I'm finding is that when (from the lower space) I attempt to call one of the functions in the higher space it fails.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, I create and initialize a function pointer as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#define FUNCTION_ADDRESS_IN_FLASH&amp;nbsp;&amp;nbsp;&amp;nbsp;0x00005000&lt;/P&gt;&lt;P&gt;volatile void (*GoToHigherFunction)( void ) = (void *)(FUNCTION_ADDRESS_IN_FLASH + 1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I call the function like this:&lt;/P&gt;&lt;P&gt;(*&lt;SPAN&gt;GoToHigherFunction&lt;/SPAN&gt;)();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I use the &lt;STRONG&gt;exact&lt;/STRONG&gt; same code, but specify an address within the Lower Code Build (e.g. #define label to 0x00001000) it works fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Because the code is from two separate builds, I am only able to debug the code in the Lower Space using my LPCXpresso Board and the IDE. &amp;nbsp;All the code in the Lower Space works fine, I can single step right up to the call to the function located at 0x5000, but when I single step into the function it goes off into never never land. &amp;nbsp;Using the debugger, right before the call, I can confirm that the function address is correct (0x5000) and from the debugger I can also view flash memory and confirm that the code is right there at 0x5000 as it should be, but I am unable to call that function for some reason.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I though maybe it was because I was using the debugger which didn't have info about the code in the higher space, but even if I make Release builds and burn the ".bin" files directly into flash (not using the debugger at all) it still doesn't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using the LPCXpresso IDE v7.6.2_326 on Windows 7 with an LPCXpresso LPC11U68 Board for debugging my target which is also an LPC11U68.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have looked at the code space in memory, everything's right where it belongs, but I am unable to make function calls to code generated by the second build located in the higher space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This seems very odd to me - can anyone help me understand why this won't work?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 30 Oct 2016 02:42:21 GMT</pubDate>
    <dc:creator>mattferrari</dc:creator>
    <dc:date>2016-10-30T02:42:21Z</dc:date>
    <item>
      <title>Running Code from Multiple Builds</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Running-Code-from-Multiple-Builds/m-p/614795#M24043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have built two code images on my LPC11U68, one that resides in Flash based at 0x00000000 and one that's based at 0x00005000.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The one at 0x00000000 takes care of all the vector stuff. &amp;nbsp;The idea is for some code in the 0x00000000 space (lower space) to call some of the functions located in the 0x00005000 space (higher space). &amp;nbsp;Each function in the higher space is located at a known fixed address as specified by assigning a section in the linker script for each function. &amp;nbsp;I am able to confirm that these functions are in flash where they should be. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I'm finding is that when (from the lower space) I attempt to call one of the functions in the higher space it fails.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, I create and initialize a function pointer as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#define FUNCTION_ADDRESS_IN_FLASH&amp;nbsp;&amp;nbsp;&amp;nbsp;0x00005000&lt;/P&gt;&lt;P&gt;volatile void (*GoToHigherFunction)( void ) = (void *)(FUNCTION_ADDRESS_IN_FLASH + 1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I call the function like this:&lt;/P&gt;&lt;P&gt;(*&lt;SPAN&gt;GoToHigherFunction&lt;/SPAN&gt;)();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I use the &lt;STRONG&gt;exact&lt;/STRONG&gt; same code, but specify an address within the Lower Code Build (e.g. #define label to 0x00001000) it works fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Because the code is from two separate builds, I am only able to debug the code in the Lower Space using my LPCXpresso Board and the IDE. &amp;nbsp;All the code in the Lower Space works fine, I can single step right up to the call to the function located at 0x5000, but when I single step into the function it goes off into never never land. &amp;nbsp;Using the debugger, right before the call, I can confirm that the function address is correct (0x5000) and from the debugger I can also view flash memory and confirm that the code is right there at 0x5000 as it should be, but I am unable to call that function for some reason.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I though maybe it was because I was using the debugger which didn't have info about the code in the higher space, but even if I make Release builds and burn the ".bin" files directly into flash (not using the debugger at all) it still doesn't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using the LPCXpresso IDE v7.6.2_326 on Windows 7 with an LPCXpresso LPC11U68 Board for debugging my target which is also an LPC11U68.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have looked at the code space in memory, everything's right where it belongs, but I am unable to make function calls to code generated by the second build located in the higher space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This seems very odd to me - can anyone help me understand why this won't work?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 Oct 2016 02:42:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Running-Code-from-Multiple-Builds/m-p/614795#M24043</guid>
      <dc:creator>mattferrari</dc:creator>
      <dc:date>2016-10-30T02:42:21Z</dc:date>
    </item>
    <item>
      <title>Re: Running Code from Multiple Builds</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Running-Code-from-Multiple-Builds/m-p/614796#M24044</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have resolved this issue, it was something other than what I had described... &amp;nbsp;I AM able to call the higher functions, it was user error I'm afraid... &amp;nbsp;Sorry for any inconvenience.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 Oct 2016 04:03:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Running-Code-from-Multiple-Builds/m-p/614796#M24044</guid>
      <dc:creator>mattferrari</dc:creator>
      <dc:date>2016-10-30T04:03:20Z</dc:date>
    </item>
  </channel>
</rss>

