Debug using SAM-ICE
Purpose
Use GDB debugger to debug applications. SAM-ICE is needed.
Download and Install
Download the latest J-Link ARM software from
SEGGER website and install it following
install process.
Debug
-
Un-plug power Adapter supply.
-
Connect SAM-ICE through the 20-wire cable to EK board.
-
Connect the SAM-ICE to a USB port of your Host PC Computer,and PC driver for SAM-ICE is detected automaticlly.
-
Re-plug in power Adapter supply.
Picture below show us the hardware connection:

-
Start GDB server.
Start Menu --> SEGGER --> J-Link ARM vX.Y --> J-Link GDB Server
The SEGGER GDB Server tool enables the GNU debugger to connect remotely to the target
through the JTAG.
When launched, GDB Server connects to the board and waits for debugger connections. A window
displaying useful information is also shown (see Figure below). It indicates the connection
statuses of the debugger, the SAM-ICE and the target.

-
Open command shell
- Click on the Start menu
- Select "Run..."
- Type "cmd" and click on the "Ok" button

- A command shell should appear :

-
Connect target board to gdb server
-
Type command : arm-none-eabi-gdb in command shell under the project folder

-
Type command : target remote localhost:2331

Then,the target is connected to gdb server and Halted.

-
Debugging
-
Reset target board by :monitor reset 1
-
Go into working directory by :
cd C:\atmel_examples\smc_lcd_project_sam3sek_gnu\smc_lcd\bin
-
load the debug file into target board by :
load smc_lcd-at91sam3s-ek-at91sam3s4-sram.elf

-
Modify pc value to even before writing pc register
mon reg sp=(0x20000000)
set *0x20000004 = *0x20000004 & 0xFFFFFFFE
mon reg pc=(0x20000004)
-
Type command : c ('Go' command)
You should see LCD diaplay colors.

-
Use ' Ctrl + c ' on keyboard to stop the target
-
Type command : ' help ' to get a list of classes of commands
-
Type command : ' c ' to restart,or ' q ' to quit debugging

-
Close command shell window.
Atmel Corporation ©2011