]> git.sur5r.net Git - armstart-ibdap/blob - README.md
Fix build
[armstart-ibdap] / README.md
1 # IBDAP-CMSIS-DAP
2 Armstart's CMSIS-DAP firmware implementation in gcc and makefile.
3
4 [http://www.armstart.com](http://www.armstart.com)
5
6 [IBDAP](https://hackaday.io/project/6578-ibdap-affordable-cmsis-dap-jtagswd-debug-probe) is a fully CMSIS-DAP compatible debug adapter. It provides vendor independent debug interface between your PC over USB and target ARM device over JTAG/SWD pins. You can do debugging functions like stepping, breakpoints, watch points and firmware download etc. It's fully supported by Keil, OpenOCD, GNU GDB, IAR and other commonly used debugging tools.
7
8 # Why IBDAP?
9
10 Debug adapters are expensive, some could cost thousands of dollars, some may not be compatible among different vendors. Luckily, ARM standardized the debugging interface which is called CMSIS-DAP and released the firmware implementation on some processors, however, you still need a Keil MDK Professional edition software in order to build the firmware, even the open source one provided by mbed and the price for Keil Professional is intimidating. All these barriers has become the first issue that every inventor is facing, and we need a solution!
11 IBDAP's objective is to become an affordable open source & open hardware CMSIS-DAP JTAG/SWD debug probe implementation using gcc & makefile. Anyone can modify and embed a debug probe on its own device easily with everything under its control.
12
13 Besides being functioning as a JTAG/SWD debug probe, IBDAP could also be used as a general development board. It has an ARM Cortex M0 processor  running at 48Mhz and has peripherals like UART, I2C, SPI, USB. It can be used in many applications like USB audio devices, USB mouse/keyboards, USB mass storage devices, USB-TTL adapter device and many many more. Moreover, the 10-bit high precision ADC peripheral also makes IBDAP an ideal device for any sensor projects.
14
15 ![IBDAP pinmap](https://s3.amazonaws.com/armstart/Debug+Tools/IBDAP-LPC11U35/7.jpg)
16  
17  
18 # OpenOCD Tutorial
19  
20 ## install deps
21
22 sudo apt-get install build-essential
23
24 sudo apt-get install autotools-dev autoconf automake libtool
25
26 sudo apt-get install texinfo libudev-dev libusb-1.0-0-dev libfox-1.6-dev
27
28
29 ## Download FTDI driver
30
31 ```
32 http://www.intra2net.com/en/developer/libftdi/download.php
33 tar xf libftdi1-1.2.tar.bz2
34 ```
35
36 ## HIDAPI 
37
38 ```
39 git clone git://github.com/signal11/hidapi.git
40 ./bootstrap
41 ./configure
42 make
43 sudo make install
44 ```
45
46 ## Build and Install OpenOCD
47
48 ```
49 git clone git://git.code.sf.net/p/openocd/code
50 cd code
51 ./bootstrap
52 cd ../
53 mkdir ./openocd-build
54 cd openocd-build
55 ../code/configure --with-ftd2xx-linux-tardir=../libftdi1-1.2 --prefix=/opt/openocd --enable-jlink --enable-ftdi --enable-stlink --enable-ti-icdi --enable-ulink --enable-usb-blaster-2 --enable-cmsis-dap --enable-bcm2835gpio
56 make
57 make install
58 ```
59 ## Usage
60
61 ### Prepare extra OpenOCD cfg commands
62
63 create file openocd.cfg with following contents:
64
65 ```
66 $_TARGETNAME configure -event gdb-attach {
67    echo "Halting target"
68    halt
69 }
70 ```
71
72 ### Start OpenOCD server to Debug LPC11U35
73
74 ```
75 sudo openocd -f interface/jlink.cfg -c "transport select swd" -f target/lpc11xx.cfg -f openocd.cfg 
76
77 ```
78
79 ### Flash and Debug
80
81 - First, flash debug firmware on board
82
83 ```
84 telnet localhost 4444
85 reset halt
86 flash probe 0
87 flash write_image erase /home/yliu/projects/ib51822/IBDAP-FW/Firmware/IBDAP/Debug/IBDAP.bin 0x0
88 reset
89 exit
90 ```
91
92 - Second, debug using the commands:
93
94 ```
95 target remote localhost:3333
96 break IBDAP.c:103
97 monitor reset halt
98 monitor reset init
99 continue
100 ```
101 http://wiki.paparazziuav.org/wiki/DevGuide/GDB_OpenOCD_Debug
102
103 ### Breakpoint limits
104
105 ```
106 set remote hardware-breakpoint-limit 4
107 set remote hardware-watchpoint-limit 2
108 ```
109
110 ### gdbtui GUI debugging
111
112 http://fun-tech.se/stm32/OpenOCD/gdb.php
113
114
115 ## OpenOCD nRF51822 using IBDAP
116
117 Launch OpenOCD
118
119 ```
120 $ sudo openocd -f interface/cmsis-dap.cfg -c "transport select swd" -f target/nrf51.cfg
121 ```
122
123 nrf OpenOCD log
124
125 ```
126 yliu@yliu-xbtu:~$ 
127 yliu@yliu-xbtu:~$ sudo openocd -f interface/cmsis-dap.cfg -c "transport select swd" -f target/nrf51.cfg
128 [sudo] password for yliu: 
129 Open On-Chip Debugger 0.10.0-dev-00001-g70a14db (2015-06-23-16:35)
130 Licensed under GNU GPL v2
131 For bug reports, read
132         http://openocd.org/doc/doxygen/bugs.html
133 Info : only one transport option; autoselect 'swd'
134 Warn : Transport "swd" was already selected
135 swd
136 cortex_m reset_config sysresetreq
137 adapter speed: 1000 kHz
138 Info : CMSIS-DAP: SWD  Supported
139 Info : CMSIS-DAP: JTAG Supported
140 Info : CMSIS-DAP: Interface Initialised (SWD)
141 Info : CMSIS-DAP: FW Version = 1.0
142 Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
143 Info : CMSIS-DAP: Interface ready
144 Info : clock speed 1000 kHz
145 Info : SWD IDCODE 0x0bb11477
146 Info : nrf51.cpu: hardware has 4 breakpoints, 2 watchpoints
147 Info : accepting 'telnet' connection on tcp/4444
148 ```
149
150
151 ```
152 yliu@yliu-xbtu:~$ telnet localhost 4444
153 Trying 127.0.0.1...
154 Connected to localhost.
155 Escape character is '^]'.
156 Open On-Chip Debugger
157 > reset halt
158 target state: halted
159 target halted due to debug-request, current mode: Thread 
160 xPSR: 0xc1000000 pc: 0x000006d0 msp: 0x000007c0
161 > flash probe 0
162 Unknown device (HWID 0x00000057)
163 flash 'nrf51' found at 0x00000000
164 ```
165