<?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: Application and vector offset</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Application-and-vector-offset/m-p/519263#M3073</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by DF9DQ on Fri Nov 02 09:08:18 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Thomas,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think the scatter file for the application should start like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;; Load region is in internal FLASH, 512KBytes&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FLASH 0x00008000 0x78000 {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; ; All code and RO data in in FLASH&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; ER_RO 0x00008000 0x78000 {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; startup_ea1788.o (RESET, +FIRST)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *.o (+RO)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code you show sets VTOR to 0, not 0x8000!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Your boot code should set VTOR to 0x8000 before jumping into the application:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SCB-&amp;gt;VTOR = 0x00008000;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For the INI file this is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FUNC void Setup (void) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; SP = _RDWORD(0x00008000);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; PC = _RDWORD(0x00008004);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; _WDWORD(0xE000ED08, 0x00008000);&amp;nbsp;&amp;nbsp; // VTOR=0x8000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Setup();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That's just a hint. I haven't tested anything... :-)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Rolf&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 17:37:35 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T17:37:35Z</dc:date>
    <item>
      <title>Application and vector offset</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Application-and-vector-offset/m-p/519261#M3071</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by tjoAG on Fri Nov 02 01:21:32 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm making our application ready so it can be used with the bootloader.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The bootloader will be placed from flash address 0x0000 - 0x8000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The application will then start from address 0x8000.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying to get the application running from flash address 0x8000, just to see if it works. But if I do that, the debugger looses its connection. (Using KEIL and ULINK2). I have to force the CPU into internal bootloader before I can get my debugger connect again.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I have done so far in my application to make it run from address 0x8000&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the scatter file I have offset the RO space to 0x8000:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;; Load region is in internal FLASH, 512KBytes&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FLASH 0x00000000 0x78000 {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; ; All code and RO data in in FLASH&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; ER_RO 0x00000000 0x78000 {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;startup_LPC177x_8x.o (RESET, +FIRST)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;startup_ea1788.o (RESET, +FIRST)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *.o (+RO)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the SystemInit function I move the VTOR to address 0x8000:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SCB-&amp;gt;VTOR&amp;nbsp; = 0x00000000 &amp;amp; 0x3FFFFF80;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In the uVision debug setup I add a ini script for the debugger to jump the SP and PC to the flash address 0x8000:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FUNC void Setup (void) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; SP = _RDWORD(0x00008000);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Setup Stack Pointer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; PC = _RDWORD(0x00008004);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Setup Program Counter&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; // _WDWORD(0xE000ED08, 0x00000000);&amp;nbsp;&amp;nbsp; // Setup Vector Table Offset Register&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Setup();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Setup for Running&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I download the code and execute the debugger I get a connection lost and the ULINK cant connect to the CPU.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Am I missing something? Something todo with the Memory Mapping Control register (MEMMAP register) loading some boot code?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Or do I have to have the bootloader code in the target for the debugger to connect?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thomas&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:37:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Application-and-vector-offset/m-p/519261#M3071</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: Application and vector offset</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Application-and-vector-offset/m-p/519262#M3072</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by tjoAG on Fri Nov 02 02:35:45 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When using the above "modification" the application works when bootloaded by the bootloader.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So it still a mystery: Why cant I use the debugger to run the application?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thomas&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:37:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Application-and-vector-offset/m-p/519262#M3072</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: Application and vector offset</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Application-and-vector-offset/m-p/519263#M3073</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by DF9DQ on Fri Nov 02 09:08:18 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Thomas,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think the scatter file for the application should start like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;; Load region is in internal FLASH, 512KBytes&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FLASH 0x00008000 0x78000 {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; ; All code and RO data in in FLASH&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; ER_RO 0x00008000 0x78000 {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; startup_ea1788.o (RESET, +FIRST)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *.o (+RO)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code you show sets VTOR to 0, not 0x8000!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Your boot code should set VTOR to 0x8000 before jumping into the application:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SCB-&amp;gt;VTOR = 0x00008000;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For the INI file this is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FUNC void Setup (void) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; SP = _RDWORD(0x00008000);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; PC = _RDWORD(0x00008004);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; _WDWORD(0xE000ED08, 0x00008000);&amp;nbsp;&amp;nbsp; // VTOR=0x8000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Setup();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That's just a hint. I haven't tested anything... :-)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Rolf&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:37:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Application-and-vector-offset/m-p/519263#M3073</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: Application and vector offset</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Application-and-vector-offset/m-p/519264#M3074</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by wmues on Fri Nov 02 14:25:40 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Please check the valid addresses for VTOR!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Only 0 and 0x20000000 are allowed. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For anything else, you have to set VTOR to 0x20000000 and copy the vector table to 0x20000000. Your runtime library may have a mechanism for copying a memory region at startup.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:37:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Application-and-vector-offset/m-p/519264#M3074</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: Application and vector offset</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Application-and-vector-offset/m-p/519265#M3075</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by DF9DQ on Sun Nov 04 05:00:24 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;That's not the complete truth! :-)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You are right that there is a limitation to the address that can be set in VTOR. It can only start with a certain bit pattern:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;000x xxxx xxxx ....&amp;nbsp; ("code space")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;001x xxxx xxxx ....&amp;nbsp; ("SRAM space")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The base addresses of these two regions are 0 and 0x2000,0000, which you have mentioned.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, within these two regions you can set VTOR to any 256-byte boundary (bits 7...0 are unused). The minimum required alignment depends on the number of interrupts implemented in the device. The LPC1700 has a total of 51 interrupts lines (system: 16, user: 35), where a 256-byte alignment suffices. The recommendation is to always align to a 1024-byte boundary, enough for the maximum of 240 user interrupts in a Cortex-M3 implementation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In our case, setting VTOR to 0x8000 (start of sector 8) is perfectly valid, as it is in code space and more than sufficiently aligned.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Rolf&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:37:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Application-and-vector-offset/m-p/519265#M3075</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:37:37Z</dc:date>
    </item>
    <item>
      <title>Re: Application and vector offset</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Application-and-vector-offset/m-p/519266#M3076</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by wmues on Mon Nov 05 13:27:48 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Rolf,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;you are right. I missed this. Thank you for pointing this out.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wolfgang&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:37:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Application-and-vector-offset/m-p/519266#M3076</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:37:37Z</dc:date>
    </item>
  </channel>
</rss>

