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 CCS Technical Support

PIC24 OUT of ROM

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



Joined: 28 Aug 2007
Posts: 106

View user's profile Send private message

PIC24 OUT of ROM
PostPosted: Wed Jul 21, 2010 4:08 am     Reply with quote

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

View user's profile Send private message Visit poster's website

Re: PIC24 OUT of ROM
PostPosted: Wed Jul 21, 2010 5:28 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Jul 21, 2010 10:30 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Jul 22, 2010 12:23 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Jul 22, 2010 2:37 am     Reply with quote

"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

View user's profile Send private message

Re: PIC24 OUT of ROM
PostPosted: Thu Jul 22, 2010 2:41 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Jul 22, 2010 2:49 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Jul 22, 2010 3:11 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Jul 22, 2010 5:57 am     Reply with quote

You should show at least the magical line...
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Thu Jul 22, 2010 8:23 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Jul 23, 2010 4:52 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Jul 23, 2010 6:27 am     Reply with quote

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.
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