CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

bootloader crc

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
georpo



Joined: 18 Nov 2008
Posts: 281
Location: Athens, Greece.

View user's profile Send private message

bootloader crc
PostPosted: Sun Dec 13, 2020 12:48 pm     Reply with quote

Hello,

I have seen that the loader_pcd checks each line checksum and then writes to program memory.

What if some lines are OK but some lines are bad data? Do I get a corrupt PIC?

In my tests, I send the hex file 2 times and write to 2 different locations of external flash, then compare the 2 files byte by byte and only if they are OK, I write them to the program memory.
This of course works but needs big flash etc.

How can I calculate the CRC of the hex file so I can send the hex file only once?
Code:

;DSPIC33FJ64GP804
;CRC=8C7D  CREATED="13-Dec-20 19:44"

_________________
George.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Dec 13, 2020 12:57 pm     Reply with quote

See this thread for sample code:
http://www.ccsinfo.com/forum/viewtopic.php?t=58331
georpo



Joined: 18 Nov 2008
Posts: 281
Location: Athens, Greece.

View user's profile Send private message

PostPosted: Sun Dec 13, 2020 1:14 pm     Reply with quote

Thanks PCM programmer!

I have the hex file in external flash.
Below are the last lines:
Code:

:1059E0008410020000000000F81202000000000015
:1059F000A415020000000000B8270200000000000B
:085A0000FFFF37000040FE002B
:00000001FF
;DSPIC33FJ64GP804
;CRC=8C7D  CREATED="13-Dec-20 19:44"


So, which is the last ASCII character that I will pass through the CRC16 code?
Is it the last 'F' before the 1st ';'?
_________________
George.
georpo



Joined: 18 Nov 2008
Posts: 281
Location: Athens, Greece.

View user's profile Send private message

PostPosted: Sun Dec 13, 2020 1:51 pm     Reply with quote

I got it.
It includes the ";DSPIC33FJ64GP804" line but not the CRC line.

It WORKS!

Thanks!!!!!!
_________________
George.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group