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

Suddenly out of ROM

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



Joined: 16 Oct 2010
Posts: 56
Location: Florissant, CO

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

Suddenly out of ROM
PostPosted: Mon Aug 04, 2025 11:37 am     Reply with quote

Hello programming Friends!

I had a weird issue that I can definitely work around, but I wanted to see if someone had an opinion as to what happened. I am using a PIC18F57Q84 with compiler version 5.114. I am loading an EEPROM with entries for a look-up table, so this is just a lot of monotonous code. I compiled about 7000 lines of code, and it said that I had used 52% of my available ROM. I wrote 2000 more lines, and the compiler "choked". Here is what it said

Code:
***Error 71 "C:\Pic....Main.c"Line 230(1,2); Out of ROM, A segment or the program is too large  WriteAllValuesToEEPROM
  Seg 00068-0FFFE, F1BC left, need 11EF0
  Seg 10000-1FFFE, 0000 left, need 11EF0
  Seg 00000-00002, 0000 left, need 11EF0 Reserved
  Seg 00004-00006, 0004 left, need 11EF0
  Seg 00008-00066, 0000 left, need 11EF0 Reserved

    1 Errors
Build Failed.


So, I commented out the extra lines so that it would compile, and it loaded the data into the EEPROM without a hitch.

Previously, about 2000 lines of code was taking around 10% of the ROM, so I expected it to be 62% when I got done writing, not to choke and say I was out of ROM. Is there a limit to how much ROM a single file can use or something?

Again, I can work around this regardless, but it would be good to know why I had 48% of my ROM magically vanish. Thanks for the input!
_________________
Life is too short to only write code in assembly...
Jerson



Joined: 31 Jul 2009
Posts: 130
Location: Bombay, India

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

PostPosted: Mon Aug 04, 2025 8:19 pm     Reply with quote

Usually, what this means is the code / a part of it doest not fit into a memory segment. The way you can resolve this is to look into making certain parts SEPARATE (keyword)
Ttelmah



Joined: 11 Mar 2010
Posts: 19914

View user's profile Send private message

PostPosted: Tue Aug 05, 2025 7:59 am     Reply with quote

Yes. Jerson is spot on.
The point is you don't have one single 'lump' of program memory, it is
divided into pages. Your code doing this job it being built as one 'lump',
so when you went over 50%, it will no longer fit into the page. Previously,
at 52%, you probably had several other bits occupying perhaps just a few
percent of this, that the compiler could put into another page, so you had this in one page and then just under 50% in the second. Now this single lump
will no longer fit.
You need to split it and it can then fit....
temtronic



Joined: 01 Jul 2010
Posts: 9560
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Aug 05, 2025 9:52 am     Reply with quote

you may be able to break down the HUGE lookup table into 'segment fitting' chunks.
IE if it's a graphic database, consider segments for 'upper case', 'lower case' 'special symbols'. You'll need to add a simple 'test' to goto the correct table of course.
SkeeterHawk



Joined: 16 Oct 2010
Posts: 56
Location: Florissant, CO

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

Thanks for the input!!
PostPosted: Tue Aug 05, 2025 12:19 pm     Reply with quote

Thank you all for the input on this. I suspected that something like this is the issue, but I am a little surprised that I have never run into this before. So if I was writing this in assembly, would it just stop assembling the code unless I put a new Origin statement in the middle of it somewhere? Obviously this is a function of the hardware and would carry over into assembly as well, so I am just curious.

Thanks again for all of your input!! Very Happy
_________________
Life is too short to only write code in assembly...
dyeatman



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

View user's profile Send private message

PostPosted: Tue Aug 05, 2025 12:40 pm     Reply with quote

If you go to PIC24 or DsPIC the problem goes away...
_________________
Google and Forum Search are some of your best tools!!!!
SkeeterHawk



Joined: 16 Oct 2010
Posts: 56
Location: Florissant, CO

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

PostPosted: Tue Aug 05, 2025 2:08 pm     Reply with quote

dyeatman wrote:
If you go to PIC24 or DsPIC the problem goes away...


Good to know!! Thanks for the tip! I'd post a thumbs up...if there was one... Rolling Eyes
_________________
Life is too short to only write code in assembly...
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