<?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: Issue Writing to Vector Table on KE/KEA in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Issue-Writing-to-Vector-Table-on-KE-KEA/m-p/1093607#M57767</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;0x00000000 (default VTOR) is in Flash and you can't copy vectors to flash without using flashing routines.&lt;/P&gt;&lt;P&gt;In addition one would not normally write vectors to this area during run time because it could only be done once and need a sector erase to write again (extremely dangerous during operation because the complete sector needs to be backed up and re-flashed and any power cycle during the procedure would leaves the device in an un-bootable state).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The technique used when vectors are to be inserted at run time is to relocate to SRAM where they can be loaded and changed at will - just set the VTOR to match the SRAM location, which should be on a 256 byte aligned boundary for your devices (or a 512 byte aligned boundary generally so that also larger vector tables could be supported). Generally the start of SRAM is convenient.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;BR /&gt;&lt;EM&gt;[uTasker project developer for Kinetis and i.MX RT]&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 31 May 2020 13:13:34 GMT</pubDate>
    <dc:creator>mjbcswitzerland</dc:creator>
    <dc:date>2020-05-31T13:13:34Z</dc:date>
    <item>
      <title>Issue Writing to Vector Table on KE/KEA</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Issue-Writing-to-Vector-Table-on-KE-KEA/m-p/1093606#M57766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG style="background-color: #ffffff; color: #222222; font-size: 15px; "&gt;DEVICE:&amp;nbsp;&amp;nbsp;&amp;nbsp;KE06/KEA128&amp;nbsp; (two examples of each were tested)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; background-color: #ffffff; font-size: small;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="background-color: #ffffff; color: #222222; font-size: small; "&gt;To begin, I checked the value of VTOR and it reported the value of '0' for the offset.&amp;nbsp; I took this to mean the table is not offset.&amp;nbsp; So I attempted to load the address value of my IRQ handler routine into that table location.&amp;nbsp; During execution It faulted on that assignment statement into the "DefaultISR," which is simply a loop found in "startup_SKEAZ1284.S."&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="background-color: #ffffff; color: #222222; font-size: small; "&gt;Here are some of the relevant code bits:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// "Tag" of IRQ pointer assigned to the IRQ address. '0xA0' is the mem. loc. of IRQ 24:&lt;/SPAN&gt;
&lt;SPAN class="property macro token"&gt;#define  KBI0_IRQ  (  * ( volatile uint32_t * ) 0x000000A0 ) &lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;// Handler defined:&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;void&lt;/SPAN&gt; __attribute__  &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;interrupt&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; Handler_IRQ &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;void&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;int&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;main&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;// Assignment and fault site:&lt;/SPAN&gt;
KBI0_IRQ &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;uint32_t&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;amp;&lt;/SPAN&gt;Handler_IRQ&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
 
&lt;SPAN class="comment token"&gt;// Also tried...&lt;/SPAN&gt;
KBI0_IRQ &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;uint32_t&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;Handler_IRQ&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;// Neither worked, both faulted&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: #222222; background-color: #ffffff; font-size: small;"&gt;It was my impression the vector table was part of code space and not privileged, however I could be wrong. Is there a write protection or boundary issue I'm not aware of?&amp;nbsp; Is this a little/big endian issue?&amp;nbsp; I also tried to write before and after enabling both the KBI module and the NVIC.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #222222; background-color: #ffffff; font-size: small;"&gt;Thank you for any light you can shed on this situation.&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="background-color: #ffffff; color: #222222; font-size: small; "&gt;Thanks again,&lt;/STRONG&gt;&lt;BR style="color: #222222; background-color: #ffffff; font-size: small;" /&gt;&lt;STRONG style="background-color: #ffffff; color: #222222; font-size: small; "&gt;Tom&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV class="" style="color: #222222; background-color: #ffffff; font-size: small;"&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 May 2020 21:56:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Issue-Writing-to-Vector-Table-on-KE-KEA/m-p/1093606#M57766</guid>
      <dc:creator>tomsparks</dc:creator>
      <dc:date>2020-05-30T21:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: Issue Writing to Vector Table on KE/KEA</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Issue-Writing-to-Vector-Table-on-KE-KEA/m-p/1093607#M57767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;0x00000000 (default VTOR) is in Flash and you can't copy vectors to flash without using flashing routines.&lt;/P&gt;&lt;P&gt;In addition one would not normally write vectors to this area during run time because it could only be done once and need a sector erase to write again (extremely dangerous during operation because the complete sector needs to be backed up and re-flashed and any power cycle during the procedure would leaves the device in an un-bootable state).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The technique used when vectors are to be inserted at run time is to relocate to SRAM where they can be loaded and changed at will - just set the VTOR to match the SRAM location, which should be on a 256 byte aligned boundary for your devices (or a 512 byte aligned boundary generally so that also larger vector tables could be supported). Generally the start of SRAM is convenient.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;BR /&gt;&lt;EM&gt;[uTasker project developer for Kinetis and i.MX RT]&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 31 May 2020 13:13:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Issue-Writing-to-Vector-Table-on-KE-KEA/m-p/1093607#M57767</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2020-05-31T13:13:34Z</dc:date>
    </item>
    <item>
      <title>Re: Issue Writing to Vector Table on KE/KEA</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Issue-Writing-to-Vector-Table-on-KE-KEA/m-p/1093608#M57768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, Mark.&amp;nbsp; I've been reading a lot about relocating the table and now I understand why that's important.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 31 May 2020 18:06:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Issue-Writing-to-Vector-Table-on-KE-KEA/m-p/1093608#M57768</guid>
      <dc:creator>tomsparks</dc:creator>
      <dc:date>2020-05-31T18:06:44Z</dc:date>
    </item>
  </channel>
</rss>

