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

#FUSES NOPROTECT and PROTECT

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



Joined: 06 Sep 2017
Posts: 82

View user's profile Send private message

#FUSES NOPROTECT and PROTECT
PostPosted: Fri Oct 13, 2017 7:17 am     Reply with quote

Any one can explain me Why we use #FUSES NOPROTECT and #FUSES PROTECT in code??
i have read the manual it says
#FUSES NOPROTECT //Code not protected from reading

what does it mean by Code not protected from reading??
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Fri Oct 13, 2017 7:57 am     Reply with quote

It means if you stick the chip into a programmer, and try to read it, you won't get the code back.
There are quite a few 'variants' depending on the chip involved.

1) On old chips you could read an encrypted form of the code. Quite difficult to decode, but meant you could read it from a 'known working' chip, and then compare this to verify that the programming had worked OK.
On more modern chips you just get 'blank' data back, so have to verify before setting this fuse.
2) Many chips have other options, allowing different parts of the code to be protected.

Designed to help protect commercial code from being copied.

There is a big 'downside' to this when developing code, that once set, it can only be turned off by a full chip erase. This uses a memory 'life' for the whole chip, every time you want to change anything. Otherwise the programmer can be 'smart' and only change parts that need to be changed.
So only turn it on if you need to protect the code, and only after you have the code working.
UserJP



Joined: 13 Oct 2017
Posts: 2

View user's profile Send private message

PostPosted: Fri Oct 13, 2017 8:22 am     Reply with quote

If you have set the #noprotect fuse, your program memory can be read. This is not directly the code you wrote (because if it were it would be reverse engineering, and this is very very difficult), it is machine language with some cryptography done by the compiler.

see:
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Oct 13, 2017 9:44 am     Reply with quote

re:
Quote:

This is not directly the code you wrote (because if it were it would be reverse engineering, and this is very very difficult), it is machine language with some cryptography done by the compiler.

I don't think so.....

The code stored in the PIC IS the actual machine code, not some kind of 'encrypted' format of the assembly instructions otherwise the PIC would not run your program (that has been converted from C to machine code).

If you use MPLAB, you can read any PIC, well unprotected PIC, and look at the machine code that is in it. Remember this is MACHINE CODE not CCS C. Stuff us Assembly guys are very familiar with. Heck only 35 instructions so it's easier to learn than C.

As for early or 'old' PICs, The first ones like 16C71, could be read and then decoded very easy, once you knew the Microchip 'encryption', which was rather easy to figure out, BTDT. If you 'cut your teeth' on PIC assembler you'll know this.

Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Fri Oct 13, 2017 11:07 am     Reply with quote

This does depend on the PIC.
As I tried to explain. On all PIC's, if unprotected, a programmer can read the machine code.
On older PIC's if protected, you get back an encrypted version of the code. It can be broken but is hard.
On newer PIC's if protected you get back nothing.
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