ESA2GJK1DH1K upgrade articles: articles about the upgrade data validation

 

 

 

Foreword

  Given the times we all want to join upgrade data validation, so we meet the demands of everyone.

  In fact, I want to do enough stable and reliable, so that we use them at ease.

  On a test of a join operation check after this section to talk about details of the code check section.

Data validation mode

  Data check mode is done for each data accumulation

  Note Kazakhstan, SCM is a type of char data type, then do it like data accumulation.

  char  sum;

       sum = sum + transactions;

  It is time to upgrade the data byte by byte of data received.

 

  I say one more thing now!

  Ask now is like assuming that the above sum = 255; and then the data is 0x03

  I ask execute sum = sum + 0x03; now sum equal to how much?

  Equal to 0x02 

  I only reminded

  int a = 0x0102

  char  b = a;

  b = 0x02;

 

 

  PC does, and there is calculated the same way as the microcontroller

    

 

  PC source here you see for yourself Ha

    

 

 

 

  

Microcontroller program and see: BootLoader added parity data

  In fact, adding the equivalent of one more check to determine only !!!!

  It will be recalled Ha, this is the cloud of data

  SumBin1 is the first user and data validation program bin file

  SumBin2 second checksum data bin user program files

    

  

  Under the first program to change what BootLoader

  An increase of three status flags, two variables

    

 

 

 

  SumBin initialized to -1, because the check value range is 0-255, so this can not let the variable is initialized to zero

    

 

 

  

  Just get older program version, and now need to get the bin file checksum, put under Chart positions

    

 

 

 

 

  Then write the check value of the program to obtain cloud.

  SumBin and UpdateStatus_SumBinRangeErr just defined handy

    

 

  When the received data starts accumulating data, calculation data and

  Sum defined above to use it

 

    

 

 

   And then there are actually two state variables are optimized in one place before

  以前为了少定义一些状态,就把下面的错误设置成了  UpdateStatus_DataAddressError

    

  其实UpdateStatus_DataAddressError 这个状态是判断的下面的

    

 

 

    

 

 

  这次呢,想了想,换个新标志  UpdateStatus_MissingData

    

 

 

  然后加上最终的判断校验

 

    

 

 

  加上

 

    

 

 

   其实呢,就是多加了个判断而已...

  升级的时候弄了好多状态,实际上就是为了保证万无一失.

    

 

 

然后看单片机程序:  用户程序

  写上新添加的升级状态.

    

 

  把升级状态,转为字符串的地方需要加上新状态了.

    

 

 

 

 

 

 

  然后就移植上了数据校验了

 

 

现在很多人问,什么时候才有视频

  我是这样想的,我先写完文章教程以后再录制视频

  其实大家应该看出来了,每一节教程都是很复杂的教程

  涉及的知识点很多.我现在录制视频教程不敢打包票一次就录制好

  我不想像前几次似的录制了以后发现出问题了,一旦有问题,就必须重新录制

  文章有了问题好修改,修改的没有问题了,再遵循着文章录制视频教程

  这样才能保证一次性就成了!

  大家如果对代码上的思路不明白就问我哈,我正好可以总结大家的问题

  然后再整理整理文章.

 

  

 

Guess you like

Origin www.cnblogs.com/yangfengwu/p/11939465.html