<?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: Hard-fault on SBL re-entry, Application Note AN12037 (LPC11U6x USB DFU Secondary Bootloader)</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Hard-fault-on-SBL-re-entry-Application-Note-AN12037-LPC11U6x-USB/m-p/853770#M33920</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Concerning the first point, it seems that there is an error in the linker script of the SBL provided in the source code of &lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;AN12037. For re-entry from app, the SBL RAM should start at address 0x10000000 with a length of 0x200 if we follow the recommendation of the doc (Ch. 6). However the linker script set the RAM of the SBL at&amp;nbsp;0x10000200. In "sourcecode/sbl_dfu_lpc11u60/Debug/sbl_dfu_lpc11u6x_Debug_memory.ld":&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;STRONG style="background-color: #ffffff; color: #800080; "&gt;Ram0_32 (rwx) : ORIGIN = &lt;SPAN style="text-decoration: underline;"&gt;0x10000200&lt;/SPAN&gt;, LENGTH = &lt;SPAN style="text-decoration: underline;"&gt;0x7e00&lt;/SPAN&gt; /* 32256 bytes (alias RAM) */&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;This line should probably be:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;STRONG style="background-color: #ffffff; color: #800080; "&gt;Ram0_32 (rwx) : ORIGIN = &lt;SPAN style="color: #ff0000;"&gt;0x10000000&lt;/SPAN&gt;, LENGTH = &lt;SPAN style="color: #ff0000;"&gt;0x200&lt;/SPAN&gt; /* &lt;SPAN style="color: #ff0000;"&gt;512&lt;/SPAN&gt; bytes (alias RAM) &lt;SPAN style="color: #ff0000;"&gt;for SBL&lt;/SPAN&gt; */&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Also, the symbols "__base_Ram0_32", "__base_RAM", "__top_Ram0_32" and "__top_RAM" must be changed accordingly.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Note that the linker script in the Release configuration seems also erroneous.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 29 Mar 2019 09:02:27 GMT</pubDate>
    <dc:creator>d_m_</dc:creator>
    <dc:date>2019-03-29T09:02:27Z</dc:date>
    <item>
      <title>Hard-fault on SBL re-entry, Application Note AN12037 (LPC11U6x USB DFU Secondary Bootloader)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Hard-fault-on-SBL-re-entry-Application-Note-AN12037-LPC11U6x-USB/m-p/853769#M33919</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;This post reports two problems we identified with the integration of a secondary bootloader (SBL) for firmware updates on a LPC11U68. We followed the application note AN12037 (LPC11U6x USB DFU Secondary Bootloader, Rev. 1 – September 2017), and performed tests with the development board OM13058 (LPC11U68 development board, Xpresso v2 rev. C, OM13058), and MCUXPresso IDE 10.0.0.&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;Note: &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/ZhangJennie" rel="nofollow noopener noreferrer" target="_blank"&gt;ZhangJennie&lt;/A&gt; This is the second post we made on the SBL described in AN12037. The first post concerned the creation of a factory image: &lt;A href="https://community.nxp.com/message/1126369" rel="nofollow noopener noreferrer" target="_blank"&gt;How to create a non-encrypted factory image with custom secondary bootloader on LPC11U68&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Problem 1: &lt;SPAN style="color: #993300;"&gt;The SBL re-entry code generates a hard-fault when some big-enough static variables are defined in the application. Hence the SBL cannot be invoked from the application and become useless.&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;The problem is quite easy to reproduce from the code provided with the AN12037 and the development board OM13058. Here are the steps:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Import the source code of AN12037 in MCUXpresso containing four projects: “app_blinky”, “lpc_board_nxp_lpcxpresso_11u68”, “lpc_chip_11u6x”, and “sbl_dfu_lpc11u60”.&lt;/LI&gt;&lt;LI&gt;Erase the flash of the development board to be sure that there is no remaining application in image "slots".&lt;/LI&gt;&lt;LI&gt;Build the “sbl_dfu_lpc11u60” and program the SBL to the development board (via LinkServer or using the primary bootloader).&lt;/LI&gt;&lt;LI&gt;In the project “app_blinky”, in the file “app_blinky.c” add an array declaration outside any function and a reference to this array in the main (to avoid optimization):&lt;/LI&gt;&lt;/UL&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;// ...&lt;/SPAN&gt;
