<?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: Internal flash dual image boot on LPC5536 in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Internal-flash-dual-image-boot-on-LPC5536/m-p/1600906#M51663</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/200480"&gt;@EnBono&lt;/a&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I made a dual image test on my side, it can works well. I used led_blinky demo under SDK, default led is RED, use this as image0, version is "1",&lt;/SPAN&gt;&lt;SPAN&gt;start from 0x00, then change RED LED to BLUE LED, start from 0x20000, as image 1, version is "2".&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Use blhost&amp;nbsp; program CMPA.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;About projects, .bin files and cmpa.bin, please see attachment.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;BR&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Alice&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 17 Feb 2023 06:41:15 GMT</pubDate>
    <dc:creator>Alice_Yang</dc:creator>
    <dc:date>2023-02-17T06:41:15Z</dc:date>
    <item>
      <title>Internal flash dual image boot on LPC5536</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Internal-flash-dual-image-boot-on-LPC5536/m-p/1589897#M51441</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to implement the internal flash dual image boot on LPC5536 using IAR.&lt;/P&gt;&lt;P&gt;First of all let me know if i understand well how it works: Let's consider figure 86, chapter&amp;nbsp;26.3.1.1.1.1 of&amp;nbsp;of LPC553x Reference Manual, and let's assume that header of image0 contains an image version 0, and header of image1 contains an image version 1. At startup ROM checks both headers and since image1 has an higher image version, image1 is run. Correct?&lt;/P&gt;&lt;P&gt;In LPC5536 the total size of the flash is 0x3DC00, so dividing it by 2, each block will have size 0x1EE00&lt;/P&gt;&lt;P&gt;First thing to do is to change the CMPA fields FLASH_REMAP_SIZE and&amp;nbsp;FLASH_REMAP_OFFSET to match the 0x1EE00 block size.&lt;/P&gt;&lt;P&gt;To access CMPA, i used functions from fsl_flash_ffr.h, named&amp;nbsp;FFR_GetCustomerData and&amp;nbsp;FFR_CustFactoryPageWrite. In particular, after calling&amp;nbsp;FLASH_Init and&amp;nbsp;FFR_Init, I use these functions as follows:&lt;/P&gt;&lt;P&gt;static cmpa_cfg_info_t cmpa;&lt;/P&gt;&lt;P&gt;status = FFR_GetCustomerData(&amp;amp;s_flashDriver,(uint8_t *)&amp;amp;cmpa,0,512);&lt;BR /&gt;if (status != kStatus_Success)&lt;BR /&gt;{&lt;BR /&gt;error_trap();&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;cmpa.flashRemapSize = 0x1EDFF;&lt;BR /&gt;cmpa.flashRemapOffset = 0x1EE00;&lt;BR /&gt;&lt;BR /&gt;status = FFR_CustFactoryPageWrite(&amp;amp;s_flashDriver,(uint8_t *)&amp;amp;cmpa,false);&lt;BR /&gt;if (status != kStatus_Success)&lt;BR /&gt;{&lt;BR /&gt;error_trap();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;This part of code seems to work without particular problems.&lt;/P&gt;&lt;P&gt;Second thing to do is to produce image with version number in the header; to achive this, i change the "startup_LPC55S36.s" file as follows:&lt;/P&gt;&lt;P&gt;__vector_table&lt;BR /&gt;DCD sfe(CSTACK)&lt;BR /&gt;DCD Reset_Handler&lt;/P&gt;&lt;P&gt;DCD NMI_Handler&lt;BR /&gt;DCD HardFault_Handler&lt;BR /&gt;DCD MemManage_Handler&lt;BR /&gt;DCD BusFault_Handler&lt;BR /&gt;DCD UsageFault_Handler&lt;BR /&gt;__vector_table_0x1c&lt;BR /&gt;DCD SecureFault_Handler&lt;BR /&gt;DCD 0x1EDFF&lt;BR /&gt;DCD 0x10400&lt;BR /&gt;DCD 0&lt;BR /&gt;DCD SVC_Handler&lt;BR /&gt;DCD DebugMon_Handler&lt;BR /&gt;DCD 0&lt;BR /&gt;DCD PendSV_Handler&lt;BR /&gt;DCD SysTick_Handler&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;In this way, using&amp;nbsp;0x10400 i produce an image with version number 1, using&amp;nbsp;0x20400 i produce&amp;nbsp;an image with version number 2 and so on.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I completed the example application turning on a blue LED in image0 and a red LED in image1.&lt;/P&gt;&lt;P&gt;From IAR options i created a srec file filling unused memory with 0xFF until address 0x1EDFF, and i used ISP functions to write the images into flash.&lt;/P&gt;&lt;P&gt;The problem is that regardless of the image version, the only image loaded at startup is image0.&lt;/P&gt;&lt;P&gt;So the question is can you help me to spot the mistake in this code and to implement the dual image boot correctly?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Enrico&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 15:40:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Internal-flash-dual-image-boot-on-LPC5536/m-p/1589897#M51441</guid>
      <dc:creator>EnBono</dc:creator>
      <dc:date>2023-01-30T15:40:16Z</dc:date>
    </item>
    <item>
      <title>Re: Internal flash dual image boot on LPC5536</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Internal-flash-dual-image-boot-on-LPC5536/m-p/1590386#M51460</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/200480"&gt;@EnBono&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1)&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;First of all let me know if i understand well how it works: Let's consider figure 86, chapter&amp;nbsp;26.3.1.1.1.1 of&amp;nbsp;of LPC553x Reference Manual, and let's assume that header of image0 contains an image version 0, and header of image1 contains an image version 1. At startup ROM checks both headers and since image1 has an higher image version, image1 is run. Correct?&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;-&amp;gt;&amp;gt; Yes.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;2) How about refer to Fig86 to remap?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) Please read out memory after program, check whether program the two images correct.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Alice&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 08:13:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Internal-flash-dual-image-boot-on-LPC5536/m-p/1590386#M51460</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2023-01-31T08:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: Internal flash dual image boot on LPC5536</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Internal-flash-dual-image-boot-on-LPC5536/m-p/1590499#M51461</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/27788"&gt;@Alice_Yang&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;2)&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;How about refer to Fig86 to remap?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;-&amp;gt;&amp;gt; I produced something similar. Reading out the memory after programming, it can be seen that there is a first image from 0x0 to 0x1EDFF (the real image is from 0x0 to 0x2EE1, the rest of the image is filled with 0xFF), and there is a second image from 0x1EE00 to 0x3DBFF (the real image&amp;nbsp;is from 0x1EE00 to 0x21CE1, the rest of the image is filled with 0xFF)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3)&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;Please read out memory after program, check whether program the two images correct.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;-&amp;gt;&amp;gt; I read out the memory and the images are exactly the same contained in srecord files.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Using bootloader, i tried to read the property "Check Status", and i got&amp;nbsp;10403 code (0x28A3) which should mean "Application CRC check is invalid". However i'm trying to use a plain image without CRC.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Moreover, when building the image1 in IAR, i keep "transparent" that this will be placed in memory with an offset. This means that the image is build exatcly as image 0, and when i write it into flash, i add an offset to the addresses (for example srecord address 0 will be placed in 0x1EE00, srecord address 0x10 wil be placed in 0x1EE10 and so on). Is it correct?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Enrico&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 10:28:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Internal-flash-dual-image-boot-on-LPC5536/m-p/1590499#M51461</guid>
      <dc:creator>EnBono</dc:creator>
      <dc:date>2023-01-31T10:28:33Z</dc:date>
    </item>
    <item>
      <title>Re: Internal flash dual image boot on LPC5536</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Internal-flash-dual-image-boot-on-LPC5536/m-p/1600906#M51663</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/200480"&gt;@EnBono&lt;/a&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I made a dual image test on my side, it can works well. I used led_blinky demo under SDK, default led is RED, use this as image0, version is "1",&lt;/SPAN&gt;&lt;SPAN&gt;start from 0x00, then change RED LED to BLUE LED, start from 0x20000, as image 1, version is "2".&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Use blhost&amp;nbsp; program CMPA.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;About projects, .bin files and cmpa.bin, please see attachment.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;BR&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Alice&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 06:41:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Internal-flash-dual-image-boot-on-LPC5536/m-p/1600906#M51663</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2023-02-17T06:41:15Z</dc:date>
    </item>
  </channel>
</rss>

