<?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のトピックRe: Changing the vector table in LPC1227</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Changing-the-vector-table-in-LPC1227/m-p/526171#M8804</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by dariush_abbasi868 on Sun Dec 28 06:01:46 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this&amp;nbsp; same for lpc1768 or not?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 17:00:51 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T17:00:51Z</dc:date>
    <item>
      <title>Changing the vector table in LPC1227</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Changing-the-vector-table-in-LPC1227/m-p/526167#M8800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Vinicius Garcia on Fri Nov 08 04:50:49 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I´m constructing a bootloader for LPC1227 using IAR. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I made the application and boot. Both are running ok. However, after change the firmware (by bootloader app) the LPC1227 doesn´t start. This occur because I don´t know how to move the vector table.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The linker line define symbol __ICFEDIT_intvec_start__ don´t accept a value differ from 0x0000.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I need to change the vector table in IAR. Anyone knows how to do it?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:00:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Changing-the-vector-table-in-LPC1227/m-p/526167#M8800</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the vector table in LPC1227</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Changing-the-vector-table-in-LPC1227/m-p/526168#M8801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by denn4208 on Mon Nov 11 11:43:06 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Are you using interrupts in the bootloader?&amp;nbsp; if not then you don't need to move the vector table.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the boot loader you need to add redirection for each of the interrupts &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The location will depend on the start address of your main application.&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
void NMI_Handler(void)
{
&amp;nbsp; /* Re-direct interrupt, get handler address from application vector table */
&amp;nbsp; asm volatile("ldr r0, =0x3008");&amp;nbsp; &amp;lt;--- new address to jump to when interrupt is received
&amp;nbsp; asm volatile("ldr r0, [r0]");
&amp;nbsp; asm volatile("mov pc, r0");
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if you really do need to move the vector table then the only way to to that with the lpc1227 is to remap the vector table to the start of ram&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;

int32_t vector_in_ram[128] __attribute__ ((section ("vtable"))); // variable to hold the interrupt vectors



__disable_irq();
 // remap the interrupt vectors to the start of the code loaded in memory
&amp;nbsp;&amp;nbsp;&amp;nbsp; int32_t *p = (int32_t *) 0x3000;&amp;nbsp; &amp;lt;---- address of the start of your main application
&amp;nbsp;&amp;nbsp;&amp;nbsp; int i;
&amp;nbsp;&amp;nbsp;&amp;nbsp; // copy the interrupt vector table on base RAM
&amp;nbsp;&amp;nbsp;&amp;nbsp; for (i=0;i&amp;lt;128;i++)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vector_in_ram&lt;I&gt; = *p;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p++;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_SYSCON-&amp;gt;SYSMEMREMAP = 0x1;&amp;nbsp; // remap the interrupt vectors to ram
&amp;nbsp;&amp;nbsp;&amp;nbsp; __enable_irq(); // enable interrupts
&lt;/I&gt;&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using Code Red not IAR so there may be some differences, but these two approaches have worked for me&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:00:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Changing-the-vector-table-in-LPC1227/m-p/526168#M8801</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the vector table in LPC1227</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Changing-the-vector-table-in-LPC1227/m-p/526169#M8802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by embd02161991 on Thu Feb 06 11:18:27 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Vinicius ,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Define a function say CopyInterruptToSRAM :&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
void CopyInterruptToSRAM(void)
{
unsigned int * flashPtr, * ramPtr;
&amp;nbsp; unsigned int * uLimit = (unsigned int *) 0x200; 

ramPtr = (unsigned int *)0x10000000;//load RAM starting at 0x10000000, 
flashPtr = (unsigned int *)0x00;//start of interrupt vector table
&amp;nbsp; while(flashPtr &amp;lt; uLimit)
{
*ramPtr = *flashPtr;
ramPtr++;
flashPtr++; 
}
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And insert these statements in main() : &lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
CopyInterruptToSRAM();//remap interrupt vector to SRAM
SCB-&amp;gt;VTOR =0x10000000;
LPC_SYSCON-&amp;gt;SYSMEMREMAP = 0x01;//change memory map 
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This works in any IDE including IAR.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You also need to change the location of the C file to SRAM that uses these interrupts.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This can be done in IAR by using the compiler directive __ramfunc .&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;For example :&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
__ramfunc void SysTick_Handler(void)
{
LPC_GPIO_PORT-&amp;gt;NOT0 = (1&amp;lt;&amp;lt;7);
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For more information on this refer the application note on IAP for LPC800 :&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%2Fnxpfile%2Fan11388-using-lpc800-application-programming" rel="nofollow noopener noreferrer" target="_blank"&gt;http://www.lpcware.com/content/nxpfile/an11388-using-lpc800-application-programming&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;NXP Technical Support &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:00:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Changing-the-vector-table-in-LPC1227/m-p/526169#M8802</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the vector table in LPC1227</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Changing-the-vector-table-in-LPC1227/m-p/526170#M8803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by rmilne on Fri Aug 01 06:26:59 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Using the __ramfunc directive to improve ISR performance requires that all functions called inside the ISR also be built with the same directive.&amp;nbsp; This includes any Lpcopen library routines. &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:00:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Changing-the-vector-table-in-LPC1227/m-p/526170#M8803</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:00:51Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the vector table in LPC1227</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Changing-the-vector-table-in-LPC1227/m-p/526171#M8804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by dariush_abbasi868 on Sun Dec 28 06:01:46 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this&amp;nbsp; same for lpc1768 or not?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:00:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Changing-the-vector-table-in-LPC1227/m-p/526171#M8804</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:00:51Z</dc:date>
    </item>
  </channel>
</rss>

