View previous topic :: View next topic |
Author |
Message |
bdrmachine
Joined: 24 Jan 2010 Posts: 14
|
Out of memory error? |
Posted: Sun Jan 30, 2011 5:58 pm |
|
|
I had a working program before I switched processors from a 18f2550 (32k flash) to a 18f26k22 (64k flash). Even though the memory size doubled I get the following error:
Executing: "C:\Program Files (x86)\PICC\Ccsc.exe" +FH "main.c" #__DEBUG=1 +ICD +DF +LN +T +A +M +Z +Y=9 +EA #__18F26K22=TRUE >>> Warning 203 "main.c" Line 136(1,1): Condition always TRUE *** Error 71 "main.c" Line 454(2,3): Out of ROM, A segment or the program is too large MAIN Seg 00004-01CBE, 018A left, need 0568 Seg 00000-00002, 0000 left, need 0568
What am I doing wrong? |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Jan 30, 2011 6:21 pm |
|
|
Do a test. Run this program in MPLAB simulator and see what the
compiler thinks the Program Memory size is:
Code: |
#include <18F26K22.h>
#fuses INTRC_IO,NOWDT,PUT,BROWNOUT,NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, UART1, ERRORS)
//======================================
void main(void)
{
printf("ROM size is: %lx \r", getenv("PROGRAM_MEMORY"));
while(1);
} |
Also post your compiler version. |
|
![](templates/subSilver/images/spacer.gif) |
bdrmachine
Joined: 24 Jan 2010 Posts: 14
|
|
Posted: Sun Jan 30, 2011 8:03 pm |
|
|
The memory usage gauge reads 121 bytes using version 4.111 |
|
![](templates/subSilver/images/spacer.gif) |
bdrmachine
Joined: 24 Jan 2010 Posts: 14
|
|
Posted: Sun Jan 30, 2011 8:05 pm |
|
|
Sorry I forgot to add the compiler states 3%
The output from the printf is "ROM size is: 1cc0" |
|
![](templates/subSilver/images/spacer.gif) |
bdrmachine
Joined: 24 Jan 2010 Posts: 14
|
|
Posted: Mon Jan 31, 2011 7:30 am |
|
|
Where is the compiler getting its' part specific memory size. Is this pulled from the top part of the header file? I did notice that the ram size was stated as 512. I changed it to 3896 as stated in the data sheet. This had no change to the out of rom error. One thing I noticed is that the error is always reported as being 2 lines past the end of the file. e.g. if my main .c file is 455 lines long it reports the error at line 457. If I delete any 4 lines the error reports line 443. |
|
![](templates/subSilver/images/spacer.gif) |
dyeatman
Joined: 06 Sep 2003 Posts: 1924 Location: Norman, OK
|
|
Posted: Mon Jan 31, 2011 7:43 am |
|
|
The size comes from the devices.dat file, not from the header. My header
(in version 4.114) shows 512 RAM but the devices.dat files shows the correct
amount (3896). If you have the IDE you can view/edit the file using the
device editor. I am not in a position right now to load 4.111 to check the
devices.dat file for that version. _________________ Google and Forum Search are some of your best tools!!!! |
|
![](templates/subSilver/images/spacer.gif) |
levdev
Joined: 19 May 2010 Posts: 36 Location: UK
|
|
Posted: Tue Feb 08, 2011 3:49 am |
|
|
I have a similar problem converting from a PIC18F26K20 to a PIC18F26K22. My ROM usage goes from 10% to 90%, but the output code is the same size.
I found that removing the directive
fixed the problem, but obviously disables the debug capability. I have emailed CCS about the problem and will post a reply here once I get one.
bdrmachine, did you have this directive in your code, and does removing it solve the problem for you? Have you found another resolution to this problem? |
|
![](templates/subSilver/images/spacer.gif) |
|