|
|
View previous topic :: View next topic |
Author |
Message |
Simon Guest
|
isr() out of ROM |
Posted: Tue Jul 22, 2003 6:45 pm |
|
|
Hi,
I got some error message like this:
isr
Seg 0004-01AD, 01AA left, need 01AC
Seg 01AE-07FF, 004D left, need 01AC
Error[71] test.c 322 : Out of ROM, A segment or the program is too large
isr() has to be in the segment starting with 0x0004, but how can we increase the size of this segment? I tried to use #ORG, but seems no use and generated some error message.
my isr() starts like this:
#INT_GLOBAL
isr()
{
#asm
movwf W0 ; protect W value
How can I reserve a segement, say, 0x0004 to 0x0200 for this isr()?
Please help. Thank you!
Simon
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516271 |
|
|
R.J.Hamlett Guest
|
Re: isr() out of ROM |
Posted: Wed Jul 23, 2003 2:42 am |
|
|
:=Hi,
:=
:=I got some error message like this:
:=
:= isr
:= Seg 0004-01AD, 01AA left, need 01AC
:= Seg 01AE-07FF, 004D left, need 01AC
:=Error[71] test.c 322 : Out of ROM, A segment or the program is too large
:=
:=isr() has to be in the segment starting with 0x0004, but how can we increase the size of this segment? I tried to use #ORG, but seems no use and generated some error message.
:=
:=my isr() starts like this:
:=
:=#INT_GLOBAL
:=isr()
:={
:=#asm
:= movwf W0 ; protect W value
:=
:=How can I reserve a segement, say, 0x0004 to 0x0200 for this isr()?
:=
:=Please help. Thank you!
:=
:=Simon
It is probably _not_ the ISR (unless it is very large and convoluted). The problem is that the memory in the PIC, is in the form of a series of pages. Now the compiler, for a lot of functions, which are only used once, will make these 'inline' (which produces faster overall code, but results in the single function, getting much larger). Then the function calling these, gets sequentially larger as routines are added. The message you are getting, is saying, that the two pages, have respectively 1AA bytes, and 004D bytes left available, and you have a single function, that is 1AC bytes long (and hence too long to fit in either of these gaps). Notice that the segment at 004, has three bytes allready used. These probably represent a 'GoTo' instruction to jump to the interrupt handler, rather than the handler itself.
Start by trying to work out what function in your code, is likely to be the largest on (look for things like large 'switch' statements, with lots of seperate entries, and routines with a lot of printf statements). Then look for any small subroutines, called by this 'suspect' function, that are not 'speed critical'. Add the declaration '#SEPERATE' in front of these subroutines, (and the same in front of any 'prototype' declarations).
Hopefully, this (which forces the subroutines to be 'seperated' into different pieces of code - but has the downside, that the stack useage will grow significantly), will then 'split' the routine enough, to allow it all to work.
If you cannot identify the culprit, consider changing the chip declaration temporarily, to a 'brother' chip, with much larger ROM space. Hopefully the code will then compile, and you can look at the call tree, and see which routine is causing the problem.
Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516278 |
|
|
Dave Yeatman Guest
|
Re: isr() out of ROM |
Posted: Wed Jul 23, 2003 9:16 am |
|
|
You didn't say what chip or compiler version you are using. I assume it is the 16x series.
Did you include the "device *=16" line??
Just a thought...
Dave
:=Hi,
:=
:=I got some error message like this:
:=
:= isr
:= Seg 0004-01AD, 01AA left, need 01AC
:= Seg 01AE-07FF, 004D left, need 01AC
:=Error[71] test.c 322 : Out of ROM, A segment or the program is too large
:=
:=isr() has to be in the segment starting with 0x0004, but how can we increase the size of this segment? I tried to use #ORG, but seems no use and generated some error message.
:=
:=my isr() starts like this:
:=
:=#INT_GLOBAL
:=isr()
:={
:=#asm
:= movwf W0 ; protect W value
:=
:=How can I reserve a segement, say, 0x0004 to 0x0200 for this isr()?
:=
:=Please help. Thank you!
:=
:=Simon
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516284 |
|
|
Simon Guest
|
Re: isr() out of ROM |
Posted: Wed Jul 23, 2003 11:36 am |
|
|
I am using 16X65 and have things this:
#include <16C65.h>
#fuses HS, NOWDT, NOPROTECT
Thanks your help, but seems the problem is not #SEPARATE
I have already add #SEPARATE in front of my two largest fuctions. Before I do so, the error message like this:
isr
Seg 0004-03F5, 03F2 left, need 03F4
Seg 03F6-07FF, 002D left, need 03F4
Error[71] test.c 319 : Out of ROM, A segment or the program is too large
I don't understand how the segement is defined by compiler, it seems that if seg 0004-03F5 just increase size by 2, my program could compile.
Please help, Thank you!
Simon
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516289 |
|
|
Dave Yeatman Guest
|
Re: isr() out of ROM |
Posted: Wed Jul 23, 2003 1:35 pm |
|
|
Simon,
OK, but again, did you include the line:
device *=16
This should be above the #include <16c85.H> statement. This line enables 16 bit pointers. According to the datasheet, this is a 4K device where you should have much more than 0x7FF available.
dave
:=I am using 16X65 and have things this:
:=#include <16C65.h>
:=#fuses HS, NOWDT, NOPROTECT
:=
:=Thanks your help, but seems the problem is not #SEPARATE
:=
:=I have already add #SEPARATE in front of my two largest fuctions. Before I do so, the error message like this:
:=
:= isr
:= Seg 0004-03F5, 03F2 left, need 03F4
:= Seg 03F6-07FF, 002D left, need 03F4
:=
:=Error[71] test.c 319 : Out of ROM, A segment or the program is too large
:=
:=I don't understand how the segement is defined by compiler, it seems that if seg 0004-03F5 just increase size by 2, my program could compile.
:=
:=Please help, Thank you!
:=
:=Simon
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516295 |
|
|
R.J.Hamlett Guest
|
Re: isr() out of ROM |
Posted: Wed Jul 23, 2003 2:27 pm |
|
|
:=I am using 16X65 and have things this:
:=#include <16C65.h>
:=#fuses HS, NOWDT, NOPROTECT
:=
:=Thanks your help, but seems the problem is not #SEPARATE
:=
:=I have already add #SEPARATE in front of my two largest fuctions. Before I do so, the error message like this:
:=
:= isr
:= Seg 0004-03F5, 03F2 left, need 03F4
:= Seg 03F6-07FF, 002D left, need 03F4
:=
:=Error[71] test.c 319 : Out of ROM, A segment or the program is too large
:=
:=I don't understand how the segement is defined by compiler, it seems that if seg 0004-03F5 just increase size by 2, my program could compile.
:=
:=Please help, Thank you!
:=
:=Simon
Adding #seperate, in front of the largest functions, is _not_ what you have to do. You have to seperate, what _makes_ them large. Either using the seperate directive on small subroutines that are called in these functions, which may otherwise end up being inline, or splitting the large functions into two (or more) parts. If you have the code compiling with a small piece remarked out, you can look at the call tree, and see what is large, and which subroutines are inline, and split things as necessary. This _is_ your problem, and a very common one on the older PICs, when code gets large.
Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516298 |
|
|
R.J.Hamlett Guest
|
Re: isr() out of ROM |
Posted: Wed Jul 23, 2003 2:29 pm |
|
|
:=Simon,
:=OK, but again, did you include the line:
:=
:=device *=16
:=
:=This should be above the #include <16c85.H> statement. This line enables 16 bit pointers. According to the datasheet, this is a 4K device where you should have much more than 0x7FF available.
:=
:=dave
Actually, this could make things worse...
The need for *=16, is decided by how much RAM is being used, not the amount of ROM. If he is only using a few RAM variables, removing this, results in smaller code. Adding '*=16', will typically make code perhaps 10 to 20\% larger.
Best Wishes
:=:=I am using 16X65 and have things this:
:=:=#include <16C65.h>
:=:=#fuses HS, NOWDT, NOPROTECT
:=:=
:=:=Thanks your help, but seems the problem is not #SEPARATE
:=:=
:=:=I have already add #SEPARATE in front of my two largest fuctions. Before I do so, the error message like this:
:=:=
:=:= isr
:=:= Seg 0004-03F5, 03F2 left, need 03F4
:=:= Seg 03F6-07FF, 002D left, need 03F4
:=:=
:=:=Error[71] test.c 319 : Out of ROM, A segment or the program is too large
:=:=
:=:=I don't understand how the segement is defined by compiler, it seems that if seg 0004-03F5 just increase size by 2, my program could compile.
:=:=
:=:=Please help, Thank you!
:=:=
:=:=Simon
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516299 |
|
|
|
|
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
|