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

LPC2104

I am a newbie to ARM and KEIL, I wrote a samll program in assembly and try to simulate it using debuger, I noticed that the PC value is same as the line which is just executed (i.e. marked with green rectangle) but because the arm uses 3 stage pipe line I was expecting to see PC is 8 Byte ahead to the line which is executed. folowing is the code.

GLOBAL Reset_Handler AREA Reset,CODE,READONLY ENTRY
Reset_Handler MOV R0,#0x11 MOV R1,R0,LSL#1 MOV R2,R1,LSL#1
STOP B STOP

END

Parents
  • Thanks for all your post on my question,

    I tested debugger by LDR PC,[PC,#4] as you can see in following code and it worked they way that if it was in thumb state (but T in CPSR was 0).

         5:                 MOV R0,#0x11
    0x00000000  E3A00011  MOV       R0,#0x00000011
         6:                 LDR PC,[PC,#4]
    0x00000004  E59FF004  LDR       PC,[PC,#0x0004]
         7:                 MOV R1,R0,LSL#1
    0x00000008  E1A01080  MOV       R1,R0,LSL #1
         8:                 MOV R2,R1,LSL#1
    0x0000000C  E1A02081  MOV       R2,R1,LSL #1
         9: STOP    B STOP
    0x00000010  EAFFFFFE  B         0x00000010
    

    After executing line 6 it jumped to line 8, which means the PC was 0x00000008 rather than being 0x0000000C.

    This could be the case if ARM is in THUMB state, but not in ARM state.

Reply
  • Thanks for all your post on my question,

    I tested debugger by LDR PC,[PC,#4] as you can see in following code and it worked they way that if it was in thumb state (but T in CPSR was 0).

         5:                 MOV R0,#0x11
    0x00000000  E3A00011  MOV       R0,#0x00000011
         6:                 LDR PC,[PC,#4]
    0x00000004  E59FF004  LDR       PC,[PC,#0x0004]
         7:                 MOV R1,R0,LSL#1
    0x00000008  E1A01080  MOV       R1,R0,LSL #1
         8:                 MOV R2,R1,LSL#1
    0x0000000C  E1A02081  MOV       R2,R1,LSL #1
         9: STOP    B STOP
    0x00000010  EAFFFFFE  B         0x00000010
    

    After executing line 6 it jumped to line 8, which means the PC was 0x00000008 rather than being 0x0000000C.

    This could be the case if ARM is in THUMB state, but not in ARM state.

Children
No data