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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
1,503 次查看
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 项奖励
1 解答
1,472 次查看
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 项奖励
3 回复数
1,487 次查看
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 项奖励
1,480 次查看
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 项奖励
1,473 次查看
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 项奖励