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

Out of ROM and memory paging

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



Joined: 02 Sep 2005
Posts: 7

View user's profile Send private message

Out of ROM and memory paging
PostPosted: Sat Aug 14, 2010 8:58 am     Reply with quote

I'm using a 16f877 and am getting the out of ROM error. From looking at the program tree my main function is on page 1 of the memory and all the other functions are on page 0.
Is there a way of telling the compiler to place a certain function on page 2 or 3 which are currently empty. One particular function is causing the out of ROM error when I add extra lines to it. I would like to place this function separately as it needs to grow considerably before my code if finished.

Also I've been away from Pic programming for several years and know the 16f877 is quite old now. Do the newer chips have the same memory organization, spread over several pages or are chips with one memory block available.

Many thank.
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Sat Aug 14, 2010 3:49 pm     Reply with quote

In the CCS site you will find a FAQ, this question and many others were already answered.

http://www.ccsinfo.com/faq.php

also searching in this forum you will get a lot of info.

Humberto
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Aug 14, 2010 4:14 pm     Reply with quote

Also, if you are using the CCS demo, it's limited to only the first ROM
page, which only gives you 2K (instead of the full 8K ROM words).
Some other student versions or bundled versions might also have this
limitation.
Sparky



Joined: 02 Sep 2005
Posts: 7

View user's profile Send private message

PostPosted: Sat Aug 14, 2010 8:23 pm     Reply with quote

Thanks for the replies.

I don't have the demo version and my code is 3.2k when it compiles but if I add lines to Main or any other functions I get the out of ROM error.

I had already read the FAQ and the help files in the compiler but don't fully understand what to do.

I tried adding #SEPARATE before one function and then all functions but it didn't help.

One thing I did notice is that Main is on page 1 and has used 2010 of the ROM with 38 free. Is it possible that adding code to another function is pushing Main over the limit?
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Sun Aug 15, 2010 6:07 am     Reply with quote

Is there any way you can break out a chunk of main() into another function? If main() was smaller it would test other theories.
_________________
The search for better is endless. Instead simply find very good and get the job done.
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Sun Aug 15, 2010 8:54 am     Reply with quote

As suggested, the best way to overcome such problem is to take the code of main () and divide it into small functions
as possible, the method of divide and conquer applies literally in this. Small blocks of code is used more efficiently
by the compiler in the paging operation step of allocate code in memory.

Humberto
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