how to check image CRC

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

how to check image CRC

Jump to solution
2,065 Views
victorchiou
Contributor I

I have an image built using the MCUXpresso Secure Provisioning Tool.

It's a plain image with a CRC,
and the offsetToExtendedHeader field(address 0x00000028) contains the 4bytes CRC checksum value.

victorchiou_1-1720002177605.png

 

Now, I want to check the CRC before writing it to flash.
I tried to calculate it using these settings,
but I cannot match the CRC with the offsetToExtendedHeader field.
victorchiou_0-1720001430811.png
(ref: Kinetis Bootloader v2.0.0 Reference Manual)

Is there any tool available to calculate the image CRC (like nxpimage and blhost)? Alternatively, where can I find more details about calculate the image CRC?

Labels (2)
0 Kudos
Reply
1 Solution
2,054 Views
marek-trmac
NXP Employee
NXP Employee

Hi Victor,

SEC tool uses SPSDK application nxpimage to build a CRC bootable image. You can see generated build script to find, how the nxpimage tool is used.

See main menu > Help > SPSDK Online Documentation for nxpimage documentation.

SPSDK is opensource, so you can find implementation details in GitHub.

Regards,
Marek


NOTE: If you find the answer useful, kindly click on [ACCEPT AS SOLUTION] button

View solution in original post

2 Replies
2,022 Views
victorchiou
Contributor I

Hi Marek


I found the Mbi_ExportMixinCrcSign function
and the CRC algorithm in the nxpimage tool, which is part of SPSDK.

victorchiou_0-1720086599812.png

Based on the above algorithm,
I created a python program to verify the image CRC,
and it works.

Thanks for your support.

0 Kudos
Reply
2,055 Views
marek-trmac
NXP Employee
NXP Employee

Hi Victor,

SEC tool uses SPSDK application nxpimage to build a CRC bootable image. You can see generated build script to find, how the nxpimage tool is used.

See main menu > Help > SPSDK Online Documentation for nxpimage documentation.

SPSDK is opensource, so you can find implementation details in GitHub.

Regards,
Marek


NOTE: If you find the answer useful, kindly click on [ACCEPT AS SOLUTION] button
%3CLINGO-SUB%20id%3D%22lingo-sub-1898325%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Ehow%20to%20check%20image%20CRC%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1898325%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20have%20an%20image%20built%20using%20the%20MCUXpresso%20Secure%20Provisioning%20Tool.%3C%2FP%3E%3CP%3EIt's%20a%20plain%20image%20with%20a%20CRC%2C%3CBR%20%2F%3Eand%20the%20%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3EoffsetToExtendedHeader%20%3C%2FFONT%3Efield(address%200x00000028)%20contains%20the%204bytes%20CRC%20checksum%20value.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22victorchiou_1-1720002177605.png%22%20style%3D%22width%3A%20656px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22victorchiou_1-1720002177605.png%22%20style%3D%22width%3A%20656px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F286883i145A13AB73166953%2Fimage-dimensions%2F656x115%3Fv%3Dv2%22%20width%3D%22656%22%20height%3D%22115%22%20role%3D%22button%22%20title%3D%22victorchiou_1-1720002177605.png%22%20alt%3D%22victorchiou_1-1720002177605.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3ENow%2C%20I%20want%20to%20check%20the%20CRC%20before%20writing%20it%20to%20flash.%3CBR%20%2F%3EI%20tried%20to%20calculate%20it%20using%20these%20settings%2C%3CBR%20%2F%3Ebut%20I%20cannot%20match%20the%20CRC%20with%20the%20%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3EoffsetToExtendedHeader%3C%2FFONT%3E%20field.%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22victorchiou_0-1720001430811.png%22%20style%3D%22width%3A%20532px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22victorchiou_0-1720001430811.png%22%20style%3D%22width%3A%20532px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F286864i6EFC0688DB869C2C%2Fimage-dimensions%2F532x105%3Fv%3Dv2%22%20width%3D%22532%22%20height%3D%22105%22%20role%3D%22button%22%20title%3D%22victorchiou_0-1720001430811.png%22%20alt%3D%22victorchiou_0-1720001430811.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22%22%3E(ref%3A%20Kinetis%20Bootloader%20v2.0.0%20Reference%20Manual%3C%2FSPAN%3E)%3C%2FP%3E%3CP%3EIs%20there%20any%20tool%20available%20to%20calculate%20the%20image%20CRC%20(like%20nxpimage%20and%20blhost)%3F%20Alternatively%2C%20where%20can%20I%20find%20more%20details%20about%20calculate%20the%20image%20CRC%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1898325%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EBoot%20ROM%7CBooting%20%7C%20Flash%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMCXA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1899456%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%20how%20to%20check%20image%20CRC%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1899456%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Marek%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EI%20found%20the%20%3CFONT%20face%3D%22courier%20new%2Ccourier%22%20color%3D%22%230000FF%22%3EMbi_ExportMixinCrcSign%3C%2FFONT%3E%26nbsp%3Bfunction%3CBR%20%2F%3Eand%20the%20CRC%20algorithm%20in%20the%20nxpimage%20tool%2C%20which%20is%20part%20of%20SPSDK.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22victorchiou_0-1720086599812.png%22%20style%3D%22width%3A%20679px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22victorchiou_0-1720086599812.png%22%20style%3D%22width%3A%20679px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F287093i48832B46785A3261%2Fimage-dimensions%2F679x449%3Fv%3Dv2%22%20width%3D%22679%22%20height%3D%22449%22%20role%3D%22button%22%20title%3D%22victorchiou_0-1720086599812.png%22%20alt%3D%22victorchiou_0-1720086599812.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EBased%20on%20the%20above%20algorithm%2C%3CBR%20%2F%3EI%20created%20a%20python%20program%20to%20verify%20the%20image%20CRC%2C%3CBR%20%2F%3Eand%20it%20works.%3C%2FP%3E%3CP%3EThanks%20for%20your%20support.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1898394%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20how%20to%20check%20image%20CRC%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1898394%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Victor%2C%3C%2FP%3E%0A%3CP%3ESEC%20tool%20uses%20SPSDK%20application%20nxpimage%20to%20build%20a%20CRC%20bootable%20image.%20You%20can%20see%20generated%20build%20script%20to%20find%2C%20how%20the%20nxpimage%20tool%20is%20used.%3C%2FP%3E%0A%3CP%3ESee%20%3CSTRONG%3Emain%20menu%20%26gt%3B%20Help%20%26gt%3B%20SPSDK%20Online%20Documentation%3C%2FSTRONG%3E%20for%20nxpimage%20documentation.%3C%2FP%3E%0A%3CP%3ESPSDK%20is%20opensource%2C%20so%20you%20can%20find%20implementation%20details%20in%20GitHub.%3C%2FP%3E%3C%2FLINGO-BODY%3E