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

optimization

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







optimization
PostPosted: Thu Nov 03, 2005 2:33 am     Reply with quote

Dear Sir,

anyone can a brief description about optimisation techniques in CCS C. during programming i encountered with a peculier problem. when my total rom used reaches 75% compiler shows the message "OUT OF ROM". but when i include functions used in submodules in main file(file which contains main declaration) this eoor message is not shown. any one can help me?.
Foppie



Joined: 16 Sep 2005
Posts: 138
Location: The Netherlands

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Thu Nov 03, 2005 3:00 am     Reply with quote

use the #seperate pre-processor directive

there is information about it on this forum

also see:
http://www.pic-c.com/forum/old/messages/1777.html
MikeValencia



Joined: 04 Aug 2004
Posts: 238
Location: Chicago

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

PostPosted: Thu Nov 03, 2005 7:43 am     Reply with quote

Though it's not always a cure-all to your out-of-rom problems, it does help to break up long functions into smaller ones. And also to use the #separate directive in front of each function, as was mentioned in the first reply. I use #separate the following way:

Code:

#separate
void my_fxn(void); // function prototype

#separate
void my_fxn2(void); // function prototype

...

void my_fxn(void)
{
...
}

#separate
void my_fxn2(void)
{
...
}


Furthermore, are you using a 16F series PIC? That architecture seems to be notorious for those out-of-rom problems as your code grows. I never have that problem with PIC18F series chips. You might want to consider using an equivalent 18F chip. In fact, with an 18F, i never found the need to use #separate.
Foppie



Joined: 16 Sep 2005
Posts: 138
Location: The Netherlands

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Thu Nov 03, 2005 8:03 am     Reply with quote

MikeValencia wrote:
Furthermore, are you using a 16F series PIC? That architecture seems to be notorious for those out-of-rom problems as your code grows. I never have that problem with PIC18F series chips. You might want to consider using an equivalent 18F chip. In fact, with an 18F, i never found the need to use #separate.
Is this not just because the 18F has more ROM???
MikeValencia



Joined: 04 Aug 2004
Posts: 238
Location: Chicago

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

PostPosted: Thu Nov 03, 2005 8:25 am     Reply with quote

I've always been told that the 18F is geared more towards C programming than the 16F. I don't think it's a ROM issue. You say you have only 75% of ROM filled up. It's just that the 16F isn't so tolerant of having long functions that cross "page" boundaries. I haven't written in assembly nor read the datasheets for several years now, so i can't give a concise description.
asmallri



Joined: 12 Aug 2004
Posts: 1636
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Thu Nov 03, 2005 8:35 am     Reply with quote

MikeValencia wrote:
I've always been told that the 18F is geared more towards C programming than the 16F. I don't think it's a ROM issue. You say you have only 75% of ROM filled up. It's just that the 16F isn't so tolerant of having long functions that cross "page" boundaries. I haven't written in assembly nor read the datasheets for several years now, so i can't give a concise description.


The 16F family has a brain dead memory architecture (RAM and Program Memory) that should never have been brought to market - but that's the world we live in :-)
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
dyeatman



Joined: 06 Sep 2003
Posts: 1939
Location: Norman, OK

View user's profile Send private message

PostPosted: Thu Nov 03, 2005 9:41 am     Reply with quote

FWIW, CCS has a document on CCS optimization vs assembly code on the Overview web page:

http://www.ccsinfo.com/overview.shtml
vin
Guest







PostPosted: Thu Nov 03, 2005 11:29 pm     Reply with quote

dear Sir,

Thank all for the valuble information. I am just going to experiment with code. ok we will see again.
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