View previous topic :: View next topic |
Author |
Message |
Sparky
Joined: 02 Sep 2005 Posts: 7
|
Out of ROM and memory paging |
Posted: Sat Aug 14, 2010 8:58 am |
|
|
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
|
|
Posted: Sat Aug 14, 2010 3:49 pm |
|
|
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
|
|
Posted: Sat Aug 14, 2010 4:14 pm |
|
|
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
|
|
Posted: Sat Aug 14, 2010 8:23 pm |
|
|
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
|
|
Posted: Sun Aug 15, 2010 6:07 am |
|
|
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
|
|
Posted: Sun Aug 15, 2010 8:54 am |
|
|
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 |
|
|
|