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

.LST and .M51 SFR mapping mismatches (uvision2 6.02 and 6.10)

Hi,

In an older version of my software, I use a specific SFR (CNTRL_REG) mapped on 0xC5 SFr address.
In the new version, I need to map it at 0xC1.
I thought it was very easy just by changing the definition line from

sfr CNTRL_REG = 0xC5
to
sfr CNTRL_REG = 0xC1

After compiling the newer version, we still get CNTRL_REG mapped to 0xC5 in the simulator disassembler. In the .m51 file, CNTRL_REG is also mapped to 0xC5, whereas .LST and .SRC files mapped it to 0xC1 as requested.

Anybody has an idea ?

Thanks for your help.

Arnaud DELEULE

  • Sorry for adding a new message, but I found the problem and I think that it may be interessant.

    In fact, all the problems come from the

    #pragma src
    line I put at the beginning of my .C file.

    When this line is commented, all is fine. The modification of SFR mapping is taken into account when I rebuild all the project.
    On the contrary, when this pragma line is active, any changes in the source code of my .C file concerning SFR mapping is ignored, whenever I rebuild all the project.

    Is it normal or is it a bug ?

    Arnaud DELEULE

  • Aha!

    The #pragma src directs the compiler to generate a .src assembly source file as its output; you must then pass the .src file to the Assembler to generate a .obj Object file.

    In uVision2, check the 'Assemble SRC File' option.

    If you use #pragma src, the compiler does not generate a .obj object file!
    If you have an old .obj file kicking around, the linker will still link it but it won't reflect the changes to your 'C' source!

    See the C51 Manual and the uVision2 "Getting Started" guide.

  • See the thread "how to compile c file that includes asm routines"

    http://www.keil.com/forum/msgpage.asp?MsgID=1003