網頁

2014年9月2日 星期二

[EZ-USB FX3] Debug with J-Link GDB


這邊主要是記錄在使用 J-Link debug 的時候, 需要進行的操作. 因為對每一個 project 都需要設定, 所以只好記錄起來.

Create Debug Configuration

1. 在左邊的 Project Explorer 中, 點選要 debug 的 project, 這個地方是 UartLpDmaMode
image
2. 在上面的 Run 選單中, 選擇 Debug Configurations
image
3. 在左邊的 configurations 中, 選擇 Zylin Embedded debug (Native)
image
4. 在 Zylin Embedded debug (Native) 上按右鍵, 選擇 new

image

 

Modify Debug Configuration

1. 選擇 Debugger 分頁, 把 Main 分頁的 GDB debugger 連結到 C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\ARM GCC\bin\arm-none-eabi-gdb.exe”
image

2. 選擇 Commands 分頁, 在 Initialize commands, 加入以下命令
set prompt (arm-gdb)
# This connects to a target via netsiliconLibRemote
# listening for commands on a TCP port on the local machine.
# 2331 if the Segger J-Link GDB Server is being used
# 3333 if OpenOCD is being used
# If OpenOCD is being used, the CPU should be halted
# using the "monitor halt" command.
# Uncomment the appropriate line below:
target remote localhost:2331
# target remote localhost:3333
# monitor halt
monitor speed 1000
monitor endian little
set endian little
monitor reset
# Set the processor to SVC mode
monitor reg cpsr =0xd3
# Disable all interrupts
monitor memU32 0xFFFFF014 =0xFFFFFFFF
# Enable the TCMs
monitor memU32 0x40000000 =0xE3A00015
monitor memU32 0x40000004 =0xEE090F31
monitor memU32 0x40000008 =0xE240024F
monitor memU32 0x4000000C =0xEE090F11
# Change the FX3 SYSCLK setting based on
# input clock frequency. Update with
# correct value from list below.
# Clock input is 19.2 MHz: Value = 0x00080015
# Clock input is 26.0 MHz: Value = 0x00080010
# Clock input is 38.4 MHz: Value = 0x00080115
# Clock input is 52.0 MHz: Value = 0x00080110
monitor memU32 0xE0052000 = 0x00080015
# Add a delay to let the clock stabilize.
monitor sleep 1000
set $pc =0x40000000
si
si
si
si
3. 選擇 Commands 分頁, 在 Run commands, 加入以下命令
load
按下 “Apply” 儲存設定.
image

Run GDB server

1. 啟動 GDB server.
在開始功能表中, 找到 SEGGER, 執行 SEGGER\J-Link V4.9X.x\J-Link GDB Server. 確認以下的設定. 沒有問題的話, 按下 OK 開始.
image
正常的話, 會顯示未連線.
image

Debug from Eclipse

在專案名稱上按右鍵, 選擇 Debug As\Debug Configurations. 確定在左邊的 debug configuration 選項中, 剛剛建立的 configuration 被選擇. 然後按下 debug.
image
出現切換到 debug view 的提示. Eclipse 的 source code view 及 debug view 是在歸屬在不同的視覺系統中. 所以進到 debug 時, 會切換到 debug view. 這只是提示. 按下 “Yes” 進入 debug view.
進入 debug 後, 系統會先停下來. 看起來會像是這個樣子.
image
按下工具列的 resume 按紐
image
程式會停在 main() 的第一行 , GDB server 也會顯示已連線
image

沒有留言:

張貼留言

請提供您寶貴的意見