S3C44B0X

如何使用J-Link GDB Server和IDA Pro除錯程式


main.s

  .equiv PCONG, 0x1d20040
  .equiv PDATG, 0x1d20044
  .equiv PUPG,  0x1d20048
  .equiv WTCON, 0x1d30000

  .text
  .global _start
_start:    b reset
_undef:    b .
_swi:      b .
_pabort:   b .
_dabort:   b .
_reserved: b .
_irq:      b .
_fiq:      b .

reset:
  ldr r0, =WTCON
  ldr r1, =0
  str r1, [r0]

  ldr r0, =PCONG
  ldr r1, =(1 << 10)
  str r1, [r0]

  ldr r0, =PDATG
loop:
  eor r1, #(1 << 5)
  str r1, [r0]
  ldr r2, =50000
1:
  subs r2, #1
  bne 1b
  b loop
  .end

main.ld

MEMORY {
  flash : ORIGIN = 0, LENGTH = 2M
}

SECTIONS {
  text : {
    *(.text)
  } > flash
}

編譯

$ arm-none-eabi-as -ggdb -mcpu=arm7 -o main.o main.s
$ arm-none-eabi-ld -T main.ld -o main.elf main.o
$ arm-none-eabi-objcopy -O binary main.elf main.bin

開啟J-Flash並且載入main.bin(位址0x0000)


F4(Erase Chip)


F5(Program)


開啟J-Link GDB Server(Init registers記得勾選)


選擇S3C44B0X


Listening on TCP/IP port 2331


IDA Pro載入main.bin


按下F9並且選擇Remote GDB debugger


按下F9並且輸入Listening Port 2331


接著就可以開始使用IDA Pro除錯程式


返回上一頁