Changes between Version 3 and Version 4 of Boards/Beagle Board


Ignore:
Timestamp:
Mar 1, 2018, 8:14:09 AM (4 years ago)
Author:
Christian Mauderer
Comment:

Add chapter describing JTAG debugging using Segger J-Link on BBB.

Legend:

Unmodified
Added
Removed
Modified
  • Boards/Beagle Board

    v3 v4  
    233233This section cover JTAG debugging on the various Beagle boards.
    234234
    235 == Beaglebone Black JTAG ==
     235== Beaglebone Black JTAG using OpenOCD ==
    236236
    237237The following details debugging on a Beaglebone Black with a [http://www.tincantools.com/JTAG/Flyswatter2.html Flyswatter2] and the [http://www.tincantools.com/JTAG/BeagleBone-Black-JTAG-Adapter-Kit.html ARM 20-pin to cTI 20-pin JTAG Adapter Board]. You need to solder the adapter board to the Beaglebone Black board.
     
    318318end
    319319}}}
     320
     321== Beaglebone Black JTAG using Segger J-Link ==
     322
     323This describes how to set up a debugger using the [https://www.segger.com/products/debug-probes/j-link/ Segger J-Link] or [https://www.segger.com/products/debug-probes/j-link/models/j-link-edu/ Segger J-Link EDU] on a Linux host. Note that you need a mechanical adapter for connecting the BBB.
     324
     325=== J-Link gdb Server ===
     326
     327Install the J-Link software either from the Segger home page or from your distributions repository. On Arch Linux, the [https://aur.archlinux.org/packages/jlink/ AUR jlink] package can be used.
     328
     329Start the gdb-server with the following command:
     330
     331{{{
     332JLinkGDBServer -device AM3358 -if JTAG -speed 16000
     333}}}
     334
     335Note that this will start a server in the foreground. So do it on it's own console or in some screen or tmux session.
     336
     337=== GDB ===
     338
     339Create a gdb-script `start.gdb` with the following content:
     340
     341{{{
     342define reset
     343        echo -- Reset target and wait for U-Boot to start kernel.\n
     344        monitor reset
     345        # RTEMS U-Boot starts at this address.
     346        tbreak *0x80000000
     347        # Linux starts here.
     348        tbreak *0x82000000
     349        continue
     350
     351        echo -- Disable watchdog.\n
     352        set *(uint32_t*)0x44e35048=0xAAAA
     353        while (*(uint32_t*)0x44e35034 != 0)
     354        end
     355        set *(uint32_t*)0x44e35048=0x5555
     356        while (*(uint32_t*)0x44e35034 != 0)
     357        end
     358
     359        echo -- Overwrite kernel with application to debug.\n
     360        load
     361end
     362
     363target remote :2331
     364}}}
     365
     366Start your gdb with a line like follows:
     367
     368{{{
     369arm-rtems4.12-gdb -x start.gdb app.elf
     370}}}
     371
     372The gdb script assumes that the Beagle has some system that it can boot. So put for example a Debian Linux or some RTEMS image on a SD card or on the eMMC of the BBB before starting the gdb. The script will interrupt the boot process during the jump to the "normal" application and load your given elf file instead.
     373
     374Execute the command `reset` (defined by the gdb script) in the gdb shell to start or restart the application.