With the help of descriptions I’m trying a simple blink debug with Atmel-ICE: the platformio.ini contains
build_type = debug
and
debug_tool = atmel-ice
When i click the RUN AND DEBUG button (green triangle), the debug toolbar (continue, step-in, step-out, etc…) simply does not appear…
The reasons could be manyfold. Please post
The full platformio.ini
The output of the “Debug Console” tab in VSCode
Also note that using an Atmel ICE to debug Atmel AVR devices is currently not possible out of the box. Atmel SAM / ARM-based devices can be debugged though.
platformio.ini:
[env:mkrzero]
platform = atmelsam
board = mkrzero
framework = arduino
build_type = debug
debug_tool = atmel-ice
The DEBUG CONSOLE tab is empty.
The MKRZERO SWD port ↔ Atmel-ICE SAM port wiring I think is good: in the Arduino IDE 2.1.1 i can upload the original (stock) bootloader without error. Since then I can upload sketch without error.
I’m using a win11 system now, but I tried a fresh win10 system, the error is same…
What’s the output of CLI →
pio debug --interface=gdb -- -x .pioinit
?
A bunch of red error messages…
Not fit here. Am I uploading somewhere?
You can use https://pastebin.com/ if the logs are too long.
Seems like a bug in platform-atmelsam. Can you update to the latest stable version and see if it’s still dead like this?
CLI →
pio pkg update -g -p atmelsam
Okay than this merits opening an issue about it.
Can you try this workaround:
Add upload_protocol = atmel-ice
in your platformio.ini
Try a regular upload. (This should trigger the installation of the tool-openocd package)
Try debugging again (The error about tool-openocd not being found should be gone)
FYI, this is now tracked in
opened 04:55PM - 21 Aug 23 UTC
Apparanetly when a user has not yet triggered PlatformIO to download the `tool-o… penocd` package but attempts to start a debug session anyways, PlatformIO crashes.
[Community topic](https://community.platformio.org/t/missing-debug-toolbar/35366).
```python
PS C:\Users\wolf\Documents\PlatformIO\Projects\Blimk_Debug> pio pkg update -g -p atmelsam
Platform Manager: atmelsam@8.2.0 is already up-to-date
Tool Manager: framework-arduino-samd@1.8.13 is already up-to-date
Tool Manager: framework-cmsis@1.40500.0 is already up-to-date
Tool Manager: framework-cmsis-atmel@1.2.2 is already up-to-date
Tool Manager: tool-bossac@1.10700.190624 is already up-to-date
Tool Manager: toolchain-gccarmnoneeabi@1.70201.0 is already up-to-date
PS C:\Users\wolf\Documents\PlatformIO\Projects\Blimk_Debug> pio debug --interface=gdb -- -x .pioinit
KeyError: Traceback (most recent call last):
File "C:\Users\wolf\.platformio\penv\Lib\site-packages\platformio\__main__.py", line 103, in main
cli() # pylint: disable=no-value-for-parameter
^^^^^
File "C:\Users\wolf\.platformio\penv\Lib\site-packages\click\core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wolf\.platformio\penv\Lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "C:\Users\wolf\.platformio\penv\Lib\site-packages\platformio\cli.py", line 85, in invoke
return super().invoke(ctx)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\wolf\.platformio\penv\Lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wolf\.platformio\penv\Lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wolf\.platformio\penv\Lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wolf\.platformio\penv\Lib\site-packages\click\decorators.py", line 33, in new_func
return f(get_current_context(), *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wolf\.platformio\penv\Lib\site-packages\platformio\debug\cli.py", line 104, in cli
debug_config = _configure(*configure_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wolf\.platformio\penv\Lib\site-packages\platformio\debug\cli.py", line 113, in _configure
debug_config = DebugConfigFactory.new(
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wolf\.platformio\penv\Lib\site-packages\platformio\debug\config\factory.py", line 48, in new
return config_cls(platform, project_config, env_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wolf\.platformio\penv\Lib\site-packages\platformio\debug\config\generic.py", line 38, in __init__
super().__init__(*args, **kwargs)
File "C:\Users\wolf\.platformio\penv\Lib\site-packages\platformio\debug\config\base.py", line 52, in __init__
self.server = self._configure_server()
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wolf\.platformio\penv\Lib\site-packages\platformio\debug\config\base.py", line 182, in _configure_server
self.platform.get_package_dir(server_package)
File "C:\Users\wolf\.platformio\penv\Lib\site-packages\platformio\platform\_packages.py", line 32, in get_package_dir
pkg = self.get_package(name)
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wolf\.platformio\penv\Lib\site-packages\platformio\platform\_packages.py", line 29, in get_package
return self.pm.get_package(spec or self.get_package_spec(name))
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wolf\.platformio\penv\Lib\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
============================================================
```
Your workaround is working (on a fresh Win10)!
I tried the first and second suggestion on a fresh Win10: the error is same like on Win11
Next: I try your workaround on an older Win11… (to be continued…)
continue:
It also works on older win11 installations!
Thanks!
Ps.:
I don’t know if it matters: I previously installed it on both windows the Arduino IDE 2.1.1. I couldn’t start the debug on any of them, after that i started trying platformIO
The developers have rectified the issue with the latest commit (see linked issue above).
So you should be able to use
platform = https://github.com/platformio/platform-atmelsam.git#8a81489e3c0bc3c20a623336972333490c696649
(instead of platform = atmelsam
) to grab this fixed version. It’s also advised to watch out for the next stable version which will have this fix, that is whatever comes after 8.2.0 .
To test this in its initial conditions, you can just delete C:\Users\<user>\.platformio\packages\tool-openocd
and see if starting a debug session now installs the package and works or not.
Thank you for your help! I’ll try it out, I will give you a feedback.
The simple blink debug working fine finally, but my Arduino project is very big (more than 50 ino-s, a lot of include libraries, global variables…), based on my current knowledge the arduino project import is not too simple (and I don’t have time…), I will try to correct Arduino IDE 2.1.1 debugging error…