sudo apt-get install libftdi1 libftdi1-dev ftdi-eeprom
ftdi
sudo apt-get install libftdi1 libftdi1-dev ftdi-eeprom
Make sure libftdi version is above 0.8.
ftdi_sio
sudo modprobe ftdi_sio vendor=0x1457 product=0x5118
openocd
sudo apt-get install openocd
nCS0: 00000000 07FFFFFF 4K steppingstone or NOR (Aux held down) nCS1: 08000000 0FFFFFFF Glamo nCS2: 10000000 17FFFFFF nothing mapped nCS3: 18000000 1FFFFFFF NOR nCS4: 20000000 17FFFFFF nothing mapped nCS5: 28000000 2FFFFFFF nothing mapped nCS6: 30000000 33FFFFFF on-MCP SDRAM 64MB nCS7: 34000000 37FFFFFF external SDRAM 64MB
Unscrew the Torx screws at the bottom of the FreeRunner.
Remove the front-side casing using the guitar pluck.
Connect the debug board to the PC. The Flexible Ribbon Cable (FRC) connectors should face down to connect with the pin connectors on the FR as well as the debug board.
Create a configuration file:
telnet_port 4444 gdb_port 3333 interface ft2232 jtag_speed 0 ft2232_vid_pid 0x1457 0x5118 ft2232_layout "jtagkey" reset_config trst_and_srst jtag_device 4 0x1 0xf 0x3 daemon_startup attach target arm920t little reset_run 0 arm920t working_area 0 0x200000 0x4000 backup run_and_halt_time 0 5000 ft2232_device_desc "Debug Board for Neo1973"
Plug in the debug board to the PC. In /var/log/messages you will get the following kernel messages:
usb 2-2: new full speed USB device using uhci_hcd and address 2 usb 2-2: configuration #1 chosen from 1 choice hub 2-2:1.0: USB hub found hub 2-2:1.0: 4 ports detected usb 2-2.1: new full speed USB device using uhci_hcd and address 3 usb 2-2.1: configuration #1 chosen from 1 choice
Put the battery in the Neo FreeRunner and power it to u-boot menu (NAND menu, for example). Run openocd using:
sudo openocd -f /path/to/openocd.cfg
You will get an output like:
Open On-Chip Debugger 1.0 (2008-08-11-18:16) svn:unknown $URL: http://svn.berlios.de/svnroot/repos/openocd/trunk/src/openocd.c $ Info: options.c:50 configuration_output_handler(): jtag_speed: 0, 0 Info: options.c:50 configuration_output_handler(): Open On-Chip Debugger 1.0 (2008-08-11-18:16) svn:unknown Info: jtag.c:1376 jtag_examine_chain(): JTAG device found: 0x0032409d (Manufacturer: 0x04e, Part: 0x0324, Version: 0x0)
From another terminal connect through telnet to get openocd debugger prompt:
telnet localhost 4444
You will get an output with a prompt:
Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. Open On-Chip Debugger >
At the OpenOCD prompt, you can issue reset halt (for example):
> reset halt JTAG device found: 0x0032409d (Manufacturer: 0x04e, Part: 0x0324, Version: 0x0) target state: halted target halted in ARM state due to debug request, current mode: Supervisor cpsr: 0x200000d3 pc: 0x00000000 MMU: disabled, D-Cache: disabled, I-Cache: disabled >
Download lowlevel_foo.bin for SDRAM timing initialization, and run it:
> load_binary /tmp/lowlevel_foo.bin 0 308 byte written at address 0x00000000 downloaded 308 byte in 0.027553s > bp 0x33f80000 4 hw breakpoint added at address 0x33f80000 > resume target state: halted target halted in ARM state due to breakpoint, current mode: Supervisor cpsr: 0x600000d3 pc: 0x33f80000 MMU: disabled, D-Cache: disabled, I-Cache: enabled dropped 'gdb' connection
Load the u-boot.bin binary to SDRAM address 0x33f80000
> load_binary /tmp/u-boot.bin 0x33f80000 216692 byte written at address 0x33f80000 downloaded 216692 byte in 7.785010s accepting 'gdb' connection from 0 acknowledgment received, but no packet pending target state: halted target halted in ARM state due to breakpoint, current mode: Supervisor cpsr: 0x600000d3 pc: 0x33f80000 MMU: disabled, D-Cache: disabled, I-Cache: enabled
Enable ARM software break points:
> arm7_9 sw_bkpts enable software breakpoints enabled target state: halted target halted in ARM state due to breakpoint, current mode: Supervisor cpsr: 0x600000d3 pc: 0x33f80000 MMU: disabled, D-Cache: disabled, I-Cache: enabled
Connect from gdb:
# /usr/local/openmoko/arm/bin/arm-angstrom-linux-gnueabi-gdb u-boot GNU gdb 6.6 Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "--host=i686-linux --target=arm-angstrom-linux-gnueabi"...
Connect to target:
(gdb) target remote localhost:3333 Remote debugging using localhost:3333 _start () at start.S:53 53 _start: b start_code Current language: auto; currently asm
Output of some gdb commands:
(gdb) info registers r0 0x33f80000 871890944 r1 0x1100 4352 r2 0x134 308 r3 0x30 48 r4 0x0 0 r5 0x33faea0c 872081932 r6 0x33faea2c 872081964 r7 0x33faea68 872082024 r8 0x40 64 r9 0x1 1 r10 0x1c4 452 r11 0x33faea70 872082032 r12 0x64 100 sp 0x33faebc0 0x33faebc0 lr 0x64 100 pc 0x33f80000 0x33f80000 <_start> fps 0x0 0 cpsr 0x600000d3 1610612947 (gdb) list 48 ************************************************************************* 49 */ 50 51 52 .globl _start 53 _start: b start_code 54 ldr pc, _undefined_instruction 55 ldr pc, _software_interrupt 56 ldr pc, _prefetch_abort 57 ldr pc, _data_abort
Setting up a breakpoint at board_init, for example, and continue:
(gdb) b board_init Breakpoint 1 at 0x33f810c4: file gta02.c, line 136. (gdb) continue Continuing. target state: halted target halted in ARM state due to breakpoint, current mode: Supervisor cpsr: 0x200000d3 pc: 0x33f810c4 MMU: disabled, D-Cache: disabled, I-Cache: enabled Breakpoint 1, board_init () at gta02.c:136 136 cpu_speed(142, 7, 1, 3); /* 200MHZ, 1:2:4 */ Current language: auto; currently c (gdb) list 131 int board_init(void) 132 { 133 S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO(); 134 135 /* FCLK = 200MHz values from cpu/arm920t/start.S */ 136 cpu_speed(142, 7, 1, 3); /* 200MHZ, 1:2:4 */ 137 138 /* set up the I/O ports */ 139 #if CONFIG_GTA02_REVISION == 1 140 gpio->GPACON = 0x007E1FFF;
To use ddd along with gdb, you can start it with (instead of directly invoking gdb as mentioned above):
ddd --debugger /usr/local/openmoko/arm/bin/arm-angstrom-linux-gnueabi-gdb u-boot
At the gdb prompt within ddd, connect using:
(gdb) target remote localhost:3333
You should now be able to step-through the code. Here is a screenshot:
[Debug_Board_v3]. Debug Board v3. http://wiki.openmoko.org/wiki/Debug_Board_v3.
[OpenOCD_and_Debug_Board]. OpenOCD and Debug Board. http://wiki.openmoko.org/wiki/OpenOCD#OpenOCD_and_Debug_Board.
[Openmoko_Bootloader]. Openmoko Bootloader. http://wiki.openmoko.org/wiki/Bootloader#Using_JTAG_to_boot_from_RAM.