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

pic16f877a Out of ROM, A segment or the program is too large

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



Joined: 22 Jan 2016
Posts: 3

View user's profile Send private message Yahoo Messenger

pic16f877a Out of ROM, A segment or the program is too large
PostPosted: Fri Jan 22, 2016 2:46 am     Reply with quote

ERRoR:
*** Error 71 "main.c" Line 1399(1,2): Out of ROM, A segment or the program is too large MAIN
Seg 00800-00FFF, 0024 left, need 00E32
Seg 01000-017FF, 05E8 left, need 00E32
Seg 01800-01FFF, 0800 left, need 00E32
Seg 00000-00003, 0000 left, need 00E32
Seg 00004-0004E, 0000 left, need 00E32
Seg 0004F-007FF, 004C left, need 00E32

1 Errors, 0 Warnings.
Build Failed.

while build project show message top.
i use compiler ccs ver 5.012
why?

what's the solution؟
اثمح ئث Embarassed Exclamation
dyeatman



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

View user's profile Send private message

PostPosted: Fri Jan 22, 2016 5:07 am     Reply with quote

Taking time to search would probably help...
http://www.ccsinfo.com/forum/viewtopic.php?t=34265&start=7
http://www.ccsinfo.com/forum/viewtopic.php?t=43086&highlight=rom+16f877a
_________________
Google and Forum Search are some of your best tools!!!!


Last edited by dyeatman on Fri Jan 22, 2016 5:12 am; edited 1 time in total
RF_Developer



Joined: 07 Feb 2011
Posts: 839

View user's profile Send private message

PostPosted: Fri Jan 22, 2016 5:08 am     Reply with quote

Just as the error message is telling you, the code for your main() won't fit in any of the available memory segments: it's too big and/or too compicated.

The 16 series PICs have segmented, or banked program memory. The CCS compiler requires that each routine, including your main code, fits inside a memory segment. In you case, it doesn't.

So, what can you do? You have to make the compiler's job easier. It can more easily fit lots of small routines into the segents than fewer larger routines. Its also generally good programming practice to divide up code into smaller routines where possible.

How do you do that? You look at your main() and work out which bits of code, especially repeated code, can reasonably be made into separate routines that you can call from main. You can also avoid inlining routines if you already do. You can avoid unnecessary float calculations, which generate a lot of code and run slowly as well.

18s and later series PICs have linear addressing, i.e. are not segmented/banked, which makes fitting large chunks of code in much easier.
sarbaz13



Joined: 22 Jan 2016
Posts: 3

View user's profile Send private message Yahoo Messenger

PostPosted: Fri Jan 22, 2016 7:11 am     Reply with quote

dyeatman wrote:
Taking time to search would probably help...
http://www.ccsinfo.com/forum/viewtopic.php?t=34265&start=7
http://www.ccsinfo.com/forum/viewtopic.php?t=43086&highlight=rom+16f877a


thanks
but i see topics website
before

but
don't solve problem
sarbaz13



Joined: 22 Jan 2016
Posts: 3

View user's profile Send private message Yahoo Messenger

PostPosted: Fri Jan 22, 2016 7:41 am     Reply with quote

CCS PCM C Compiler, Version 5.012, 5967 22-Jan-16 11:38

Filename: C:\Users\admin\Documents\main.lst

ROM used: 1316 words (16%)
Largest free fragment is 2048
RAM used: 127 (35%) at main() level
134 (36%) worst case
Stack used: 3 locations (2 in main + 1 for interrupts)
Stack size: 8
ag6ju



Joined: 22 Jun 2021
Posts: 6
Location: Orange County Calif. USA

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

PostPosted: Mon May 09, 2022 2:48 pm     Reply with quote

I had that too, just have to move some of the lines in the main into functions.
_________________
Orange County Calif. USA
http://ag6ju-01.dynv6.net:5950/
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