Microchip
直播中

仇国林

7年用户 195经验值
私信 关注
[问答]

编程为PIC的Hex文件与读取PIC的hex文件不匹配

我的任务是评估一个已经在该领域工作多年的设备,并且可能已经经历了辐射暴露的影响。我有原始的十六进制文件,它被编程到PIC18F2431。我想从PIC中读取程序内存,并比较这两个十六进制文件来检查辐射效应(Ext位翻转)。考虑到这一点,我尝试开发一种使用测试PIC来实现这一方法的方法。我在MPLAX中建立了一个项目(我们称之为TEST1),并将它编程到我的测试PIC上。但是当我“读取设备内存到文件”时,我得到的HEX文件与l.MyOpjtudio.g..x/Dist/Deal/Dealp/中的HEX文件不匹配。这两个HEX文件有一些匹配的部分,但也有很多差异。我看到的其中一个差异似乎是闪存的未使用部分。在十六进制I中读取PIC的每个内存位置都有一个条目,但是在HEX文件中/DIST/默认/分发/未使用的闪存位置不包括在内。然而,这并不是这两个十六进制文件之间唯一的区别。我创建了一个新的项目(我们称之为TEST2),使用了读取测试PIC的HEX文件,MPLAB中的项目仪表板中的校验和匹配TEST1的校验和。参考PIC18F2431编程规范,我发现这个校验和是基于Flash存储器的用户可访问部分和配置寄存器来计算的。因此,似乎Test1和Test2的这些部分是匹配的。然而,我仍然对这些差异感到好奇。你能解释一下为什么会发生这种情况吗?有没有另一种方法来比较PIC上的程序和原来的程序?

以上来自于百度翻译


      以下为原文

    I'm tasked with evaluating a device which has been in the field for a number of years and may have experienced effects from radiation exposure. I have the original hex file that was programmed on to the PIC18F2431. I would like to read the program memory off the PIC and compare the two hex files to check for radiation effects (ex. bit flips).

With that in mind I'm trying to develop a method to do this using a test PIC. I've built a project (let's call it Test1) in MPLAB X and programmed that on to my test PIC. But when I "Read Device memory to file" the hex file I get does not match the hex file in .X/dist/default/distribution/. There are sections of the two hex files that do match, but also many discrepancies.

One of the discrepancies I'm seeing appears to be the unused portion of Flash memory. In the hex I read off the PIC every memory location has an entry, but in the hex file in /dist/default/distribution/ the unused flash memory locations are not included. However this is not the only difference between the two hex files.

I created a new project (let's call it Test2) using the hex file I read off the test PIC and the checksum in the project Dashboard in MPLAB X matches the checksum of Test1. Referring to the PIC18F2431 Programming Spec I found that this checksum is calculated based on the user accessible portion of Flash memory and the configuration registers. So it seems that these portions of Test1 and Test2 match. However I am still curious about the discrepancies.

Can you explain why this may be happening? Is there another method to compare the program on a PIC to what was originally programmed on to it?

回帖(3)

吴键洪

2018-9-5 16:29:47
这正是你所期望的。编译器在其输出中不包括未使用的内存位。您应该使用从新编程的PIC读回作为引用,而不是编译器的输出。

以上来自于百度翻译


      以下为原文

   
That is exactly what you should expect. The compiler does not include unused bits of memory in its output.
You should use a readback from a freshly programmed PIC as your reference, not the output from the compiler.
 
举报

陈杰

2018-9-5 16:43:37
对于一个新项目,您可以用常量填充未使用的内存。

以上来自于百度翻译


      以下为原文

    For a new project you could fill unused memory with a constant
   Attached Image(s)

举报

陈晨

2018-9-5 16:49:54
取原始十六进制并将其加载到IPE(导入)中,然后保存它(导出)。这将给你所有丢失的填充物。读取PIC,然后导出它。然后,可以将这两个文件与任何文件比较实用程序进行比较(类似于比较)。

以上来自于百度翻译


      以下为原文

    Take the Original Hex and Load it in to IPE.(Import)
Then save it (Export). This will give you all the missing Padding.
Read the PIC, Then export it also.
You can then compare the two files with any file compare utility (like Beyond Compare)
举报

更多回帖

发帖
×
20
完善资料,
赚取积分