View previous topic :: View next topic |
Author |
Message |
srikrishna
Joined: 06 Sep 2017 Posts: 82
|
#FUSES NOPROTECT and PROTECT |
Posted: Fri Oct 13, 2017 7:17 am |
|
|
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
|
|
Posted: Fri Oct 13, 2017 7:57 am |
|
|
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
|
|
Posted: Fri Oct 13, 2017 8:22 am |
|
|
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
|
|
Posted: Fri Oct 13, 2017 9:44 am |
|
|
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
|
|
Posted: Fri Oct 13, 2017 11:07 am |
|
|
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. |
|
|
|