Error Message : Complex Relocatable Expression

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Error Message : Complex Relocatable Expression

2,016 Views
mylim
Contributor IV
Hi, I encountered the above mentioned error message in my ISR routine ;
 
Code:
           bset   RXBITCNT,RXBUF+RXBYTECNT

 
RXBYTECNT is a counter counting the pointer for RXBUF.
RXBITCNT is a counter counting the bit.
 
any methods to resolve this?
Thanks.
 
Regards 
Labels (1)
0 Kudos
Reply
3 Replies

579 Views
tonyp
Senior Contributor II
Bit instructions for the HC(S)08 use a fixed number between 0 and 7 for the bit.  This is an immediate value, not a variable that contains the number.  In your case, RXBITCNT should be EQUed to the specific bit number.  To do what you want, you'll need to write a small routine that will move a bit to correct position (based on RXBITCNT) within the byte, and using LDA / OR (for BSET) or AND (with inverted mask for BCLR) / STA instructions, update the destination variable (RXBUF+RXBYTECNT) which again must specify an address directly (not as pointer, as I suspect you're trying to do by adding RXBUF + RXBYTECNT).

Also, some assemblers expect expressions to be inside brackets or similar decorations.

0 Kudos
Reply

579 Views
mylim
Contributor IV
Hi Tony,
Thanks.
I am not intending to add RXBUF to RXBYTECNT.
I am aware of the method you were suggesting.
I tried this stupid method of mine because i thought the method u suggest will take a bit long.
Seems like that's the only way?
0 Kudos
Reply

579 Views
CompilerGuru
NXP Employee
NXP Employee
Confused:
>I am not intending to add RXBUF to RXBYTECNT.
But in the original post:
>           bset   RXBITCNT,RXBUF+RXBYTECNT

Looks to me as if you would add them.

Anyway a "Complex Relocatable Expression" is anything which is not "Relocatable Expression"
(or a constant expression), so basically if the assembler takes both RXBUF & RXBYTECNT to be relocatable,
then the sum of the two is causing the "Complex Relocatable Expression".
To resolve it, one of the two should be a constant, say an EQU or SET defined before that
bset.
Basically the assembler does not support to emit the sum of two relocatable objects as fixups.

Daniel


0 Kudos
Reply