View previous topic :: View next topic |
Author |
Message |
vin Guest
|
optimization |
Posted: Thu Nov 03, 2005 2:33 am |
|
|
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
|
|
|
MikeValencia
Joined: 04 Aug 2004 Posts: 238 Location: Chicago
|
|
Posted: Thu Nov 03, 2005 7:43 am |
|
|
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
|
|
Posted: Thu Nov 03, 2005 8:03 am |
|
|
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
|
|
Posted: Thu Nov 03, 2005 8:25 am |
|
|
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
|
|
Posted: Thu Nov 03, 2005 8:35 am |
|
|
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
|
|
|
vin Guest
|
|
Posted: Thu Nov 03, 2005 11:29 pm |
|
|
dear Sir,
Thank all for the valuble information. I am just going to experiment with code. ok we will see again. |
|
|
|