<?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: [LPC5536] How to disable offset to flash image 0 from inside image 1</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC5536-How-to-disable-offset-to-flash-image-0-from-inside-image/m-p/1870914#M56128</link>
    <description>&lt;P&gt;Looks like maybe I partially answered my question as I found there is an API call in LPC5536.h&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*! REMAPEN - AHB Bus Address Remap Enable&lt;BR /&gt;* 0b0..HADDR REMAP Disabled&lt;BR /&gt;* 0b1..HADDR REMAP Enabled&lt;BR /&gt;*/&lt;BR /&gt;#define FLEXSPI_HADDRSTART_REMAPEN(x) (((uint32_t)(((uint32_t)(x)) &amp;lt;&amp;lt; FLEXSPI_HADDRSTART_REMAPEN_SHIFT)) &amp;amp; FLEXSPI_HADDRSTART_REMAPEN_MASK)&lt;/P&gt;&lt;P&gt;However, before trying to access Flash 0x0 from a 0x20000 offset&amp;nbsp;is still reading location 0x20000. What else might I be missing?&lt;/P&gt;&lt;P&gt;#define IMAGE_0_ADDRESS 0x00000&lt;BR /&gt;#define IMAGE_1_ADDRESS 0x20000&lt;/P&gt;&lt;P&gt;int compareVersions(void)&lt;BR /&gt;{&lt;BR /&gt;status_t status;&lt;BR /&gt;uint32_t lowerVersion = 0;&lt;BR /&gt;uint32_t upperVersion = 0;&lt;BR /&gt;uint8_t readPage[512];&lt;BR /&gt;&lt;BR /&gt;// Disable offset to ensure image 0 can be read&lt;BR /&gt;FLEXSPI_HADDRSTART_REMAPEN(0) ;&lt;BR /&gt;&lt;BR /&gt;status = FLASH_VerifyErase(&amp;amp;s_flashDriver, IMAGE_0_ADDRESS, 512);&lt;BR /&gt;if(status == kStatus_Success)&lt;BR /&gt;{&lt;BR /&gt;LOG_INFO("\r\nThere is no app installed at location %X\r\n", IMAGE_0_ADDRESS);&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;memcpy(readPage, (uint32_t *)IMAGE_0_ADDRESS, 512);&lt;BR /&gt;lowerVersion = readPage[4+0x20] + (readPage[5+0x20] &amp;lt;&amp;lt; &lt;LI-EMOJI id="lia_smiling-face-with-sunglasses" title=":smiling_face_with_sunglasses:"&gt;&lt;/LI-EMOJI&gt; + (readPage[6+0x20] &amp;lt;&amp;lt; 16);&lt;BR /&gt;LOG_INFO("\r\nApp version %X is installed at location %X\r\n", lowerVersion, IMAGE_0_ADDRESS);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;status = FLASH_VerifyErase(&amp;amp;s_flashDriver, IMAGE_1_ADDRESS, 512);&lt;BR /&gt;if(status == kStatus_Success)&lt;BR /&gt;{&lt;BR /&gt;LOG_INFO("\r\nThere is no app installed at location %X\r\n", IMAGE_1_ADDRESS);&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;memcpy(readPage, (uint32_t *)IMAGE_1_ADDRESS, 512);&lt;BR /&gt;upperVersion = readPage[4+0x20] + (readPage[5+0x20] &amp;lt;&amp;lt; &lt;LI-EMOJI id="lia_smiling-face-with-sunglasses" title=":smiling_face_with_sunglasses:"&gt;&lt;/LI-EMOJI&gt; + (readPage[6+0x20] &amp;lt;&amp;lt; 16);&lt;BR /&gt;LOG_INFO("\r\nApp version %X is installed at location %X\r\n", upperVersion, IMAGE_1_ADDRESS);&lt;BR /&gt;}&lt;BR /&gt;// Reenable offset&lt;BR /&gt;FLEXSPI_HADDRSTART_REMAPEN(1) ;&lt;BR /&gt;return (lowerVersion &amp;gt; upperVersion);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;App version 30400 is installed at location 0&lt;/P&gt;&lt;P&gt;App version 30400 is installed at location 20000&lt;/P&gt;</description>
    <pubDate>Wed, 22 May 2024 15:52:01 GMT</pubDate>
    <dc:creator>bvp</dc:creator>
    <dc:date>2024-05-22T15:52:01Z</dc:date>
    <item>
      <title>[LPC5536] How to disable offset to flash image 0 from inside image 1</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC5536-How-to-disable-offset-to-flash-image-0-from-inside-image/m-p/1870199#M56119</link>
      <description>&lt;P&gt;I am trying to setup updates over CAN Bus from inside the app without using a bootloader. I used the "LPC5536: How to Use Dual Image" tutorial with the&amp;nbsp;flashiap example project to get started and it works great flashing image 1 from inside image 0 over CAN Bus. However, after rebooting into image 1, the offset prevents access to image 0 memory regions preventing me from writing over image 0 for the next update. Reference manual&amp;nbsp;19.3.4.1 makes mention of enabling/disabling the offset via a register but having trouble finding how to implement that if it is at all possible. Is there another way to access flash memory for image 0 from image 1 when the offset is enabled?&amp;nbsp;&lt;/P&gt;&lt;P&gt;CPMA 0x3E230 Config: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 04:36:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC5536-How-to-disable-offset-to-flash-image-0-from-inside-image/m-p/1870199#M56119</guid>
      <dc:creator>bvp</dc:creator>
      <dc:date>2024-05-22T04:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: [LPC5536] How to disable offset to flash image 0 from inside image 1</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC5536-How-to-disable-offset-to-flash-image-0-from-inside-image/m-p/1870914#M56128</link>
      <description>&lt;P&gt;Looks like maybe I partially answered my question as I found there is an API call in LPC5536.h&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*! REMAPEN - AHB Bus Address Remap Enable&lt;BR /&gt;* 0b0..HADDR REMAP Disabled&lt;BR /&gt;* 0b1..HADDR REMAP Enabled&lt;BR /&gt;*/&lt;BR /&gt;#define FLEXSPI_HADDRSTART_REMAPEN(x) (((uint32_t)(((uint32_t)(x)) &amp;lt;&amp;lt; FLEXSPI_HADDRSTART_REMAPEN_SHIFT)) &amp;amp; FLEXSPI_HADDRSTART_REMAPEN_MASK)&lt;/P&gt;&lt;P&gt;However, before trying to access Flash 0x0 from a 0x20000 offset&amp;nbsp;is still reading location 0x20000. What else might I be missing?&lt;/P&gt;&lt;P&gt;#define IMAGE_0_ADDRESS 0x00000&lt;BR /&gt;#define IMAGE_1_ADDRESS 0x20000&lt;/P&gt;&lt;P&gt;int compareVersions(void)&lt;BR /&gt;{&lt;BR /&gt;status_t status;&lt;BR /&gt;uint32_t lowerVersion = 0;&lt;BR /&gt;uint32_t upperVersion = 0;&lt;BR /&gt;uint8_t readPage[512];&lt;BR /&gt;&lt;BR /&gt;// Disable offset to ensure image 0 can be read&lt;BR /&gt;FLEXSPI_HADDRSTART_REMAPEN(0) ;&lt;BR /&gt;&lt;BR /&gt;status = FLASH_VerifyErase(&amp;amp;s_flashDriver, IMAGE_0_ADDRESS, 512);&lt;BR /&gt;if(status == kStatus_Success)&lt;BR /&gt;{&lt;BR /&gt;LOG_INFO("\r\nThere is no app installed at location %X\r\n", IMAGE_0_ADDRESS);&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;memcpy(readPage, (uint32_t *)IMAGE_0_ADDRESS, 512);&lt;BR /&gt;lowerVersion = readPage[4+0x20] + (readPage[5+0x20] &amp;lt;&amp;lt; &lt;LI-EMOJI id="lia_smiling-face-with-sunglasses" title=":smiling_face_with_sunglasses:"&gt;&lt;/LI-EMOJI&gt; + (readPage[6+0x20] &amp;lt;&amp;lt; 16);&lt;BR /&gt;LOG_INFO("\r\nApp version %X is installed at location %X\r\n", lowerVersion, IMAGE_0_ADDRESS);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;status = FLASH_VerifyErase(&amp;amp;s_flashDriver, IMAGE_1_ADDRESS, 512);&lt;BR /&gt;if(status == kStatus_Success)&lt;BR /&gt;{&lt;BR /&gt;LOG_INFO("\r\nThere is no app installed at location %X\r\n", IMAGE_1_ADDRESS);&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;memcpy(readPage, (uint32_t *)IMAGE_1_ADDRESS, 512);&lt;BR /&gt;upperVersion = readPage[4+0x20] + (readPage[5+0x20] &amp;lt;&amp;lt; &lt;LI-EMOJI id="lia_smiling-face-with-sunglasses" title=":smiling_face_with_sunglasses:"&gt;&lt;/LI-EMOJI&gt; + (readPage[6+0x20] &amp;lt;&amp;lt; 16);&lt;BR /&gt;LOG_INFO("\r\nApp version %X is installed at location %X\r\n", upperVersion, IMAGE_1_ADDRESS);&lt;BR /&gt;}&lt;BR /&gt;// Reenable offset&lt;BR /&gt;FLEXSPI_HADDRSTART_REMAPEN(1) ;&lt;BR /&gt;return (lowerVersion &amp;gt; upperVersion);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;App version 30400 is installed at location 0&lt;/P&gt;&lt;P&gt;App version 30400 is installed at location 20000&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 15:52:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC5536-How-to-disable-offset-to-flash-image-0-from-inside-image/m-p/1870914#M56128</guid>
      <dc:creator>bvp</dc:creator>
      <dc:date>2024-05-22T15:52:01Z</dc:date>
    </item>
  </channel>
</rss>

