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

DPP1 problem

Hi there!

I need some help with DPP (I think so).

code:

...
mov     r0, # _setP0

; some below

_setP0: scxt    SYSCON, # 4C0h
...

after compiling and linking label was placed into adress 0x44C2 (in .M66 file and in disassembler).
When I step over MOV command - in R0 was written 0x04C2 value, not 0x44C2. In disassembler I can see

00004482 E6F0C204  MOV      R0,#0x04C2

Why MM part of code is C2 04, not C2 44?

As I can understand - 0x44C2 placed into 1st memory page and must be accessed via DPP1. I filled DPP1 with 0x1 which gives 1st page from 0x4000 + concatenated 14bit address = 4000 + 4C2 = 44C2.

Some info:
Infenion 166
Memory model - small,
Rom - 0x0 - 0x10000
Ram - 0x20000 - 0x40000
Rtx-166 tiny
Reserve: 08h-0Bh,0ACh-0AFh,3000h-0031B8h,3200h-004428h

Any ideas?

  • Perhaps you could show the _setP0 entry in your map file? From your code...

    00004482 E6F0C204  MOV      R0,#0x04C2
    

    The opcode for that memory location correctly states 0x04C2 as shown in your memory snippet.

  • Hi Chris!

    in .m66 file:

    0044C2H     SYMBOL    LABEL     ---     ---   _setP0
    

    In disassembler:

    89:   mov     r0, # _setP0
    00004482 E6F0C204  MOV      R0,#0x04C2
    

    What does it mean?

  • I am not sure what problem you have as this is not the output I get. So I tried your example and my map file matches the code. I would suggest you contact Keil support...

    00012CH _setP0  LABEL ---  NCODE   MY_SECTION
    

    In the disassembler

    00000126 E6F02C01  MOV      R0,#0x012C
    

    So in my case I have the same memory located as the map file shows (both show the address 0x012C, the C166 is little endian so the bytes are flipped in memory).

    So I don't know how to help you.

  • HI again Chris!
    Thanks for trying.

    You got the SAME address because of your project is very SMALL (may be only one function in one c-file).
    I have the BIG project (6 files) and this function processed in the end of compiling.

    If i put this function in beginning of main c-file - it works as your sample (2 address are same), but i want to make my project more reasonable separated in files. It is not error in KEIL, so I don't want to contact to support. I just want to understand where I am wrong in my opinion about compiler\linker working.

    So, CAN ANYBODY ELSE SAY SOMETHING ABOUT THIS CASE?

    PS: thanks Chris for trying once more

  • Any warnings from the linker?

    DPP1 is used for accessing near constants (NCONST). The label _setP0 is not a near constant.

    Try:

    mov r0,#SOF _setP0
    

    Are you aware that r0 is the user stack pointer and you must not change it?

    Sauli

  • Hi Sauli !

    There are no any warnings.


    Try:
    mov r0,#SOF _setP0

    Yes, it's really works:

        90:          mov r0,#SOF _setP0
        91: 00004482 E6F0C244  MOV      R0,#0x44C2
    

    Thanks. I didn't know anything about PEC register loading before.