Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging broke #9

Closed
maxgerhardt opened this issue Aug 6, 2023 · 2 comments
Closed

Debugging broke #9

maxgerhardt opened this issue Aug 6, 2023 · 2 comments

Comments

@maxgerhardt
Copy link
Contributor

maxgerhardt commented Aug 6, 2023

[env:uno_r4_wifi]
platform = renesas-ra
board = uno_r4_wifi
framework = arduino

-->

> pio debug --interface=gdb -- -x .pioinit
KeyError: Traceback (most recent call last):
  File "C:\Users\Max\AppData\Roaming\Python\Python311\site-packages\platformio\__main__.py", line 103, in main
    cli()  # pylint: disable=no-value-for-parameter
    ^^^^^
  File "C:\Users\Max\AppData\Roaming\Python\Python311\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Max\AppData\Roaming\Python\Python311\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "C:\Users\Max\AppData\Roaming\Python\Python311\site-packages\platformio\cli.py", line 85, in invoke
    return super().invoke(ctx)
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Max\AppData\Roaming\Python\Python311\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Max\AppData\Roaming\Python\Python311\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Max\AppData\Roaming\Python\Python311\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Max\AppData\Roaming\Python\Python311\site-packages\click\decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Max\AppData\Roaming\Python\Python311\site-packages\platformio\debug\cli.py", line 104, in cli
    debug_config = _configure(*configure_args)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Max\AppData\Roaming\Python\Python311\site-packages\platformio\debug\cli.py", line 113, in _configure
    debug_config = DebugConfigFactory.new(
                   ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Max\AppData\Roaming\Python\Python311\site-packages\platformio\debug\config\factory.py", line 48, in new
    return config_cls(platform, project_config, env_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Max\AppData\Roaming\Python\Python311\site-packages\platformio\debug\config\generic.py", line 38, in __init__
    super().__init__(*args, **kwargs)
  File "C:\Users\Max\AppData\Roaming\Python\Python311\site-packages\platformio\debug\config\base.py", line 52, in __init__
    self.server = self._configure_server()
                  ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Max\AppData\Roaming\Python\Python311\site-packages\platformio\debug\config\base.py", line 182, in _configure_server
    self.platform.get_package_dir(server_package)
  File "C:\Users\Max\AppData\Roaming\Python\Python311\site-packages\platformio\platform\_packages.py", line 32, in get_package_dir
    pkg = self.get_package(name)
          ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Max\AppData\Roaming\Python\Python311\site-packages\platformio\platform\_packages.py", line 29, in get_package
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Max\AppData\Roaming\Python\Python311\site-packages\platformio\platform\_packages.py", line 21, in get_package_spec
    owner=self.packages[name].get("owner"),
          ~~~~~~~~~~~~~^^^^^^
KeyError: 'tool-openocd'

============================================================

An unexpected error occurred. Further steps:

* Verify that you have the latest version of PlatformIO using
  `python -m pip install -U platformio` command

* Try to find answer in FAQ Troubleshooting section
  https://docs.platformio.org/page/faq/index.html

* Report this problem to the developers
  https://github.com/platformio/platformio-core/issues

============================================================

And that's after a clean reinstall of renesas-ra@1.0.0. The platform.py logic might no be able to handle the case with the Arduino Uno R4 WiFi which needs tool-bossac to preload but at the same time tool-openocd to open the debug session.

@maxgerhardt
Copy link
Contributor Author

maxgerhardt commented Aug 6, 2023

Adding

            print("For package " + str(package) + " interface " + str(interface_name) + " use conditions: " + str(use_conditions))

before

if not any(use_conditions) and package_name in self.packages:
del self.packages[package_name]
else:
self.packages[package_name]["optional"] = False

shows

> pio debug --interface=gdb -- -x .pioinit
For package tool-jlink interface jlink use conditions: [False, False, False, False]
For package tool-openocd interface cmsis-dap use conditions: [False, False, False, False]
For package tool-dfuutil-arduino interface dfu use conditions: [False, False, False, False]
For package tool-bossac interface sam-ba use conditions: [False, False, False, True]

And so the tool-openocd package is thrown out.

Edit: Rewriting the conditions to

                use_conditions.extend(
                    [
                        interface_name in board_config.get(key, "")
                        for key in ("debug.onboard_tools", "debug.default_tools", "upload.protocol")
                    ]
                )

Does make the OpenOCD package get included but I think it'll always be included then. Maybe something is wrong with the initilaization oder so that cmsis-dap is not in debug.default_tools or selected in this debug config.

@valeros valeros closed this as completed in 180a787 Aug 7, 2023
@valeros
Copy link
Member

valeros commented Aug 7, 2023

Thanks for reporting, should be fixed in the dev branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants