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 support@ccsinfo.com

Code Protect Block

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



Joined: 21 Jan 2005
Posts: 11

View user's profile Send private message MSN Messenger

Code Protect Block
PostPosted: Fri Jul 08, 2005 6:06 am     Reply with quote

Hi,

I need protect code of my aplication, but i use half flash memory for data.

How i can Protect Block Boot, Data EEprom & Blocks 0,1,2,3 the rest block i need not protect (4,5,6,7)

In config Word i need write
_CONFIG5L B'11110000'
_CONFIG5H B'00000000'

How i can make this with CCS?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jul 08, 2005 10:40 am     Reply with quote

It may be possible, but you need to tell us what PIC you're using.
T0ni0



Joined: 21 Jan 2005
Posts: 11

View user's profile Send private message MSN Messenger

PostPosted: Mon Jul 11, 2005 12:28 am     Reply with quote

I use PIC 18F6720 and i can portect Boot Block And others Block, but i dont know how i can protect any Blocks with CCS.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jul 11, 2005 1:23 am     Reply with quote

I don't have the latest version of PCH. I have 3.188.

In my version, if look near the start of the 18F6720.H file, it lists
fuse settings that can protect the Boot Block and the Data EEprom.
These are:

CPB = protect Boot Block

CPD = protect Data EEprom

However, for Code Protection, it only lists the PROTECT setting,
which protects all the ROM. It doesn't have settings for CP0 to CP7, as
shown in the data sheet, which allow protection of smaller parts of ROM.

What version of PCH do you have ? If you have a newer version
than mine, does the 18F6720.H file show any settings such as CP0,
or PROTECT_0, or PROTECT_12%, etc. ? Or does it only have PROTECT ?

If someone else has the latest version of PCH, maybe they can look at
the 18F6720.H file and see if CCS has added those settings.

If your version doesn't have fuse settings for blocks CP0-CP7, and
if you have the PCWH compiler, then you could use the Device Editor
to add those fuse settings.
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Mon Jul 11, 2005 10:13 am     Reply with quote

Code:
//////// Standard Header file for the PIC18F6720 device ////////////////
#device PIC18F6720
#nolist
//////// Program memory: 0x16  Data RAM: 3840  Stack: 31
//////// I/O: 39   Analog Pins: 12
//////// Data EEPROM: 1024
//////// C Scratch area: 00   ID Location: 2000
//////// Fuses: LP,XT,HS,RC,EC,EC_IO,H4,RC_IO,PROTECT,NOPROTECT,OSCSEN
//////// Fuses: NOOSCSEN,NOBROWNOUT,BROWNOUT,WDT1,WDT2,WDT4,WDT8,WDT16,WDT32
//////// Fuses: WDT64,WDT128,WDT,NOWDT,BORV25,BORV27,BORV42,BORV45,PUT,NOPUT
//////// Fuses: CPD,NOCPD,NOSTVREN,STVREN,NODEBUG,DEBUG,NOLVP,LVP,WRT,NOWRT
//////// Fuses: CPB,NOCPB,EBTRB,NOEBTRB,EBTR,NOEBTR,CCP2E7,CCP2C1,WRTD
//////// Fuses: NOWRTD,WRTC,NOWRTC,WRTB,NOWRTB
////////
////////////////////////////////////////////////////////////////// I/O
// Discrete I/O Functions: SET_TRIS_x(), OUTPUT_x(), INPUT_x(),
//                         PORT_B_PULLUPS(), INPUT(),
//                         OUTPUT_LOW(), OUTPUT_HIGH(),
//                         OUTPUT_FLOAT(), OUTPUT_BIT()
// Constants used to identify pins in the above are:
T0ni0



Joined: 21 Jan 2005
Posts: 11

View user's profile Send private message MSN Messenger

PostPosted: Wed Jul 13, 2005 3:27 am     Reply with quote

PCM programmer wrote:


What version of PCH do you have ? If you have a newer version
than mine, does the 18F6720.H file show any settings such as CP0,
or PROTECT_0, or PROTECT_12%, etc. ? Or does it only have PROTECT ?

If someone else has the latest version of PCH, maybe they can look at
the 18F6720.H file and see if CCS has added those settings.

If your version doesn't have fuse settings for blocks CP0-CP7, and
if you have the PCWH compiler, then you could use the Device Editor
to add those fuse settings.


Device Editor?

PCH 3.227

//////// Standard Header file for the PIC18F6720 device ////////////////
#device PIC18F6720
#nolist
//////// Program memory: 0x16 Data RAM: 3840 Stack: 31
//////// I/O: 39 Analog Pins: 12
//////// Data EEPROM: 1024
//////// C Scratch area: 00 ID Location: 2000
//////// Fuses: LP,XT,HS,RC,EC,EC_IO,H4,RC_IO,PROTECT,NOPROTECT,OSCSEN
//////// Fuses: NOOSCSEN,NOBROWNOUT,BROWNOUT,WDT1,WDT2,WDT4,WDT8,WDT16,WDT32
//////// Fuses: WDT64,WDT128,WDT,NOWDT,BORV25,BORV27,BORV42,BORV45,PUT,NOPUT
//////// Fuses: CPD,NOCPD,NOSTVREN,STVREN,NODEBUG,DEBUG,NOLVP,LVP,WRT,NOWRT
//////// Fuses: CPB,NOCPB,EBTRB,NOEBTRB,EBTR,NOEBTR,CCP2E7,CCP2C1,WRTD
//////// Fuses: NOWRTD,WRTC,NOWRTC,WRTB,NOWRTB
////////
////////////////////////////////////////////////////////////////// I/O
// Discrete I/O Functions: SET_TRIS_x(), OUTPUT_x(), INPUT_x(),
// PORT_B_PULLUPS(), INPUT(),
// OUTPUT_LOW(), OUTPUT_HIGH(),
// OUTPUT_FLOAT(), OUTPUT_BIT()
// Constants used to identify pins in the above are:
T0ni0



Joined: 21 Jan 2005
Posts: 11

View user's profile Send private message MSN Messenger

PostPosted: Wed Jul 13, 2005 8:31 am     Reply with quote

I use MPLAB, can i write any config word value with CCS ?

I like make config word in code, not in a IDE Mad
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jul 13, 2005 11:33 am     Reply with quote

Quote:
I use MPLAB, can i write any config word value with CCS ?
I like make config word in code, not in a IDE


I suggest that you email CCS and ask them to add support for
the Config bits in the Config 5L register, which are CP0-CP7.
Tell them that currently, they only support PROTECT and NOPROTECT,
and you would like support for the CP0-CP7 bits in the 18F6720.

Give them a link to this thread.

The email address for CCS tech support is on this page:
http://www.ccsinfo.com/techsupport.shtml
soundscu



Joined: 29 Jun 2007
Posts: 62
Location: Raleigh, NC

View user's profile Send private message Visit poster's website

5 years later - still no support?
PostPosted: Thu Apr 24, 2008 2:12 pm     Reply with quote

I'm amazed that 5 years after this thread was last active, there still does not appear to be support for individual protect fuses in PIC18 parts. I'm using the PIC18F4431, and need CP0 without CP1/2/3.

I've sent a request to CCS.

Now I'll look at adding fuses myself... a time-waster I would have preferred to avoid. :(

Jim
soundscu



Joined: 29 Jun 2007
Posts: 62
Location: Raleigh, NC

View user's profile Send private message Visit poster's website

Ok... 3 years. But still!!!
PostPosted: Thu Apr 24, 2008 2:13 pm     Reply with quote

Ok... 3 years. But still!!!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Apr 24, 2008 2:19 pm     Reply with quote

This is in the current CCS manual, in the #fuses section:
Quote:

Some processors allow different levels for certain fuses. To access
these levels, assign a value to the fuse. For example, on the 18F452, the
fuse PROTECT=6 would place the value 6 into CONFIG5L, protecting code
blocks 0 and 3.
soundscu



Joined: 29 Jun 2007
Posts: 62
Location: Raleigh, NC

View user's profile Send private message Visit poster's website

Thanks!
PostPosted: Thu Apr 24, 2008 2:44 pm     Reply with quote

Thanks!

Now I will suggest to CCS that they add a FUSES section to the Functional Overviews in the manual. Much has changed and been added over the years, and today's implementation is (for me, anyway) not quite intuitive.

BTW... thinking I needed to add fuse definitions, I tried using the Device Editor. Didn't go well... my changes did not save reliably, sometimes coming back with the settings there but no name. Saving to a different filename (i.e. device name) made no different -- my impression is the editor is flaky.

Jim
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