1
- # PC-Hosted BMP
2
- Compile with:
1
+ # Black Magic Debug App (BMDA)
2
+
3
+ ## Description
4
+
5
+ BMDA can be compiled as follows:
6
+
3
7
``` sh
4
8
meson setup build
5
9
meson compile -C build
6
10
```
7
11
8
- ## Description
9
- PC-hosted BMP run on the PC and compiles as "blackmagic". When started,
10
- it either presents a list of available probes or starts the BMP process
11
- if either only one probe is attached to the PC or enough information is
12
- given on the command line to select one of several probes.
13
-
14
- When started without any other argument beside the probe selection, a
15
- GDB server is started on port 2000 and up. Connect to the server as you would
16
- connect to the BMP with the CDCACM GDB serial server. GDB functionality
17
- is the same, monitor option may vary.
18
-
19
- More arguments allow to
20
- ### Print information on the connected target
12
+ This results in a ` blackmagic ` executable for your computer.
13
+
14
+ When the ` blackmagic ` executable is launched, it will present a list of available probes.
15
+ Alternatively, if there is only one probe attached to the computer, or enough information is given on the
16
+ command line to select one of several probes, it will start a GDB server on localhost port 2000
17
+ (if the port is already bound, BMDA will try the next 4 port numbers up to 2004).
18
+
19
+ You can connect to the server as you would connect to the BMP over USB serial, replacing
20
+ the device path with ` :2000 ` as in ` target extended-remote :2000 ` . BMDA's GDB functionality
21
+ is the same, but the monitor options are a little different and can be viewed with ` monitor help ` .
22
+
23
+ The following lists some of the supported additional commmand line options and what they do.
24
+ It is not exhaustive, and does not show how they can all be combined.
25
+
26
+ ### Display the complete program usage help on the console
27
+
28
+ ``` sh
29
+ blackmagic -h
21
30
```
31
+
32
+ ### Run "Test Mode" and display any connected targets
33
+
34
+ For SWD:
35
+
36
+ ``` sh
22
37
blackmagic -t
23
38
```
24
- ### Directly flash a binary file at lowest flash address
39
+
40
+ For JTAG:
41
+
42
+ ``` sh
43
+ blackmagic -tj
25
44
```
26
- blackmagic <file.bin>
45
+
46
+ ### Directly flash a binary file at lowest flash address
47
+
48
+ ** NB: BMDA will treat whatever file you provide here as the raw contents to write to Flash.**
49
+ ** It does not understand ELF, Intel Hex, or SREC formats.**
50
+
51
+ ``` sh
52
+ blackmagic < file>
27
53
```
54
+
28
55
or with the -S argument at some other address
29
- ```
30
- blackmagic -S 0x08002000 <file.bin>
56
+
57
+ ``` sh
58
+ blackmagic -S 0x08002000 < file>
31
59
```
32
60
33
61
### Read flash to binary file
62
+
63
+ ``` sh
64
+ blackmagic -r < file>
34
65
```
35
- blackmagic -r <file>.bin
36
- ```
66
+
37
67
### Verify flash against binary file
68
+
69
+ ``` sh
70
+ blackmagic -V < file>
38
71
```
39
- blackmagic -V <file>.bin
40
- ```
41
- ### Show more options
42
- ```
43
- blackmagic -h
44
- ```
72
+
45
73
### Show available monitor commands
46
- ```
74
+
75
+ ``` sh
47
76
blackmagic -M help
48
77
```
49
- ### Show available monitor commands on second target
50
- ```
78
+
79
+ ### Show available monitor commands for the second target found
80
+
81
+ ``` sh
51
82
blackmagic -n 2 -M help
52
83
```
53
- ### Monitor commands with multiple arguments, e.g.Stm32F1:
54
- ```
84
+
85
+ ### Monitor commands with multiple arguments - e.g. for STM32 option bytes
86
+
87
+ ``` sh
55
88
blackmagic -M " option help"
56
89
```
57
- ## Used shared libraries:
58
- ### libusb
59
- ### libftdi, for FTDI support
60
-
61
- ## Other used libraries:
62
- ### hidapi-libusb, for CMSIS-DAP support
63
-
64
- ## Compiling on windows
65
-
66
- You can crosscompile blackmagic for windows with mingw or on windows
67
- with cygwin. For support of other probes beside BMP, headers for libftdi1 and
68
- libusb-1.0 are needed. For running, libftdi1.dll and libusb-1.0.dll are needed
69
- and the executable must be able to find them. Mingw on cygwin does not provide
70
- a libftdi package yet.
71
-
72
- PC-hosted BMP for windows can also be built with [ MSYS2] ( https://www.msys2.org/ ) ,
73
- in windows. Make sure to use the ` mingw64 ` shell from msys2, otherwise,
74
- you may get compilation errors. You will need to install the libusb
75
- and libftdi libraries, and have the correct mingw compiler.
76
- You can use these commands to install dependencies, and build PC-hosted BMP
77
- from a mingw64 shell, from within the ` blackmagic ` directory:
78
- ```
79
- pacman -S mingw-w64-x86_64-libusb --needed
80
- pacman -S mingw-w64-x86_64-libftdi --needed
81
- pacman -S mingw-w64-x86_64-gcc --needed
82
- meson setup build
83
- cd build
84
- meson compile
85
- ```
86
90
87
- For support of other probes beside BMP, libusb access is needed. To prepare
88
- libusb access to the ftdi/stlink/jlink/cmsis-dap devices, run zadig
89
- https://zadig.akeo.ie/ . Choose WinUSB(libusb-1.0).
91
+ ## Dependencies for non-` HOSTED_BMP_ONLY=1 ` builds
92
+
93
+ BMDA uses the following external libraries to function when built in full:
94
+
95
+ * libusb1
96
+ * libftdi1 (except on Windows)
97
+ * hidapi (hidapi-hidraw for Linux)
90
98
91
- Running cygwin/blackmagic in a cygwin console, the program does not react
92
- on ^C. In another console, run "ps ax" to find the WINPID of the process
93
- and then "taskkill /F ?PID (WINPID)".
99
+ ## Compiling on Windows
100
+
101
+ To build BMDA on Windows,
102
+ [ please see the guide on the website] ( https://black-magic.org/knowledge/compiling-windows.html )
103
+
104
+ It is possible to build BMDA for Windows under Linux using Clang-cl or a MinGW compiler and combining
105
+ in the Windows SDK headers and link libraries aquired using ` xwin ` , but this is outside the scope of
106
+ this guide.
94
107
95
108
## Supported debuggers
96
- REMOTE_BMP is a "normal" BMP usb connected
97
-
98
- | Debugger | Speed | Remarks
99
- | ------------ | ----- | ------
100
- | REMOTE_BMP | +++ | Requires recent firmware for decent speed
101
- Probes below only when compiled with HOSTED_BMP_ONLY=0
102
- | ST-Link V3 | ++++ | Requires recent firmware, Only STM32 devices supported !
103
- | ST-Link V2 | +++ | Requires recent firmware, No CDCACM uart! Cortex only!
104
- | ST-Link V2/1 | +++ | Requires recent firmware, Cortex only!
105
- | CMSIS-DAP | +++ | Speed varies with MCU implementing CMSIS-DAP
106
- | FTDI MPSSE | ++ | Requires a device description
107
- | J-Link | - | Limited support for hardware prior to v8
109
+
110
+ | Debugger | Speed | Remarks
111
+ | ------------- | ----- | ------
112
+ | BMP | +++ | Requires recent firmware for decent speed
113
+ | ST-Link v3 * | ++++ | Requires recent firmware, Only STM32 devices supported!
114
+ | ST-Link v2 * | +++ | Requires recent firmware, No CDCACM uart! Cortex only!
115
+ | ST-Link v2.1 * | +++ | Requires recent firmware, Cortex only !
116
+ | CMSIS-DAP * | +++ | Speed varies with devuce implementing CMSIS-DAP
117
+ | FTDI MPSSE * | ++ | Requires a device description
118
+ | J-Link * | - | Limited support for hardware prior to v8
119
+
120
+ The probes in this table marked with a star only apply for a full build.
108
121
109
122
## Device matching
123
+
110
124
As other USB dongles already connected to the host PC may use FTDI chips,
111
125
cable descriptions must be provided to match with the dongle.
112
126
To match the dongle, at least USB VID/PID that must match.
113
127
If a description is given, the USB device must provide that string. If a
114
128
serial number string is given on the command line, that number must match
115
129
with serial number in the USB descriptor of the device.
116
130
117
- ## FTDI connection possibilities:
131
+ ## FTDI connection possibilities
118
132
119
133
| Direct Connection |
120
134
| ----------------------|
@@ -123,8 +137,9 @@ with serial number in the USB descriptor of the device.
123
137
| MPSSE_DI <-- JTAG_TDO |
124
138
| MPSSE_CS <-> JTAG_TMS |
125
139
126
- \+ JTAG and bitbanging SWD is possible<br >
127
- \- No level translation, no buffering, no isolation<br >
140
+ \+ JTAG and bitbanging SWD is possible\
141
+ \- No level translation, no buffering, no isolation
142
+
128
143
Example: [ Flossjtag] ( https://randomprojects.org/wiki/Floss-JTAG ) .
129
144
130
145
| Resistor SWD |
@@ -137,45 +152,44 @@ BMP would allow direct MPSSE_DO ->JTAG_TMS connections as BMP tristates DO
137
152
when reading. Resistor defeats contentions anyways. R is typical chosen
138
153
in the range of 470R
139
154
140
- \+ MPSSE SWD possible< br >
141
- \- No Jtag, no level translation, no buffering, no isolation< br >
155
+ \+ MPSSE SWD possible\
156
+ \- No Jtag, no level translation, no buffering, no isolation\
142
157
143
- | Direct buffered Connection|
144
- | --------------------------|
145
- | MPSSE_SK -B-> JTAG_TCK |
146
- | MPSSE_DO -B-> JTAG_TDI |
147
- | MPSSE_DI <-B- JTAG_TDO |
148
- | MPSSE_CS -B-> JTAG_TMS |
158
+ | Direct buffered Connection |
159
+ | ---------------------------- |
160
+ | MPSSE_SK -B-> JTAG_TCK |
161
+ | MPSSE_DO -B-> JTAG_TDI |
162
+ | MPSSE_DI <-B- JTAG_TDO |
163
+ | MPSSE_CS -B-> JTAG_TMS |
149
164
150
- \+ Only Jtag, buffered, possible level translation and isolation<br >
151
- \- No SWD<br >
152
- Example: [ Turtelizer] http://www.ethernut.de/en/hardware/turtelizer/index.html )
165
+ \+ Only Jtag, buffered, possible level translation and isolation\
166
+ \- No SWD
167
+
168
+ Example: [ Turtelizer] ( http://www.ethernut.de/en/hardware/turtelizer/index.html )
153
169
[ schematics] ( http://www.ethernut.de/pdf/turtelizer20c-schematic.pdf )
154
170
155
171
The 'r' command line arguments allows to specify an external SWD
156
172
resistor connection added to some existing cable. Jtag is not possible
157
173
together with the 'r' argument.
158
174
159
175
### Many variants possible
160
- As the FTDI has more pins, these pins may be used to control
176
+
177
+ As FTDI devices have more pins, these pins may be used to control
161
178
enables of buffers and multiplexer selection in many variants.
162
179
163
180
### FTDI SWD speed
181
+
164
182
SWD read needs two USB round trip, one for the acknowledge and one
165
183
round-trip after the data phase, while JTAG only needs one round-trip.
166
184
For that, SWD read speed is about half the JTAG read speed.
167
185
168
186
### Reset, Target voltage readback etc
187
+
169
188
The additional pins may also control Reset functionality, provide
170
189
information if target voltage is applied. etc.
171
190
172
191
### Cable descriptions
192
+
173
193
Please help to verify the cable description and give feedback on the
174
194
cables already listed and propose other cable. A link to the schematics
175
195
is welcome.
176
-
177
- ## Feedback
178
- ### Issues and Pull request on https://github.com/blackmagic-debug/blackmagic/
179
- ### Discussions on Discord.
180
- You can find the Discord link here: https://1bitsquared.com/pages/chat
181
- ### Blackmagic mailing list http://sourceforge.net/mail/?group_id=407419
0 commit comments