[S32K3] flash image compression and decompression

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

[S32K3] flash image compression and decompression

Jump to solution
384 Views
Changhawn
Contributor III

Dear NXP guy.

I am developing bootloader in S32K3.

And currently Application image SREC file size is over 4MB.

I have two questions.

1. I am curious about is that the test is performed normally by burning it to Debug flash, so there is no problem with the capacity,

and it seems to be the SREC overhead included in the image. If I do not compress it, will there be a problem when burning it to flash?

2. Is there an example project or reference document that burns an application image in srec format and decompresses it when loading?

If the actual compiled size is over 4MB and the decompression time is not a problem, I would like to use it.

Thank you.
Chang.

0 Kudos
Reply
1 Solution
359 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @Changhawn 

Srecord format adds relatively high overhead to raw data.

Here you can find the format description:
https://en.wikipedia.org/wiki/SREC_(file_format)

S32 Design Studio generates S2 record file and the payload is usually 16 bytes. Each byte needs two ASCII characters, so it takes 32 characters in each record.
Then there's 'S2' marking, size of record, address and checksum. This takes another 12 characters.
If you have 4MB srecord file, the payload is about 3MB. And because each byte needs two ASCII characters as mentioned above, the real size of payload is 1.5MB.

An option is to use pure binary file. If it is continuous image, it would have only those 1.5MB. If there are some empty gaps (blank space without useful data) in the image, it could increase the size of file, of course. But that's the nature of binary files.

My understanding is that you are working on bootloader, right?
There are some application notes which shows how to write a bootloader and how to parse s-record files (these not directly for S32K3 but you can take a look):

S32K1xx Bootloader:
https://www.nxp.com/docs/en/application-note/AN12218.pdf
https://www.nxp.com/docs/en/application-note-software/AN12218SW.zip

Serial bootloader for MPC5748G:
https://www.nxp.com/docs/en/application-note/AN5319.pdf
https://www.nxp.com/docs/en/application-note-software/AN5319SW.zip

 

For S32K3, we have only a demo of UDS bootloader
https://community.nxp.com/t5/S32K-Knowledge-Base/Unified-bootloader-Demo/ta-p/1423099
However, please notice that this is a demo only provided AS IS with no support. It’s not production code.

Regards,
Lukas

View solution in original post

0 Kudos
Reply
1 Reply
360 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @Changhawn 

Srecord format adds relatively high overhead to raw data.

Here you can find the format description:
https://en.wikipedia.org/wiki/SREC_(file_format)

S32 Design Studio generates S2 record file and the payload is usually 16 bytes. Each byte needs two ASCII characters, so it takes 32 characters in each record.
Then there's 'S2' marking, size of record, address and checksum. This takes another 12 characters.
If you have 4MB srecord file, the payload is about 3MB. And because each byte needs two ASCII characters as mentioned above, the real size of payload is 1.5MB.

An option is to use pure binary file. If it is continuous image, it would have only those 1.5MB. If there are some empty gaps (blank space without useful data) in the image, it could increase the size of file, of course. But that's the nature of binary files.

My understanding is that you are working on bootloader, right?
There are some application notes which shows how to write a bootloader and how to parse s-record files (these not directly for S32K3 but you can take a look):

S32K1xx Bootloader:
https://www.nxp.com/docs/en/application-note/AN12218.pdf
https://www.nxp.com/docs/en/application-note-software/AN12218SW.zip

Serial bootloader for MPC5748G:
https://www.nxp.com/docs/en/application-note/AN5319.pdf
https://www.nxp.com/docs/en/application-note-software/AN5319SW.zip

 

For S32K3, we have only a demo of UDS bootloader
https://community.nxp.com/t5/S32K-Knowledge-Base/Unified-bootloader-Demo/ta-p/1423099
However, please notice that this is a demo only provided AS IS with no support. It’s not production code.

Regards,
Lukas

0 Kudos
Reply