|
|
View previous topic :: View next topic |
Author |
Message |
alexz
Joined: 17 Sep 2004 Posts: 133 Location: UK
|
Out of ROM Error |
Posted: Wed Nov 17, 2004 5:50 am |
|
|
I am using the PIC16F877A, compiler version 3.190.
I am getting the following error:
main
Seg 0033-07FF, 056A left, need 0709
Seg 0800-0FFF, 0800 left, need 0817
Seg 1000-17FF, 0800 left, need 0817
Seg 1800-1FFF, 0800 left, need 0817
Seg 0000-0003, 0000 left, need 0817
Seg 0004-0032, 0000 left, need 0817
Seg 0033-07FF, 056A left, need 0817
*** Error : Out of ROM, A segment or the program is too large
The largest array I have got is 64 bytes.
Thank you _________________ Alex |
|
|
Ttelmah Guest
|
Re: Out of ROM Error |
Posted: Wed Nov 17, 2004 6:14 am |
|
|
alexz wrote: | I am using the PIC16F877A, compiler version 3.190.
I am getting the following error:
main
Seg 0033-07FF, 056A left, need 0709
Seg 0800-0FFF, 0800 left, need 0817
Seg 1000-17FF, 0800 left, need 0817
Seg 1800-1FFF, 0800 left, need 0817
Seg 0000-0003, 0000 left, need 0817
Seg 0004-0032, 0000 left, need 0817
Seg 0033-07FF, 056A left, need 0817
*** Error : Out of ROM, A segment or the program is too large
The largest array I have got is 64 bytes.
Thank you |
This is nothing to do with arrays (they use RAM, unless 'const'), but the size of your code 'pieces'. Basically a 'routine', has to be fitted into a single segment. If (for instance), you wrote your code as one large program, you can run out of space, since no segment is large enough to hold the routine. Now if (for instance), you either write a routine that everything is in one big block, or calls dozens of seperate subroutines, but each is called only once, the compiler will save space, by making the subroutine 'inlne'. Either way, the result is a huge single 'piece' of code, that cannot be fitted into the available segment size.
Now looking at this, you have lots of free space (three segments are unused), but you have two massive routines (one of 0x719 bytes, and one of 0x817). The latter will never fit (since the largest segment on the procesor is 0x800). You need to split your code up into smaller sections. You can either split the code into smaller subroutines, or if the code is allready in this form, but they are being made 'inline', then manually use the #seperate function to force the compiler to split the routine.
This is in the manual, if you do a search on 'out of ROM', and under the 'questions and answers' section.
Best Wishes |
|
|
alexz
Joined: 17 Sep 2004 Posts: 133 Location: UK
|
|
Posted: Wed Nov 17, 2004 6:22 am |
|
|
I have got very few small functions. and few macros in the code.
I have also got several not small constant arrays.
Basically all my code is state machines inside the state machines.
I haven't used #inline at all.
So, where(in what places) should I use the #separate exactly?
Thank you _________________ Alex |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Wed Nov 17, 2004 6:54 am |
|
|
If you do not call a function more than once, the compiler typically put it inline. |
|
|
alexz
Joined: 17 Sep 2004 Posts: 133 Location: UK
|
|
Posted: Wed Nov 17, 2004 6:55 am |
|
|
Mark wrote: | If you do not call a function more than once, the compiler typically put it inline. |
And what does it mean then? _________________ Alex |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Wed Nov 17, 2004 7:00 am |
|
|
It means that if you do not call a function but 1 time, the compiler automatically considers it inline. Therefore functionA that calls functionB is the size of functionA plus the size of functionB. If functionB was declared with #separate then the compiler would break up the functions into smaller code segments that then they may actually fit. |
|
|
alexz
Joined: 17 Sep 2004 Posts: 133 Location: UK
|
|
Posted: Wed Nov 17, 2004 7:04 am |
|
|
Mark wrote: | It means that if you do not call a function but 1 time, the compiler automatically considers it inline. Therefore functionA that calls functionB is the size of functionA plus the size of functionB. If functionB was declared with #separate then the compiler would break up the functions into smaller code segments that then they may actually fit. |
If I put the #separate before the functionB, I get the error:
Function definition different from previous definition
I dont really have a lot of functions, just few, and few macros _________________ Alex |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Wed Nov 17, 2004 8:38 am |
|
|
You have to put #seperate before both the function and its prototype, otherwise the function won't match the prototype and you will get this error.
But from what you write I don't think that will help. It sounds like you have one massive main() with only a couple of small functions. If main() is too big to fit in a ROM segment, you will have to split your main() so that each piece will fit in a segment. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
alexz
Joined: 17 Sep 2004 Posts: 133 Location: UK
|
|
Posted: Wed Nov 17, 2004 8:42 am |
|
|
SherpaDoug wrote: | You have to put #seperate before both the function and its prototype, otherwise the function won't match the prototype and you will get this error.
But from what you write I don't think that will help. It sounds like you have one massive main() with only a couple of small functions. If main() is too big to fit in a ROM segment, you will have to split your main() so that each piece will fit in a segment. |
Exactly !
I have just took out some pieces from the main and made functions, and it helped!
Thanks to every body
Have a nice day _________________ Alex |
|
|
|
|
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
|