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

Still out of ROM after changing to larger PIC
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
kdlee



Joined: 13 Jan 2011
Posts: 10

View user's profile Send private message

Still out of ROM after changing to larger PIC
PostPosted: Thu Jan 13, 2011 7:10 pm     Reply with quote

I was out of ROM space using the 18F24K22 so I switched to the 18F25K22, which should have double the program space. When I compile, it complains that it is out of ROM space that is exactly the same as when I was using the smaller chip.

Here is the print out regardless of which device is selected:
Out of ROM, A segment or the program is too large MAIN
Seg 000C6-01CBE, 02A4 left, need 0368
Seg 00000-00002, 0000 left, need 0368
Seg 00004-00006, 0004 left, need 0368
Seg 00008-000C4, 0000 left, need 0368

I changed the device via the MPLAB IDE. I would think the message should change when changing the device. BTW, I'm using the CCS C compiler, ver 4.112.

Any help would be appreciated. Thanks in advance!

Kevin
Ttelmah



Joined: 11 Mar 2010
Posts: 19552

View user's profile Send private message

PostPosted: Fri Jan 14, 2011 3:33 am     Reply with quote

The message won't change. It is a case of the 'lump' of code you have being too large to fit in the _bank_ of the chip. You need to split your code up. Use subroutines, rather than having too much stuff in one piece (typically main - it is in your case), and declare the routines as 'separate'.
A search here will find lots of examples....

Best Wishes
kdlee



Joined: 13 Jan 2011
Posts: 10

View user's profile Send private message

PostPosted: Fri Jan 14, 2011 12:25 pm     Reply with quote

Hmmm, are you sure? All the remaining segments are full. Shouldn't something show there is more space?

When I comment out code to get it to fit in the smaller PIC and then switch to the larger PIC, the amount of ROM space used is the same. Shouldn't the used ROM space get cut in half when going to a PIC with double the program space?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jan 14, 2011 12:37 pm     Reply with quote

Run this program in MPLAB simulator with "UART1" enabled for output.
See what the compiler thinks is the ROM size for each type of PIC:
Code:

#include <18F24K22.h>
#fuses INTRC_IO,NOWDT
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
//======================================
void main(void)
{

printf("ROM size = %lu \n\r" getenv("PROGRAM_MEMORY"));

while(1);
}

How to use "UART1" in MPLAB simulator to display printf() output in MPLAB:
http://www.ccsinfo.com/forum/viewtopic.php?t=23408&start=1
kdlee



Joined: 13 Jan 2011
Posts: 10

View user's profile Send private message

PostPosted: Fri Jan 14, 2011 1:14 pm     Reply with quote

I ran both and got the same answer:

ROM size = 7360

Does this mean the device database in my compiler version is incorrect?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jan 14, 2011 1:24 pm     Reply with quote

I installed vs. 4.112 and ran it for the 18F24K22, and the 18F25K22
and I got this:
Code:
ROM size = 16384

ROM size = 32768

Maybe you need to re-install the compiler.

You don't have some kind of demo or student version, do you ?
kdlee



Joined: 13 Jan 2011
Posts: 10

View user's profile Send private message

PostPosted: Fri Jan 14, 2011 1:36 pm     Reply with quote

I have a full version of the compiler. I vaguely remember having some weirdness when I first installed the compiler, but I didn't pay much attention to it since I thought it was working.

I'll reinstall my compiler. Thanks!
kdlee



Joined: 13 Jan 2011
Posts: 10

View user's profile Send private message

PostPosted: Fri Jan 14, 2011 3:10 pm     Reply with quote

I just installed 4.116 and it is doing the same thing. Any ideas on what to do now? Thanks!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jan 14, 2011 3:23 pm     Reply with quote

I just ran it for the 18F24K22 in vs. 4.116 and got this:
Quote:
ROM size = 16384


Are you doing these exact steps ?

1. Install vs. 4.116.

2. Make a test project if you don't already have one.

3. Copy and paste the exact program that I posted into MPLAB,
into the source file associated with the test project.

4. In the MPLAB Configure / Select Device menu, set it for 18F24K22.

5. In the MPLAB Debugger / Select Tool menu, set it for MPLAB SIM.

6. In the MPLAB Debugger / Settings / UART1 IO menu, select the
tickboxes for "Enable UART1 IO" and "Window".

7. Compile the program.

8. Press the "Run" arrow on the MPLAB menu bar (or go to the Debugger
menu and select "Run").

It should display the correct number.
kdlee



Joined: 13 Jan 2011
Posts: 10

View user's profile Send private message

PostPosted: Fri Jan 14, 2011 3:27 pm     Reply with quote

I did everything as you listed.

I just tried to install the compiler into a new directory in case there were some leftover files from the previous compiler installation and when I ran it, I got the same old answer. I'm at a loss now. Any idea where this limit is coming from? I would think it is from the device database. Could I be pointing at a corrupted device database somewhere?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jan 14, 2011 3:38 pm     Reply with quote

Search for multiple installations of the compiler and get rid of all them
except for one.
kdlee



Joined: 13 Jan 2011
Posts: 10

View user's profile Send private message

PostPosted: Fri Jan 14, 2011 4:06 pm     Reply with quote

I found an extra version of the compiler under Microchip\ThirdParty\PICC and removed that. No change.

I removed all compilers installed on the machine and then reinstalled from scratch. No change.

Argh...
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jan 14, 2011 5:09 pm     Reply with quote

What's your version of MPLAB ?

Also, if you have the full IDE version of the compiler, start up the
Device Editor and look at the ROM size for the 18F24K22 in it.
kdlee



Joined: 13 Jan 2011
Posts: 10

View user's profile Send private message

PostPosted: Fri Jan 14, 2011 6:07 pm     Reply with quote

MPLAB version is 8.56.

I tried running the device editor, but nothing happens when I click on the icon. Not sure what else to try. Thanks!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jan 14, 2011 6:14 pm     Reply with quote

I don't have the full CCS IDE, so I can't help you any more on it,
but I have to wonder if you have a Demo version or some other
limited version, or something else. If stuff doesn't work, you
don't have the full working IDE compiler.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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