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

PCM 2.734 Problems with Main() in bank 1

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Peter Pitzeier



Joined: 24 Apr 2005
Posts: 6
Location: Austria

View user's profile Send private message

PCM 2.734 Problems with Main() in bank 1
PostPosted: Mon Apr 25, 2005 12:08 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Apr 25, 2005 12:32 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Apr 25, 2005 3:12 am     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Mon Apr 25, 2005 10:24 am     Reply with quote

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

View user's profile Send private message Visit poster's website

the same
PostPosted: Thu Apr 28, 2005 10:13 am     Reply with quote

Hi Peter, Very Happy
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???? Twisted Evil

How to force main() in the bank0? Question

Daniele
Ttelmah
Guest







PostPosted: Thu Apr 28, 2005 10:24 am     Reply with quote

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








PostPosted: Fri Apr 29, 2005 1:53 am     Reply with quote

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








PostPosted: Fri Apr 29, 2005 1:56 am     Reply with quote

No, I haven't got an ICD.
danielefilisetti



Joined: 27 Apr 2005
Posts: 3
Location: Italy

View user's profile Send private message Visit poster's website

main in bank0, isr in bank1
PostPosted: Thu May 05, 2005 3:27 am     Reply with quote

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 Question

Daniele
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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