View previous topic :: View next topic |
Author |
Message |
sarbaz13
Joined: 22 Jan 2016 Posts: 3
|
pic16f877a Out of ROM, A segment or the program is too large |
Posted: Fri Jan 22, 2016 2:46 am |
|
|
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؟
اثمح ئث |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1933 Location: Norman, OK
|
|
|
RF_Developer
Joined: 07 Feb 2011 Posts: 839
|
|
Posted: Fri Jan 22, 2016 5:08 am |
|
|
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
|
|
Posted: Fri Jan 22, 2016 7:11 am |
|
|
thanks
but i see topics website
before
but
don't solve problem |
|
|
sarbaz13
Joined: 22 Jan 2016 Posts: 3
|
|
Posted: Fri Jan 22, 2016 7:41 am |
|
|
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: 7 Location: Orange County Calif. USA
|
|
Posted: Mon May 09, 2022 2:48 pm |
|
|
I had that too, just have to move some of the lines in the main into functions. _________________ Orange County Calif. USA
http://ag6ju-ipv6.dynv6.net:5950/ |
|
|
|