| 230 | |
| 231 | = JTAG Debugging = |
| 232 | |
| 233 | This section cover JTAG debugging on the various Beagle boards. |
| 234 | |
| 235 | == Beaglebone Black JTAG == |
| 236 | |
| 237 | The 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. |
| 238 | |
| 239 | === OpenOCD === |
| 240 | |
| 241 | You will also need to build a recent OpenOCD from GIT. The following is a quick example on how to do this. Please refer to the OpenOCD documentation for any further detail and specific help. |
| 242 | |
| 243 | {{{ |
| 244 | $ git clone git://repo.or.cz/openocd.git openocd.git |
| 245 | $ cd openocd.git |
| 246 | $ ./bootstrap |
| 247 | $ cd .. |
| 248 | $ mkdir build |
| 249 | $ cd build |
| 250 | $ ../openocd.git/configure --enable-maintainer-mode --enable-ftdi --disable-werror --prefix=/opt/work/openocd |
| 251 | $ gmake -j 8 |
| 252 | $ gmake install |
| 253 | }}} |
| 254 | |
| 255 | '''Notes:''' |
| 256 | 1. On FreeBSD the `--disable-werror` option needs to be used to disable warnings being treated as errors. |
| 257 | 1. You need `--enable-ftdi` option is need to support the Flyswatter2 pod. |
| 258 | |
| 259 | Download [https://www.tincantools.com/wiki/Flyswatter2_BeagleBone_Black_How_To#The_BeagleBone_Black_Config_File Tinncan Tool's OpenOCD configuration] file for the Beaglebone Black. |
| 260 | |
| 261 | With an editor create a Beaglebone Black configuration similar to: |
| 262 | |
| 263 | {{{ |
| 264 | $ cat bbb-fs.cfg |
| 265 | source [find interface/ftdi/flyswatter2.cfg] |
| 266 | source [find ti_beaglebone_with_fs2.cfg] |
| 267 | |
| 268 | telnet_port 4444 |
| 269 | tcl_port 6666 |
| 270 | gdb_port 3334 |
| 271 | }}} |
| 272 | |
| 273 | It is useful to have a file like this if you need to add special configurations, for example when using more than one Flyswatter2. |
| 274 | |
| 275 | OpenOCD can be started with: |
| 276 | |
| 277 | {{{ |
| 278 | sudo /opt/work/openocd/bin/openocd -f bbb-fs.cfg -c "reset halt" |
| 279 | }}} |
| 280 | |
| 281 | The target will reset and after 6 seconds it will reset again and perform a normal start up. |
| 282 | |
| 283 | === U-Boot and SPL === |
| 284 | |
| 285 | ** ADD U-Boot building ** |
| 286 | |
| 287 | === GDB === |
| 288 | |
| 289 | The remainder of the set up can be handled using GDB scripts. The part of the GDB scripts handles connecting to the target, which is OpenOCD in our case and restarting the Beaglebone Black. |
| 290 | |
| 291 | This first script fragment handle connecting to the target: |
| 292 | |
| 293 | {{{ |
| 294 | def target-connect-bbb |
| 295 | target remote :3333 |
| 296 | end |
| 297 | }}} |
| 298 | |
| 299 | This next fragment resets the target and initialises the memory so the RTEMS application can be downloaded: |
| 300 | |
| 301 | {{{ |
| 302 | def bbb-restart |
| 303 | mon echo "] Reset..." |
| 304 | mon reset halt |
| 305 | mon bp 0x402f0400 4 hw |
| 306 | mon reset run |
| 307 | mon sleep 1000 |
| 308 | mon rbp 0x402f0400 |
| 309 | mon echo "] Loading MLO" |
| 310 | mon load_image /somewhere/beagle/black/u-boot-spl-nodtb.bin 0x402f0400 bin |
| 311 | mon bp 0x402f1424 4 hw |
| 312 | mon echo "] Resume 0x402f0400" |
| 313 | mon resume 0x402f0400 |
| 314 | mon sleep 1000 |
| 315 | mon rbp 0x402f1424 |
| 316 | mon echo "] Done ..." |
| 317 | end |
| 318 | end |
| 319 | }}} |