|
12 | 12 | # See the License for the specific language governing permissions and
|
13 | 13 | # limitations under the License.
|
14 | 14 |
|
| 15 | +import copy |
15 | 16 | import json
|
16 | 17 | import os
|
17 | 18 |
|
@@ -120,21 +121,21 @@ def _add_default_debug_tools(self, board):
|
120 | 121 | upload_protocols = board.manifest.get("upload", {}).get(
|
121 | 122 | "protocols", [])
|
122 | 123 | if "tools" not in debug:
|
123 |
| - debug['tools'] = {} |
| 124 | + debug["tools"] = {} |
124 | 125 |
|
125 | 126 | # BlackMagic, J-Link, ST-Link
|
126 | 127 | for link in ("blackmagic", "jlink", "stlink", "cmsis-dap"):
|
127 |
| - if link not in upload_protocols or link in debug['tools']: |
| 128 | + if link not in upload_protocols or link in debug["tools"]: |
128 | 129 | continue
|
129 | 130 | if link == "blackmagic":
|
130 |
| - debug['tools']['blackmagic'] = { |
| 131 | + debug["tools"]["blackmagic"] = { |
131 | 132 | "hwids": [["0x1d50", "0x6018"]],
|
132 | 133 | "require_debug_port": True
|
133 | 134 | }
|
134 | 135 | elif link == "jlink":
|
135 | 136 | assert debug.get("jlink_device"), (
|
136 | 137 | "Missed J-Link Device ID for %s" % board.id)
|
137 |
| - debug['tools'][link] = { |
| 138 | + debug["tools"][link] = { |
138 | 139 | "server": {
|
139 | 140 | "package": "tool-jlink",
|
140 | 141 | "arguments": [
|
@@ -166,15 +167,31 @@ def _add_default_debug_tools(self, board):
|
166 | 167 | ])
|
167 | 168 | server_args.extend(debug.get("openocd_extra_args", []))
|
168 | 169 |
|
169 |
| - debug['tools'][link] = { |
| 170 | + debug["tools"][link] = { |
170 | 171 | "server": {
|
171 | 172 | "package": "tool-openocd",
|
172 | 173 | "executable": "bin/openocd",
|
173 | 174 | "arguments": server_args
|
174 | 175 | }
|
175 | 176 | }
|
176 |
| - debug['tools'][link]['onboard'] = link in debug.get("onboard_tools", []) |
177 |
| - debug['tools'][link]['default'] = link in debug.get("default_tools", []) |
| 177 | + debug["tools"][link]["onboard"] = link in debug.get("onboard_tools", []) |
| 178 | + debug["tools"][link]["default"] = link in debug.get("default_tools", []) |
178 | 179 |
|
179 |
| - board.manifest['debug'] = debug |
| 180 | + board.manifest["debug"] = debug |
180 | 181 | return board
|
| 182 | + |
| 183 | + def configure_debug_options(self, initial_debug_options, ide_data): |
| 184 | + debug_options = copy.deepcopy(initial_debug_options) |
| 185 | + server_executable = debug_options["server"]["executable"].lower() |
| 186 | + adapter_speed = initial_debug_options.get("speed") |
| 187 | + if adapter_speed: |
| 188 | + if "openocd" in server_executable: |
| 189 | + debug_options["server"]["arguments"].extend( |
| 190 | + ["-c", "adapter speed %s" % adapter_speed] |
| 191 | + ) |
| 192 | + elif "jlink" in server_executable: |
| 193 | + debug_options["server"]["arguments"].extend( |
| 194 | + ["-speed", adapter_speed] |
| 195 | + ) |
| 196 | + |
| 197 | + return debug_options |
0 commit comments