View previous topic :: View next topic |
Author |
Message |
valemike Guest
|
ICD2 stops working when program is at 98 to 99% ROM |
Posted: Tue Aug 31, 2004 5:46 am |
|
|
First time i experienced this. I'm using a PIC18F252. The ICD2 worked fine, til I hit around 98 to 99% rom usage. Then it stopped working at the main() statement. However, when I program the chip and let it run freely w/o the ICD2, all is fine.
My worst case stack usage is supposedly only 8 deep. I believe i can go to 32 deep. I suspect that the ICD2 debug executive is overwriting some of my code. Anyone have this happen to them? |
|
|
Haplo
Joined: 06 Sep 2003 Posts: 659 Location: Sydney, Australia
|
|
Posted: Tue Aug 31, 2004 7:09 am |
|
|
Remember, ICDs put a small piece of code at the end of memory of the target to enable the debugging and communication with the ICD board.
I'm not sure about ICD2, but in the case of CCS ICDS, for the PIC18 series, the size of this module is around 800 bytes. |
|
|
Ttelmah Guest
|
Re: ICD2 stops working when program is at 98 to 99% ROM |
Posted: Tue Aug 31, 2004 7:19 am |
|
|
valemike wrote: | First time i experienced this. I'm using a PIC18F252. The ICD2 worked fine, til I hit around 98 to 99% rom usage. Then it stopped working at the main() statement. However, when I program the chip and let it run freely w/o the ICD2, all is fine.
My worst case stack usage is supposedly only 8 deep. I believe i can go to 32 deep. I suspect that the ICD2 debug executive is overwriting some of my code. Anyone have this happen to them? |
Read the ICD2 data sheet.
Under the 'trade-offs' section, it says:
Use of some target system resources, such as I/O pins, program memory, and stack space.
The .hex file uploaded to the ICD, shows the area being used. I'm suprised you can get as high as 98% before hitting problems. This is the classic 'downside' of the ICD, versus the ICE systems.
Best Wishes |
|
|
valemike Guest
|
|
Posted: Tue Aug 31, 2004 7:43 am |
|
|
Thanks guys.
Is there a way to tell the compiler to "keep-out" of the last bytes that the ICD will use? Albeit, i'll get a compilation error telling me i'm out of ROM, but i'm just wondering if it's possible.
-Mike |
|
|
alexbilo
Joined: 01 Jun 2004 Posts: 39 Location: Trois-Rivières
|
|
Posted: Tue Aug 31, 2004 9:01 am |
|
|
To reserve memory you can use #org start,end {}
This way you reserve the specified block and you don't write any data in it. You'll get the Out of ROM error, but at least you'll know when your code is too big! _________________ Alex |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Aug 31, 2004 11:08 am |
|
|
Did you specify ICD=TRUE ? |
|
|
|