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

conFUSE bits

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



Joined: 02 Jan 2006
Posts: 75
Location: Neeroeteren, Limburg, Belgium

View user's profile Send private message

conFUSE bits
PostPosted: Thu Sep 16, 2010 6:46 am     Reply with quote

Hello all,

I am finishing my pic project.
Now I want to keep my code protected from reading using the FUSE bits.

I use a 18f2620

the situation is like this:

I use serial communication to communicate through a ftdi to the USB of my pc.

in the serial loop I write data to the eeprom and also to the program memory (reserved locations)

The program memory is written in blocks of 64 bytes but is read in 2 or 4 bytes.


In the 18f2620 I have following "protection" FUSE bits at my disposal:

    PROTECT Code protected from reads
    CPB Boot Block Code Protected
    CPD Data EEPROM Code Protected
    WRT Program Memory Write Protected
    WRTC configuration registers write protected
    WRTB Boot block write protected
    WRTD Data EEPROM write protected
    EBTR Memory protected from table reads
    EBTRB Boot block protected from table reads


In order to have my code working, including read-write from within my "serial loop" I have to set the fuse bits like this:
Code:

#fuses PROTECT //Code protected from reads
#fuses CPB        //Boot Block Code Protected
#fuses CPD        //Data EEPROM Code Protected
#fuses NOWRT    //Program Memory not Write Protected
#fuses WRTC      //configuration registers write protected
#fuses WRTB      //Boot block write protected
#fuses NOWRTD  //Data EEPROM not write protected
#fuses NOEBTR   //Memory not protected from table reads
#fuses EBTRB     //Boot block protected from table reads



I have some questions regarding these settings:

1) I don't use a boot loader, so I am not sure it is wise to set its read / write protection?

2) I have to set NOWRT, if I don't I can not access my reserved memory.
Will setting this bit have an impact on my code safety?
does setting NOWRT have an influence on the WRTC and WRTB fuses
or is it sufficient to set WRTC, WRTB and NOWRTD? (deleting NOWRT?)


3) I have to set NOEBTR, if I don't I can not access my reserved memory.
Will setting this bit have an impact on my code safety?


Is setting these bits enough to protect my code, or can I take other measures to do so?

Thanks in advance,

BLOB
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Sep 17, 2010 4:09 pm     Reply with quote

To protect your code from being read, at a minimum you need to use
these fuses:
Code:

PROTECT, CPB

This will prevent a programmer (ICD2, PicStart-Plus, etc) from reading
the program memory. This includes the Boot Block (protected by CPB).

If you want to protect the Data eeprom from being read, then also use
this fuse:
Code:

CPD
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