<?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のトピックLPC55S69 firmware update via ROM API error 0x2775</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S69-firmware-update-via-ROM-API-error-0x2775/m-p/1694059#M53610</link>
    <description>&lt;P&gt;I'm trying to implement firmware update using the ROM API but having problems with it.&lt;/P&gt;&lt;P&gt;I have read section 7.3.6 from UM11126 and the attached ROM_API.pdf and as far as I can tell everything should work fine but it does not.&lt;/P&gt;&lt;P&gt;In the attached code below, I'm receiving the image.sb in small pieces and executing them just like in the example in ROM_API.pdf. However, I get &lt;EM&gt;kStatusRomLdrSignature&lt;/EM&gt; (0x2775) error. This sounds like the image is not valid but I have built it with MCUXpresso Secure Provisioning tool and if I use the following blhost command when in ISP mode, the image is flashed just fine and boots:&lt;/P&gt;&lt;PRE&gt;blhost -t 240000 -p /dev/ttyACM0,57600 -- receive-sb-file /home/henrik/secure_provisioning/bootable_images/image.sb&lt;/PRE&gt;&lt;P&gt;Thus, I don't think the image can be the problem.&lt;/P&gt;&lt;P&gt;Image update code on LPC55S69:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;    status_t status;
    kb_session_ref_t *session = NULL;

    uint32_t kKbootApiVersion = 1u;
    uint8_t certBuffer[(4096+432)*2] = { 0 };

    kb_options_t options = {
        .version = kKbootApiVersion,
        .buffer = certBuffer, //array defined by user
        .bufferLength = (4096+432)*2, // defined by user
        .op = kRomLoadImage, //used for IAP feature
        {
            .loadSB = {
                .profile = 0,  // Also tried kKbootMinRSA4096
                .minBuildNumber = 1,  // Tried 0 too
                .overrideSBBootSectionID = 1, // And here 0 too
                .userSBKEK = NULL, //Set Null then IFR SBKEK will be used
                .regionCount = 0,
                .regions = NULL, // If regions is NULL, all memory is accessible by the SB file
            },
        }
    };

    status = kb_init(&amp;amp;session, &amp;amp;options);

    if (status == kStatus_Success) {
        uint8_t imageBuffer[1024];

        while(1) {
            // Receive 1024 byte pieces of image.sb file to imageBuffer
            ...

            // Execute chunk
            status = kb_execute(session, imageBuffer, 1024);

            // Check return
            if (status == kStatus_RomApiNeedMoreData) {
                // Ask host for more data
                ...
                continue;
            } else if(status == kStatus_RomApiExecuteCompleted) {
                // Signal end to host
                ...
                break;
            } else {
                // Report error to host
                ...
                break;
            }
        };
    }
    status_t statusdeinit = kb_deinit(session);
    return status | statusdeinit;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The part I'm the most unsure about is &lt;EM&gt;kb_options_t&lt;/EM&gt;. I have tried couple different options without any success and these are from ROM_API.pdf example so I assume they should work.&lt;/P&gt;&lt;P&gt;I have verified that the image pieces that I send are received correctly so that's not the problem.&lt;/P&gt;&lt;P&gt;This is the C API I'm using &lt;A href="https://github.com/zephyrproject-rtos/hal_nxp" target="_blank" rel="noopener"&gt;https://github.com/zephyrproject-rtos/hal_nxp&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Thu, 27 Jul 2023 09:38:55 GMT</pubDate>
    <dc:creator>HenrikK</dc:creator>
    <dc:date>2023-07-27T09:38:55Z</dc:date>
    <item>
      <title>LPC55S69 firmware update via ROM API error 0x2775</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S69-firmware-update-via-ROM-API-error-0x2775/m-p/1694059#M53610</link>
      <description>&lt;P&gt;I'm trying to implement firmware update using the ROM API but having problems with it.&lt;/P&gt;&lt;P&gt;I have read section 7.3.6 from UM11126 and the attached ROM_API.pdf and as far as I can tell everything should work fine but it does not.&lt;/P&gt;&lt;P&gt;In the attached code below, I'm receiving the image.sb in small pieces and executing them just like in the example in ROM_API.pdf. However, I get &lt;EM&gt;kStatusRomLdrSignature&lt;/EM&gt; (0x2775) error. This sounds like the image is not valid but I have built it with MCUXpresso Secure Provisioning tool and if I use the following blhost command when in ISP mode, the image is flashed just fine and boots:&lt;/P&gt;&lt;PRE&gt;blhost -t 240000 -p /dev/ttyACM0,57600 -- receive-sb-file /home/henrik/secure_provisioning/bootable_images/image.sb&lt;/PRE&gt;&lt;P&gt;Thus, I don't think the image can be the problem.&lt;/P&gt;&lt;P&gt;Image update code on LPC55S69:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;    status_t status;
    kb_session_ref_t *session = NULL;

    uint32_t kKbootApiVersion = 1u;
    uint8_t certBuffer[(4096+432)*2] = { 0 };

    kb_options_t options = {
        .version = kKbootApiVersion,
        .buffer = certBuffer, //array defined by user
        .bufferLength = (4096+432)*2, // defined by user
        .op = kRomLoadImage, //used for IAP feature
        {
            .loadSB = {
                .profile = 0,  // Also tried kKbootMinRSA4096
                .minBuildNumber = 1,  // Tried 0 too
                .overrideSBBootSectionID = 1, // And here 0 too
                .userSBKEK = NULL, //Set Null then IFR SBKEK will be used
                .regionCount = 0,
                .regions = NULL, // If regions is NULL, all memory is accessible by the SB file
            },
        }
    };

    status = kb_init(&amp;amp;session, &amp;amp;options);

    if (status == kStatus_Success) {
        uint8_t imageBuffer[1024];

        while(1) {
            // Receive 1024 byte pieces of image.sb file to imageBuffer
            ...

            // Execute chunk
            status = kb_execute(session, imageBuffer, 1024);

            // Check return
            if (status == kStatus_RomApiNeedMoreData) {
                // Ask host for more data
                ...
                continue;
            } else if(status == kStatus_RomApiExecuteCompleted) {
                // Signal end to host
                ...
                break;
            } else {
                // Report error to host
                ...
                break;
            }
        };
    }
    status_t statusdeinit = kb_deinit(session);
    return status | statusdeinit;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The part I'm the most unsure about is &lt;EM&gt;kb_options_t&lt;/EM&gt;. I have tried couple different options without any success and these are from ROM_API.pdf example so I assume they should work.&lt;/P&gt;&lt;P&gt;I have verified that the image pieces that I send are received correctly so that's not the problem.&lt;/P&gt;&lt;P&gt;This is the C API I'm using &lt;A href="https://github.com/zephyrproject-rtos/hal_nxp" target="_blank" rel="noopener"&gt;https://github.com/zephyrproject-rtos/hal_nxp&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2023 09:38:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S69-firmware-update-via-ROM-API-error-0x2775/m-p/1694059#M53610</guid>
      <dc:creator>HenrikK</dc:creator>
      <dc:date>2023-07-27T09:38:55Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S69 firmware update via ROM API error 0x2775</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S69-firmware-update-via-ROM-API-error-0x2775/m-p/1696172#M53664</link>
      <description>&lt;P class="lia-align-justify"&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/216928"&gt;@HenrikK&lt;/a&gt;,&lt;/P&gt;
