dev:nab:v2:jtag
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Previous revisionNext revision | |||
— | dev:nab:v2:jtag [2015/11/12 13:45] – [Usage] redox | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | # JTAG access | ||
+ | ## Overview | ||
+ | |||
+ | As detailed on the Schematic (released in the FCC documents), the Nabaztag: | ||
+ | |||
+ | ## Hardware | ||
+ | |||
+ | |||
+ | ### JTAG probe: BusBlaster | ||
+ | |||
+ | {{: | ||
+ | |||
+ | On of the best features of the BusBlaster is you can reconfigure the CPLD to emulate any FT2232 JTAG probe. I think it comes pre-programmed with a JTAGkey buffer logic, which should work fine for this application. | ||
+ | |||
+ | _Note_: My BusBlaster (a v4 !) uses a KT-link buffer logic, because I needed the SWD capabilities for another application. If the following steps don't work, try to reprogram the CPLD with a KT-link buffer and try again ! | ||
+ | |||
+ | You also need some jumper wires (also called _Dupont wire_ sometimes) F/F to connect the BusBlaster to the Nabaztag | ||
+ | |||
+ | ### Nabaztag: | ||
+ | |||
+ | Well, of course you need a Nabaztag: | ||
+ | |||
+ | Grab a small flat screwdriver and remove the four screws on the base. You can also use a triangle screwdriver if you happen to have one, I don't. | ||
+ | |||
+ | And this is about it. the JTAG header is on the top left corner of the board. | ||
+ | |||
+ | Pinout is the following (top to bottom): | ||
+ | |||
+ | |||
+ | ^ Nabaztag Pin ^ Function ^ BusBlaster pin ^ | ||
+ | | 1 | ||
+ | | 2 | ||
+ | | 3 | ||
+ | | 4 | ||
+ | | 5 | ||
+ | | 6 | ||
+ | | 7 | ||
+ | | 8 | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ## Software: OpenOCD | ||
+ | |||
+ | ### Patch and compile OpenOCD | ||
+ | |||
+ | The Nabaztag: | ||
+ | |||
+ | - access the CPU registers, which means debug is possible ! | ||
+ | - read and write the Internal flash | ||
+ | - First version was slow as hell: 5 to 10 minutes to read/write the whole flash | ||
+ | - Second version is much better: under 5 seconds. I had to write ARM assembler code to be run from RAM to write the Flash, which was a rather painful but interesting experience... | ||
+ | |||
+ | So ! Download OpenOCD **0.8.0** from their website, or here (mirror): {{: | ||
+ | |||
+ | Download the patch: {{: | ||
+ | |||
+ | #### Prepare | ||
+ | |||
+ | sudo aptitude install libtool autoconf automake libusb-1.0-0-dev | ||
+ | | ||
+ | gzip -d openocd_0.8.0_oki.patch.gz | ||
+ | tar xzvf ./ | ||
+ | |||
+ | |||
+ | #### Patch | ||
+ | |||
+ | cd openocd-0.8.0/ | ||
+ | patch -p1 < ../ | ||
+ | |||
+ | #### Compile | ||
+ | |||
+ | autoreconf -fi | ||
+ | ./configure | ||
+ | make | ||
+ | |||
+ | When it's done, you should have a binary named **openocd** in the `src/` folder | ||
+ | |||
+ | ### Usage | ||
+ | |||
+ | Now that you have a patched version of OpenOCD capable of debugging the OKI chip, you need some configuration files. Here are mine: {{: | ||
+ | |||
+ | _Note_: You might need to tweak them a little bit, especially the `interface/ | ||
+ | |||
+ | Once you have the config files, just copy the openocd binary in the same folder and then it's as easy as: | ||
+ | |||
+ | ./openocd -f nabaztagv2.cfg | ||
+ | |||
+ | ## GDB | ||
+ | |||
+ | I think you can use telnet to interact with OpenOCD, but I use GDB... Here are a few notes: | ||
+ | |||
+ | ### Launch GDB and connect | ||
+ | |||
+ | arm-none-eabi-gdb | ||
+ | |||
+ | Once in GDB | ||
+ | |||
+ | tar ext :3333 | ||
+ | |||
+ | The Nabaztag should have " | ||
+ | |||
+ | mon reset run | ||
+ | | ||
+ | ### Dump the flash | ||
+ | |||
+ | mon reset init | ||
+ | dump ihex memory dump.hex 0x08000000 0x08020000 # Get an hex file, useful for analyzing it | ||
+ | dump binary memory dump.bin 0x08000000 0x08020000 # Get a bin file, useful for backup and restore | ||
+ | |||
+ | _Note_: The files end up in the same folder as the openocd binary (or the folder from where you run it) | ||
+ | |||
+ | ### Write an image | ||
+ | |||
+ | mon reset init | ||
+ | mon flash write_image erase ./dump.bin 0x08000000 | ||
+ | |||
+ | _Note_: The files should be in the same folder as the openocd binary (or the folder from where you run it) | ||
+ | |||
+ | |||
+ | ## Pictures | ||
+ | |||
+ | {{.: | ||
+ | |||
+ | ## Links |
/home/share/www/redox.ws/wiki/data/pages/dev/nab/v2/jtag.txt · Last modified: 2023/11/24 22:18 by redox