"Same" SREC files behave differently. How to compare SREC to flash contents?

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

"Same" SREC files behave differently. How to compare SREC to flash contents?

Jump to solution
1,402 Views
lucianomoretti
Contributor IV

Using a modified version of the S32 bootloader in AN12218 and I've got 2 SREC files that the data is identical except the record alignment. One loads and boots fine, the other ends up causing an exception after attempting to jump into the app.

Srecord Tools (http://srecord.sourceforge.net/) srec_cmp states that they are the "same". The one that fails is generated using S32 Design Studio with the --srec-len 32 option, while the other is the same file but run through the Srecord Tools srec_cat tool with the -Output_Block_Size 32 option.

How do I compare the flash contents to an SREC file to see what is different?

0 Kudos
1 Solution
1,371 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

If you use S32 Design Studio, the memory content can be exported to s-record file in the memory tab:

lukaszadrapa_0-1623749135952.png

Regards,

Lukas

 

View solution in original post

0 Kudos
3 Replies
1,386 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

we got a report about weakness of the s-record parser short time ago:

https://community.nxp.com/t5/S32-Design-Studio/Why-does-the-AN12218SW-bootloader-fails-to-parse-the-...

I already sent the report to responsible team and it will be either fixed or maybe they will add a note that it's necessary to convert the file to specific format when each s-record format has fixed length - and this is also the workaround I can recommend.

Regards,

Lukas

0 Kudos
1,379 Views
lucianomoretti
Contributor IV

Hi Lukas:

I found the post on the 8-byte alignment.

I modified the mem_man_write() function to pad the end of the phrase to 8-byte align it. The small incremental size increase was more than worth it to us as we had trouble getting srec_cat to output an aligned and padded SREC that would work properly. If the firmware wasn't an even 8-byte length the last line would still end up "short" and the download would fail.

 

	uint16_t sizeMod = data_size % 8;
	if(0 != sizeMod){
		/* set remaining bytes of array to 0xFF (default erased value)
		 * extend data_size to match new length.
		 */
		sizeMod = data_size + (8 - sizeMod); /* Generate new size */
		memset((void *) (BP->F.PhraseData + data_size), 0xFF, MAX_DATA_BP - data_size);
		
		data_size = sizeMod;
	}

 

I also added in a "Check after programming" to verify that the data written matched the data we intended to with the FlashProgramCheck() function:

 

flashReturn = FlashProgramCheck(&flashSSDConfig, flash_prog_address, data_size,  BP->F.PhraseData, &failAddress, 0x1U, FlashCommandSequence);

 

I'm seeing the FlashProgramCheck succeed once I added padding (it failed before) but the program still doesn't work properly so I really DO need an answer to the question I actually asked for dumping the flash contents for comparison.

0 Kudos
1,372 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

If you use S32 Design Studio, the memory content can be exported to s-record file in the memory tab:

lukaszadrapa_0-1623749135952.png

Regards,

Lukas

 

0 Kudos