Topic : Code Banking query

Forum : 8051

Original Post
Post Information Post
March 6, 2012 - 9:10pm
Guest

Hi

The function unsigned char ValidateLUT ( void ) is in a different code bank.

For the statement:
return ( ValidateLUT ( ) ) ;

the RC51 compiler (3.08.10.0309) generated this code:

00B6 020000 R LJMP ValidateLUT
00B9 ?NXT25:
00B9 22 RET

Will the linker handle this correctly, i.e. replace the LJMP with a call to bank switching code?

When I spotted this, I felt happier to replace my code with:

Result = ValidateLUT ( ) ;
return (Result);

which generated the following code:

00B6 120000 R LCALL ValidateLUT
00B9 8F00 R MOV Result,R7
00BB ?NXT25:
00BB 22 RET

Was I worrying unnecessarily?

Thanks.

Damien

Replies
Post Information Post
+1
0
-1
March 7, 2012 - 10:48am
Raisonance Support Team

Hi Damien,

The linker doesn't know about LCALL, LJMP and any other instructions. It only deals with fix-ups and in your case, the fix-up is the same for LCALL and LJMP, so if the bank switching works with the LCALL, it must work with the LJMP.

Regards,

Stéphane