View previous topic :: View next topic |
Author |
Message |
Peter Pitzeier
Joined: 24 Apr 2005 Posts: 6 Location: Austria
|
PCM 2.734 Problems with Main() in bank 1 |
Posted: Mon Apr 25, 2005 12:08 am |
|
|
Hello *,
As long as Main() resides in bank 0 my programs work. But as my functions get bigger PCM decides at some point to move Main() to 0x0800 and from there it seems that Main() don't even start.
Someone experienced similiar trouble? Is it a bug known to this compiler release? Workaround? How to track down the problem? I'm not too familiar with assembler, the reason why I use a C-compiler.
Any help appreciated!
TIA,
Peter. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Apr 25, 2005 12:32 am |
|
|
What PIC are you using ?
Are you doing anything unusual, such as:
1. Mixing #asm and C code.
2. Using lots of floating point.
3. Using #org statements.
4. Using #separate statements. |
|
|
Peter Pitzeier
Joined: 24 Apr 2005 Posts: 6 Location: Austria
|
|
Posted: Mon Apr 25, 2005 3:12 am |
|
|
Device is 16F873. (Sorry, I didn't mention)
No #asm.
No floating point.
No #org.
No #separate.
Problems started when code size exceeded 50% (2K). Rom usage ist ~57% now.
I've played around with #org and #separate and sometimes it helps until code size increases again.
'
I'll have a LED blinking in main() to see, where it hangs. Also I'll post the LST-file of a non-working version.
tx |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Mon Apr 25, 2005 10:24 am |
|
|
Not exactly your version but it works just fine:
Code: |
MPASM
CCS PCM C Compiler, Version 2.708, 7910
Filename: relay.LST
ROM used: 7847 (96%)
Largest free fragment is 268
RAM used: 201 (84%) at main() level
228 (95%) worst case
Stack: 7 worst case (4 in main + 3 for interrupts)
0000 3018 00001 MOVLW 18
0001 008A 00002 MOVWF 0A
0002 2AFE 00003 GOTO 2FE
0003 0000 00004 NOP
0004 00FF 00005 MOVWF 7F
0005 0E03 00006 SWAPF 03,W
0006 1283 00007 BCF 03,5
0007 1303 00008 BCF 03,6
0008 00A1 00009 MOVWF 21
.
.
snip - snip
.
.
0000 09236 .................... void main(void)
0000 09237 .................... {
0000 09238 .................... UINT8 i; /* index to counter - not initialized because of ROM space */
0000 09239 .................... UINT8 bit_mask;
0000 09240 .................... UINT8 Fade_Flags;
1AFE 0184 09241 CLRF 04
1AFF 1383 09242 BCF 03,7
1B00 301F 09243 MOVLW 1F
1B01 0583 09244 ANDWF 03,F
1B02 309F 09245 MOVLW 9F
1B03 0084 09246 MOVWF 04
|
|
|
|
danielefilisetti
Joined: 27 Apr 2005 Posts: 3 Location: Italy
|
the same |
Posted: Thu Apr 28, 2005 10:13 am |
|
|
Hi Peter,
I got the same problem on PIC16F913.
When program become longher than 50% the compiler moves main() to 0x800, and the program doesn't run correctly?
CCS compiler bug????
How to force main() in the bank0?
Daniele |
|
|
Ttelmah Guest
|
|
Posted: Thu Apr 28, 2005 10:24 am |
|
|
Any possibility you are using ICD?. If so, then the problem is that the 'main' program has got long enough that it no longer fits in bank0, because of the other overheads in this bank (interrupt handlers etc.), but is also long enough that it overwrites the upper memory area used by the ICD system, when loaded in bank1. Shortening the size of the 'main', should allow this to be avoided.
Best Wishes |
|
|
Guest
|
|
Posted: Fri Apr 29, 2005 1:53 am |
|
|
hello *,
found out that the problem isn't just main() in the upper bank. it's almost always when the ISR (T0 overflow in this case) resides in the other bank. I've looked at the ISR in the LST-file and really don't understand what manipulation of PCLATH (0x0A) is all about. |
|
|
Guest
|
|
Posted: Fri Apr 29, 2005 1:56 am |
|
|
No, I haven't got an ICD. |
|
|
danielefilisetti
Joined: 27 Apr 2005 Posts: 3 Location: Italy
|
main in bank0, isr in bank1 |
Posted: Thu May 05, 2005 3:27 am |
|
|
Interrupt logic should keep PCl and PCH in the stack and jump to vector 004 (PCH=0) automatically, while return from interrupt instruction should recover PCL and PCH.
So, different bank locations should not be a problem. or not
Daniele |
|
|
|