Skip to content

Commit 190b0cf

Browse files
committed
Properly configure custom debug speed
1 parent e088821 commit 190b0cf

File tree

1 file changed

+11
-19
lines changed

1 file changed

+11
-19
lines changed

platform.py

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import copy
1615
import json
1716
import os
1817
import sys
@@ -21,6 +20,7 @@
2120

2221
IS_WINDOWS = sys.platform.startswith("win")
2322

23+
2424
class NxplpcPlatform(PlatformBase):
2525

2626
def is_embedded(self):
@@ -155,26 +155,18 @@ def _add_default_debug_tools(self, board):
155155
board.manifest["debug"] = debug
156156
return board
157157

158-
def configure_debug_options(self, initial_debug_options, ide_data):
159-
debug_options = copy.deepcopy(initial_debug_options)
160-
adapter_speed = initial_debug_options.get("speed")
161-
if adapter_speed:
162-
server_options = debug_options.get("server") or {}
163-
server_executable = server_options.get("executable", "").lower()
158+
def configure_debug_session(self, debug_config):
159+
if debug_config.speed:
160+
server_executable = (debug_config.server or {}).get("executable", "").lower()
164161
if "openocd" in server_executable:
165-
debug_options["server"]["arguments"].extend(
166-
["-c", "adapter speed %s" % adapter_speed]
162+
debug_config.server["arguments"].extend(
163+
["-c", "adapter speed %s" % debug_config.speed]
167164
)
168165
elif "jlink" in server_executable:
169-
debug_options["server"]["arguments"].extend(
170-
["-speed", adapter_speed]
166+
debug_config.server["arguments"].extend(
167+
["-speed", debug_config.speed]
171168
)
172-
elif "pyocd" in debug_options["server"]["package"]:
173-
assert (
174-
adapter_speed.isdigit()
175-
), "pyOCD requires the debug frequency value in Hz, e.g. 4000"
176-
debug_options["server"]["arguments"].extend(
177-
["--frequency", "%d" % int(adapter_speed)]
169+
elif "pyocd" in debug_config.server["package"]:
170+
debug_config.server["arguments"].extend(
171+
["--frequency", debug_config.speed]
178172
)
179-
180-
return debug_options

0 commit comments

Comments
 (0)