LPC55S69 firmware update via ROM API error 0x2775

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC55S69 firmware update via ROM API error 0x2775

1,092 Views
HenrikK
Contributor II

I'm trying to implement firmware update using the ROM API but having problems with it.

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.

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 kStatusRomLdrSignature (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:

blhost -t 240000 -p /dev/ttyACM0,57600 -- receive-sb-file /home/henrik/secure_provisioning/bootable_images/image.sb

Thus, I don't think the image can be the problem.

Image update code on LPC55S69:

 

    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(&session, &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;

 

The part I'm the most unsure about is kb_options_t. I have tried couple different options without any success and these are from ROM_API.pdf example so I assume they should work.

I have verified that the image pieces that I send are received correctly so that's not the problem.

This is the C API I'm using https://github.com/zephyrproject-rtos/hal_nxp.

Labels (1)
Tags (2)
0 Kudos
Reply
3 Replies

1,068 Views
RaRo
NXP TechSupport
NXP TechSupport

Hello @HenrikK,

Just for double check, could you please try using another image? Is the same issue happening?

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)?

Best regards, Raul.

0 Kudos
Reply

1,033 Views
HenrikK
Contributor II

This is not image specific, happens with any image.

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.

0 Kudos
Reply

989 Views
RaRo
NXP TechSupport
NXP TechSupport

Hello @HenrikK,

First of all, we apologize for the delay to answer you.

Could you please try using the same buffer for kb_options (.buffer) and kb_execute in your code?

Also, could you please take a look at the following information?

Best regards, Raul.

0 Kudos
Reply