This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ECALL from C code.

I'm using the Philips 51MX chip (P87C51MB2)
and trying to make sense out of how to
do an extended (23-bit) ECALL or EJMP
using the Keil compiler. I'd very much
like to have this call generated from 'C'
as my emulator will allow me to debug the
code in 'C'. If I use the SRC directive
to generate assembly code from my 'C'
(in order to insert an ASM statement),
then the emulator will only allow debugging in assembler.

I've tried some variations on the example
in the manual for generating a call to
a hard-coded address, but the example is based on the 16-bit addressing of the 8051 and doesn't generate an ECALL.

Can someone give me an example? Or will I
have to wait for a bug fix from Keil?

Thanks,

--Ed

Parents
  • Well, I found a workaround for my problems.
    Turns out there is a bug in the AX51 assembler that I've reported to Keil.

    The bug goes like this - I defined some
    bit definitions for the S1CON register,
    to easily access such things as TI_1 and
    RI_1. Keil defined this extended SFR address, but not addresses for the bits.
    Anyway, compiling the code with the C compiler directly into machine code produced
    the correct binary which worked fine. But
    when I just turned on the SRC directive the
    same code stopped working because the instructions were now refering to S0CON,
    not S1CON.

    The workaround is to mask off these bits
    from S1CON, rather than set up the direct access definitions, such as S1CON^1.

    So, now I can use SRC and embed ECALL/EJMP
    into my code.

Reply
  • Well, I found a workaround for my problems.
    Turns out there is a bug in the AX51 assembler that I've reported to Keil.

    The bug goes like this - I defined some
    bit definitions for the S1CON register,
    to easily access such things as TI_1 and
    RI_1. Keil defined this extended SFR address, but not addresses for the bits.
    Anyway, compiling the code with the C compiler directly into machine code produced
    the correct binary which worked fine. But
    when I just turned on the SRC directive the
    same code stopped working because the instructions were now refering to S0CON,
    not S1CON.

    The workaround is to mask off these bits
    from S1CON, rather than set up the direct access definitions, such as S1CON^1.

    So, now I can use SRC and embed ECALL/EJMP
    into my code.

Children
No data