&lt;P class="lia-align-justify"&gt;Just for double check, could you please try using another image? Is the same issue happening?&lt;/P&gt;
&lt;P class="lia-align-justify"&gt;Also, the code you are sharing have some differences with the ROM_API.pdf example? Could you please try using the configuration of the Section 3.1.3. Create application project for the IAP APIs call's Example (pp.10-12)?&lt;/P&gt;
&lt;P class="lia-align-justify"&gt;Best regards, Raul.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2023 22:39:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S69-firmware-update-via-ROM-API-error-0x2775/m-p/1696172#M53664</guid>
      <dc:creator>RaRo</dc:creator>
      <dc:date>2023-07-31T22:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S69 firmware update via ROM API error 0x2775</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S69-firmware-update-via-ROM-API-error-0x2775/m-p/1696479#M53669</link>
      <description>&lt;P&gt;This is not image specific, happens with any image.&lt;/P&gt;&lt;P&gt;Could you be bit more specific about the differences? To me the code looks functionally same. There's just few small differences but I think they are errors in the ROM_API.pdf or differences in hal_nxp that I linked. For example .userSBKEK should be a pointer (really NULL and 0 are the same anyway) and kb_execute takes just a pointer to buf, not pointer of a pointer.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2023 07:47:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S69-firmware-update-via-ROM-API-error-0x2775/m-p/1696479#M53669</guid>
      <dc:creator>HenrikK</dc:creator>
      <dc:date>2023-08-01T07:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55S69 firmware update via ROM API error 0x2775</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S69-firmware-update-via-ROM-API-error-0x2775/m-p/1702243#M53809</link>
      <description>&lt;P class="lia-align-justify"&gt;Hello &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/216928"&gt;@HenrikK&lt;/a&gt;,&lt;/P&gt;
&lt;P class="lia-align-justify"&gt;First of all, we apologize for the delay to answer you.&lt;/P&gt;
&lt;P class="lia-align-justify"&gt;Could you please try using the same buffer for &lt;EM&gt;kb_options (.buffer)&lt;/EM&gt; and &lt;EM&gt;kb_execute &lt;/EM&gt;in&amp;nbsp;your code?&lt;/P&gt;
&lt;P class="lia-align-justify"&gt;Also, could you please take a look at the following information?&lt;/P&gt;
&lt;UL class="lia-align-justify" type="disc"&gt;
&lt;LI&gt;&lt;A href="https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S69-Secure-Boot-Failing/m-p/1017760" target="_blank"&gt;LPC55S69 Secure Boot Failing - NXP Community&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://community.nxp.com/t5/LPC-Microcontrollers/Secure-boot-pakcage-on-LPC55S69/m-p/983247" target="_blank"&gt;Secure boot package on LPC55S69? - NXP Community&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://community.nxp.com/t5/LPC-Microcontrollers-Knowledge/LPC55S6x-SB-File-Preparation-and-Usage-on-LPC55S6x-1B-Version/ta-p/1113520" target="_blank"&gt;[LPC55S6x] SB File Preparation and Usage on LPC55S... - NXP Community&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P class="lia-align-justify"&gt;Best regards, Raul.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2023 18:29:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55S69-firmware-update-via-ROM-API-error-0x2775/m-p/1702243#M53809</guid>
      <dc:creator>RaRo</dc:creator>
      <dc:date>2023-08-09T18:29:47Z</dc:date>
    </item>
  </channel>
</rss>

