<?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 JM60 Bootloader with Interrupts in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/JM60-Bootloader-with-Interrupts/m-p/298466#M20575</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've inherited a JM60 application built using Processor Expert on CW 10.2.&amp;nbsp; It has a serial connection to our main processor over SCI2 and uses interrupts and a custom protocol.&amp;nbsp; My task is to create a bootloader so that we can remotely update the application firmware in the field.&amp;nbsp; To that end, I've read a ton of discussions on here and (after a lot of wasted time and hair-pulling) realized that my only options are to implement a soft vector jump table or implement my bootloader without interrupts.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have already implemented an interrupt-driven version by re-using the serial protocol from our application. I'd really like to keep it that way so that I can use common code.&amp;nbsp; With a little rework, I'm sure I could abstract it a little better so that it could work either way, but I'm intrigued by an elegant jump table suggestion by kef in the following post: &lt;A _jive_internal="true" href="https://community.nxp.com/thread/301138#comment-303923"&gt;Re: Bootloader and Interrupt&lt;/A&gt;.&amp;nbsp; I prefer this solution if possible because it should allow any interrupts to be used in the future by the application without having to manually redirect each one in the bootloader.&amp;nbsp; It also keeps the bootloader as small as possible because I don't need those redirect functions.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've implemented a JumpTable.c and h based on his code sample, and it appears to set everything up correctly, but I get a reset due to invalid opcode apparently when an interrupt is called.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I browse the memory after initializing the jump table, I see that the vector table is set up correctly.&lt;/P&gt;&lt;P&gt;Memory:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x0000FFC0&amp;nbsp; FFFFFFFF 1960195D 195A1957 19541951&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x0000FFD0&amp;nbsp; 194E194B&amp;nbsp; 19481945 1942193F 193C1939&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x0000FFE0&amp;nbsp; 19361933&amp;nbsp;&amp;nbsp; 1930192D 192A1927 1921191E&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x0000FFF0&amp;nbsp; 191B1918&amp;nbsp;&amp;nbsp; 19151912 190F190C 1909F0AD&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;0xF0AD is the address of _EntryPoint, and 0x1909 is the start address of the jump table in RAM.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Similarly, the correct jump offsets in RAM have the correct addresses according to the map file.&lt;/P&gt;&lt;P&gt;Memory:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00001940&amp;nbsp; 70FC7DF0 FD1EDF33 CCF069CC EFAFCCF0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00001950&amp;nbsp; 0F4B5CA0 92CAAC54 A0844322&amp;nbsp;&amp;nbsp; 80F0FD34&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;0x1948 has 0xCCF069, where 0xF069 which is AS1_InterruptError&lt;/LI&gt;&lt;LI&gt;0x194B has 0xCCEFAF, where 0xEFAF which is AS1_InterruptRx&lt;/LI&gt;&lt;LI&gt;0x194E has 0xCCF00F, where 0xF00F which is AS1_InterruptTx&lt;/LI&gt;&lt;/UL&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Map file:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AS1_InterruptRx&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; EFAF&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 60&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 96&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; .text&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AS1_InterruptTx&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; F00F&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 90&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; .text&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AS1_InterruptError&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; F069&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 17&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; .text&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _EntryPoint&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; F0AD&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 51&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 81&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp; .text&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Strangely, now that I've cleaned up the code to make it more presentable to post, I don't get the reset, and instead the MCU seems to go off into space.&amp;nbsp; When I switch from using the jump table back to using the standard vector table, it all works fine, and I get proper serial communication.&amp;nbsp; It seems that the problem has something to do with the way the ISRs are called and/or return, but I can't figure it out, so any help is appreciated!&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;-rich&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337744"&gt;JumpTable.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Mar 2014 15:45:39 GMT</pubDate>
    <dc:creator>richjones</dc:creator>
    <dc:date>2014-03-18T15:45:39Z</dc:date>
    <item>
      <title>JM60 Bootloader with Interrupts</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/JM60-Bootloader-with-Interrupts/m-p/298466#M20575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've inherited a JM60 application built using Processor Expert on CW 10.2.&amp;nbsp; It has a serial connection to our main processor over SCI2 and uses interrupts and a custom protocol.&amp;nbsp; My task is to create a bootloader so that we can remotely update the application firmware in the field.&amp;nbsp; To that end, I've read a ton of discussions on here and (after a lot of wasted time and hair-pulling) realized that my only options are to implement a soft vector jump table or implement my bootloader without interrupts.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have already implemented an interrupt-driven version by re-using the serial protocol from our application. I'd really like to keep it that way so that I can use common code.&amp;nbsp; With a little rework, I'm sure I could abstract it a little better so that it could work either way, but I'm intrigued by an elegant jump table suggestion by kef in the following post: &lt;A _jive_internal="true" href="https://community.nxp.com/thread/301138#comment-303923"&gt;Re: Bootloader and Interrupt&lt;/A&gt;.&amp;nbsp; I prefer this solution if possible because it should allow any interrupts to be used in the future by the application without having to manually redirect each one in the bootloader.&amp;nbsp; It also keeps the bootloader as small as possible because I don't need those redirect functions.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've implemented a JumpTable.c and h based on his code sample, and it appears to set everything up correctly, but I get a reset due to invalid opcode apparently when an interrupt is called.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I browse the memory after initializing the jump table, I see that the vector table is set up correctly.&lt;/P&gt;&lt;P&gt;Memory:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x0000FFC0&amp;nbsp; FFFFFFFF 1960195D 195A1957 19541951&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x0000FFD0&amp;nbsp; 194E194B&amp;nbsp; 19481945 1942193F 193C1939&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x0000FFE0&amp;nbsp; 19361933&amp;nbsp;&amp;nbsp; 1930192D 192A1927 1921191E&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x0000FFF0&amp;nbsp; 191B1918&amp;nbsp;&amp;nbsp; 19151912 190F190C 1909F0AD&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;0xF0AD is the address of _EntryPoint, and 0x1909 is the start address of the jump table in RAM.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Similarly, the correct jump offsets in RAM have the correct addresses according to the map file.&lt;/P&gt;&lt;P&gt;Memory:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00001940&amp;nbsp; 70FC7DF0 FD1EDF33 CCF069CC EFAFCCF0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00001950&amp;nbsp; 0F4B5CA0 92CAAC54 A0844322&amp;nbsp;&amp;nbsp; 80F0FD34&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;0x1948 has 0xCCF069, where 0xF069 which is AS1_InterruptError&lt;/LI&gt;&lt;LI&gt;0x194B has 0xCCEFAF, where 0xEFAF which is AS1_InterruptRx&lt;/LI&gt;&lt;LI&gt;0x194E has 0xCCF00F, where 0xF00F which is AS1_InterruptTx&lt;/LI&gt;&lt;/UL&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Map file:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AS1_InterruptRx&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; EFAF&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 60&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 96&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; .text&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AS1_InterruptTx&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; F00F&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 90&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; .text&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AS1_InterruptError&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; F069&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 17&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; .text&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _EntryPoint&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; F0AD&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 51&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 81&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp; .text&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Strangely, now that I've cleaned up the code to make it more presentable to post, I don't get the reset, and instead the MCU seems to go off into space.&amp;nbsp; When I switch from using the jump table back to using the standard vector table, it all works fine, and I get proper serial communication.&amp;nbsp; It seems that the problem has something to do with the way the ISRs are called and/or return, but I can't figure it out, so any help is appreciated!&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;-rich&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337744"&gt;JumpTable.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Mar 2014 15:45:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/JM60-Bootloader-with-Interrupts/m-p/298466#M20575</guid>
      <dc:creator>richjones</dc:creator>
      <dc:date>2014-03-18T15:45:39Z</dc:date>
    </item>
  </channel>
</rss>

