Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

code protection & consistency

Status
Not open for further replies.

banh

Advanced Member level 1
Joined
Dec 16, 2004
Messages
458
Helped
17
Reputation
34
Reaction score
5
Trophy points
1,298
Activity points
3,939
problem: i want to make sure that every time the program is executed by the mcu, my code is as expected, and has not been changed (partially) or been corrupted in some part.

currently i'm thinking about storing checksum/crc value in some ROM place.

please recommend some of your methods for this problem and for code protection in general.

thanks.
 

silvio

Advanced Member level 3
Joined
Dec 31, 2001
Messages
716
Helped
105
Reputation
210
Reaction score
16
Trophy points
1,298
Location
Romania
Activity points
11,497
Hi banh,

It's a common procedure using checksum/crc for the code program.
But what happens if the code which performs the CRC checking get corrupt and is not able to check further.
If that code is implemented in ROM rather than FLASH then it's OK. Very similar with microcontroller that has bootloader in ROM.
If the code memory size it's not an issue you can duplicate the code area like file allocation tables and use the other when first get corrupted.

A nice application for AVR microcontroller can find here:
http://www.atmel.com/dyn/resources/prod_documents/DOC1143.PDF
and code: http://www.atmel.com/dyn/resources/prod_documents/AVR236.zip
The LPM instruction could be replaced by any decent indirect read from code memory space if you use other microcontroller, but AVR.
 

    banh

    points: 2
    Helpful Answer Positive Rating

banh

Advanced Member level 1
Joined
Dec 16, 2004
Messages
458
Helped
17
Reputation
34
Reaction score
5
Trophy points
1,298
Activity points
3,939
thanks silvio,

what i intend to do is to have a checksum precalculated, and store it somewhere in the flash.

whenever the program starts, it will calculate the checksum again on its own code ((by reading out from the flash), and compare this with the precalculated value. if not equal, the program should stop.

one possible issue is that the time for calculating the checksum when startup may be quite long..

need to test on this..
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top