View previous topic :: View next topic |
Author |
Message |
richi-d
Joined: 28 Aug 2007 Posts: 106
|
PIC24 OUT of ROM |
Posted: Wed Jul 21, 2010 4:08 am |
|
|
PIC24FJ128GA108
The compiler shows this message:
"Out of ROM, A segment or the program is too large MAIN"
If I delete 1 line I´m at 74% of ROM. Why am I at the Limit?
Another question is how to bring something like that as a constant to RAM:
Code: |
unsigned int BUCHSTABE[27][8];
BUCHSTABE[16][0]= 0xCF;
BUCHSTABE[16][1]= 0xDF;
BUCHSTABE[16][2]= 0xD8;
BUCHSTABE[16][3]= 0xD8;
BUCHSTABE[16][4]= 0xD8;
BUCHSTABE[16][5]= 0xF8;
BUCHSTABE[16][6]= 0x70; |
|
|
|
collink
Joined: 08 Jan 2010 Posts: 137 Location: Michigan
|
Re: PIC24 OUT of ROM |
Posted: Wed Jul 21, 2010 5:28 am |
|
|
richi-d wrote: | PIC24FJ128GA108
The compiler shows this message:
"Out of ROM, A segment or the program is too large MAIN"
If I delete 1 line I´m at 74% of ROM. Why am I at the Limit?
|
The Great Zambini will try to telepathically assess your situation.......... Nope, I have no idea. Wouldn't you like to be a little more specific?!? Which line do you delete and save 26% of ROM in doing so? Can you post the source code? |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Wed Jul 21, 2010 10:30 am |
|
|
My best guess from what little you give us is that you have too much code in a single page. Each function, including main(), must fit in a single page of ROM. If your PIC (I'm not familiar with the PIC24FJ128GA108) has 4 pages, and one function takes 26% of total ROM, the program will never fit. If you trim that big function to 24%, suddenly the program fits and you have lots of ROM left.
Look for a big function and find a way to split it up. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Thu Jul 22, 2010 12:23 am |
|
|
Basically, the PIC24/dsPIC instruction set doesn't use pages. Branches with limited reach are relative, +/- 32k. |
|
|
richi-d
Joined: 28 Aug 2007 Posts: 106
|
|
Posted: Thu Jul 22, 2010 2:37 am |
|
|
"Basically, the PIC24/dsPIC instruction set doesn't use pages."
Thats what I know, thats the reason why I´m wondering.
"Branches with limited reach are relative, +/- 32k."
Can you please explain? |
|
|
richi-d
Joined: 28 Aug 2007 Posts: 106
|
Re: PIC24 OUT of ROM |
Posted: Thu Jul 22, 2010 2:41 am |
|
|
collink wrote: | richi-d wrote: | PIC24FJ128GA108
The compiler shows this message:
"Out of ROM, A segment or the program is too large MAIN"
If I delete 1 line I´m at 74% of ROM. Why am I at the Limit?
|
The Great Zambini will try to telepathically assess your situation.......... Nope, I have no idea. Wouldn't you like to be a little more specific?!? Which line do you delete and save 26% of ROM in doing so? Can you post the source code? |
My Code is about 80k, do you think it´s a great idea to post it? I have a function with some code lines. I found out by deleting line after line that at one point the code fits, and adding one line more the error occours.
The compiler shows me 74% by deleting this line and ROM full after adding this line. I hope you understand what I mean... |
|
|
richi-d
Joined: 28 Aug 2007 Posts: 106
|
|
Posted: Thu Jul 22, 2010 2:49 am |
|
|
The complete error message is:
Code: | *** Error 71 "Main_V01.c" Line 4228(0,1): Out of ROM, A segment or the program is too large MAIN
Seg 00200-0FFFE, 780A left, need 7810
Seg 10000-157F8, 57FA left, need 7810
Seg 00000-00002, 0000 left, need 7810
Seg 00004-001FE, 0000 left, need 7810 |
|
|
|
richi-d
Joined: 28 Aug 2007 Posts: 106
|
|
Posted: Thu Jul 22, 2010 3:11 am |
|
|
I found in the program memory table following:
Code ends: 65320 (dec)
Memory end: 88054 (dec)
which is 65320/88054 = 0.74 = 74%
I´m wondering, the PIC has 128k.... what´s my error? |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Thu Jul 22, 2010 5:57 am |
|
|
You should show at least the magical line... |
|
|
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Thu Jul 22, 2010 8:23 am |
|
|
Not sure if this is your problem but...
The PIC's memory is constructed like a book. It has several pages that are used to store your code. Each page can only contain a certain amount of code though and will eventually fill up. The problem is that your main() or any other function must completely fit on a single page. It cannot carry over to the next page. Your main() appears to be too large to fit on a single page. To fix this, take a portion of your main() and create a function and call that function from main(). This will allow the newly created function to fit on another page and reduce the size of your main().
Clear as mud?
Ronald
-Never take a laxitive and a sleeping pill at the same time. |
|
|
richi-d
Joined: 28 Aug 2007 Posts: 106
|
|
Posted: Fri Jul 23, 2010 4:52 am |
|
|
The PIC24FJ has no pages...
I fixed the problem: Took a PIC24FJ192 .... now there is enough space for the rest of the program.
Seems that the compiler is calculating wrong values for memory space! |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Fri Jul 23, 2010 6:27 am |
|
|
The above posted error message seems to indicate, that PCD is unable to assign code space across 64k address boundaries. As said, the PIC24 program memory space is basically continuous, except for table operations, so this limitation isn't actually justified. It would be easy however to split the respective code entity to make it fit a PIC24FJ128. |
|
|
|