Jump to content
Sign in to follow this  
cmjones

C2c Compile Error: 'location Of '0' Already...'

Recommended Posts

I'm using C2C-plus version 5.2.2e on a PIC16F877. I'm gradually building up a fairly complex project. I've just added one more source file and now it refuses to compile, giving me this sequence of errors at the end of the compile:

 

Warning: Not known opcode 'dw B'11111101110010''

asm error: Location of '0' already occupied or not valid

asm error: Location of '0' already occupied or not valid

asm error: Location of '0' already occupied or not valid

asm error: Wrong code page

 

Looking at the .lst file it produces, my suspicion is that it's running out of RAM and for some reason not using the other 3 banks available. Anyone know if my hunch is correct? If so, how do I fix it? And why do I have a feeling that I'm going to have to upgrade to the latest BoostC? ;)

 

The only reason I haven't upgraded so far is that I have production code written in this version and don't want to meddle with it if I can help it...

 

Chris

Share this post


Link to post
Share on other sites
I'm using C2C-plus version 5.2.2e on a PIC16F877. I'm gradually building up a fairly complex project. I've just added one more source file and now it refuses to compile, giving me this sequence of errors at the end of the compile:

 

Warning: Not known opcode 'dw B'11111101110010''

asm error: Location of '0' already occupied or not valid

asm error: Location of '0' already occupied or not valid

asm error: Location of '0' already occupied or not valid

asm error: Wrong code page

 

Looking at the .lst file it produces, my suspicion is that it's running out of RAM and for some reason not using the other 3 banks available. Anyone know if my hunch is correct? If so, how do I fix it? And why do I have a feeling that I'm going to have to upgrade to the latest BoostC?  ;)

 

The only reason I haven't upgraded so far is that I have production code written in this version and don't want to meddle with it if I can help it...

 

The C2C compilers generated assembly that was tan processed by MPASM. That's why you can use some MPASM mnemonics in the code compiled with C2C. BoostC is a stand alone tool that does not need and does not use any external assembler. That's why you can not use MPASM operations in the code compiled with BoostC.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites
The C2C compilers generated assembly that was tan processed by MPASM. That's why you can use some MPASM mnemonics in the code compiled with C2C. BoostC is a stand alone tool that does not need and does not use any external assembler. That's why you can not use MPASM operations in the code compiled with BoostC.

 

Regards,

Pavel

Thanks for the response, but I wasn't even using BoostC - just C2C. The error was occuring before I'd even pressed the 'assemble' button, so I thought MPASM couldn't be part of the problem. It only seemed to happen when my code went above a certain size, and appeared to be due to the RAM usage.

 

However, answering my own question, I tried out the demo of BoostC and the problem went away once I'd ported the code (which required much fiddling about making global variables 'extern', I assume due to the different compilation model). Spurred on by that I've paid for the full professional licence so I am once again a happy customer, albeit £100 poorer...

 

Chris

Share this post


Link to post
Share on other sites
asm error: Wrong code page

 

I get the same error on C2C-Plus 5.9.7e.

Target - PIC16F767

Program size - almost 7k (the maximum code memory size is 8k)

I also have some data at fixed addresses in the code memory.

I ran into this problem earlier and solved it by moving the data at other locations, but now the program is too big to do this again.

Any idea?

 

Also, the compiler has a bug in accessing data stored in the code memory.

 

label_0194

movlw D'10'

subwf _i_main, W

btfsc STATUS, C

goto label_0195

movf _i_main, W

movwf _code_tmp_0000

addlw LOW(arr000+1)

movlw HIGH(arr000+1)

btfsc STATUS, C

addlw 1 ; ******

movwf PCLATH

movf _code_tmp_0000 , W

call arr000

bsf STATUS, RP0

bcf STATUS, RP1

movwf _m_main

incf _i_main, F

goto label_0194

label_0195

 

****** adding 1 to the high byte of the address of the first byte could result in changing the bit 3 of PCLATH (if bits 2, 1 and 0 are set). In this case the call is made to a wrong address.

 

Dan

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...