uint8_t buffer&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;256&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;// This must be added at Line 28&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// ...&lt;/SPAN&gt;
buffer&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;// This must be added at Line 129&lt;/SPAN&gt;
&lt;SPAN class="comment 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;/CODE&gt;&lt;/PRE&gt;&lt;UL&gt;&lt;LI&gt;Build the “app_blinky” application and create a binary. Add a CRC to the binary using “lpc11xx_secimgcr.exe”:&lt;/LI&gt;&lt;/UL&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;lpc11xx_secimgcr.exe app_blinky.bin app_blinky.dfu&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;UL&gt;&lt;LI&gt;Load “app_blinky.dfu” using “dfu-util.exe” (via USB connected to “Target” on the development board):&lt;/LI&gt;&lt;/UL&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;dfu-util.exe -t 64 -D app_blinky.dfu&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;UL&gt;&lt;LI&gt;The application will boot, then after 10 seconds, the application reinvokes the SBL and the SBL will crash,i.e. call to hard-fault handler.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;It seems that the SBL crashes when “SystemCoreClockUpdate()” is called in “main_dfu.c” line 250. It may be due to the AEABI division patch, or a problem with the BSS section.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Problem 2: &lt;SPAN style="color: #993300;"&gt;It seems that there is no “dynamic” management of the “dual-image” feature. Using “dfu-util.exe” to update the application with a binary, whatever the new application version is, it will be placed in the first application space (starting from 0x2000).&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;BR /&gt;To what I understand, the dual image feature should protect from firmware update failure. That is, when the most recent application resides in the image slot 1, the SBL will use the slot 2 to download the new firmware and vice versa. It is only when a new application as been completely downloaded with a correct CRC and a more recent version number, that the SBL will boot it. That is not how the proposed SBL in AN12037 works.&lt;BR /&gt;Hence my question; how should the “dual-image” feature work?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again, thanks for your support.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Mar 2019 13:59:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Hard-fault-on-SBL-re-entry-Application-Note-AN12037-LPC11U6x-USB/m-p/853769#M33919</guid>
      <dc:creator>d_m_</dc:creator>
      <dc:date>2019-03-26T13:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: Hard-fault on SBL re-entry, Application Note AN12037 (LPC11U6x USB DFU Secondary Bootloader)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Hard-fault-on-SBL-re-entry-Application-Note-AN12037-LPC11U6x-USB/m-p/853770#M33920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Concerning the first point, it seems that there is an error in the linker script of the SBL provided in the source code of &lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;AN12037. For re-entry from app, the SBL RAM should start at address 0x10000000 with a length of 0x200 if we follow the recommendation of the doc (Ch. 6). However the linker script set the RAM of the SBL at&amp;nbsp;0x10000200. In "sourcecode/sbl_dfu_lpc11u60/Debug/sbl_dfu_lpc11u6x_Debug_memory.ld":&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;STRONG style="background-color: #ffffff; color: #800080; "&gt;Ram0_32 (rwx) : ORIGIN = &lt;SPAN style="text-decoration: underline;"&gt;0x10000200&lt;/SPAN&gt;, LENGTH = &lt;SPAN style="text-decoration: underline;"&gt;0x7e00&lt;/SPAN&gt; /* 32256 bytes (alias RAM) */&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;This line should probably be:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;STRONG style="background-color: #ffffff; color: #800080; "&gt;Ram0_32 (rwx) : ORIGIN = &lt;SPAN style="color: #ff0000;"&gt;0x10000000&lt;/SPAN&gt;, LENGTH = &lt;SPAN style="color: #ff0000;"&gt;0x200&lt;/SPAN&gt; /* &lt;SPAN style="color: #ff0000;"&gt;512&lt;/SPAN&gt; bytes (alias RAM) &lt;SPAN style="color: #ff0000;"&gt;for SBL&lt;/SPAN&gt; */&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Also, the symbols "__base_Ram0_32", "__base_RAM", "__top_Ram0_32" and "__top_RAM" must be changed accordingly.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Note that the linker script in the Release configuration seems also erroneous.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Mar 2019 09:02:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Hard-fault-on-SBL-re-entry-Application-Note-AN12037-LPC11U6x-USB/m-p/853770#M33920</guid>
      <dc:creator>d_m_</dc:creator>
      <dc:date>2019-03-29T09:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: Hard-fault on SBL re-entry, Application Note AN12037 (LPC11U6x USB DFU Secondary Bootloader)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Hard-fault-on-SBL-re-entry-Application-Note-AN12037-LPC11U6x-USB/m-p/853771#M33921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;Thanks. I will feedback this to the author.&lt;/P&gt;&lt;P&gt;Regarding to the dual image. They are in different flash locations. SBL checks the header and version numbers. If both the information is valid for SBL, SBL selects the newest version image as the active application. In the case if this version of application image gets corrupt, the other application can still work as a backup.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jun Zhang.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Apr 2019 09:27:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Hard-fault-on-SBL-re-entry-Application-Note-AN12037-LPC11U6x-USB/m-p/853771#M33921</guid>
      <dc:creator>ZhangJennie</dc:creator>
      <dc:date>2019-04-08T09:27:57Z</dc:date>
    </item>
  </channel>
</rss>

