Properly configure custom debug speed

This commit is contained in:
Valerii Koval
2022-05-27 19:49:59 +03:00
parent b04fc4bf01
commit 031e616061

View File

@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import copy
import json
import os
@@ -21,6 +20,7 @@ from platform import system
from platformio.managers.platform import PlatformBase
from platformio.util import get_systype
class Ststm32Platform(PlatformBase):
def configure_default_packages(self, variables, targets):
@@ -185,19 +185,14 @@ class Ststm32Platform(PlatformBase):
board.manifest["debug"] = debug
return board
def configure_debug_options(self, initial_debug_options, ide_data):
debug_options = copy.deepcopy(initial_debug_options)
adapter_speed = initial_debug_options.get("speed")
if adapter_speed:
server_options = debug_options.get("server") or {}
server_executable = server_options.get("executable", "").lower()
def configure_debug_session(self, debug_config):
if debug_config.speed:
server_executable = (debug_config.server or {}).get("executable", "").lower()
if "openocd" in server_executable:
debug_options["server"]["arguments"].extend(
["-c", "adapter speed %s" % adapter_speed]
debug_config.server["arguments"].extend(
["-c", "adapter speed %s" % debug_config.speed]
)
elif "jlink" in server_executable:
debug_options["server"]["arguments"].extend(
["-speed", adapter_speed]
debug_config.server["arguments"].extend(
["-speed", debug_config.speed]
)
return debug_options