PlatformIO Community

Issues with finding Atmel Ice Program/Debugger

I am giving PlatformIO IDE a try so that I can use the hardware debug features available to do debugging on an Arduino Nano using a Mega 328P.

I am currently getting the below error:

Library Manager: Installing atmel-ice
Warning! Could not find the package with ‘atmel-ice’ requirements for your system ‘windows_amd64’
Library Manager: Installing atmel-ice
Warning! Could not find the package with ‘atmel-ice’ requirements for your system ‘windows_amd64’

I have read that there is issue getting this to work. Do I need to install the Atmel Studio 7 software to get the debugging to work.

Thank you for your time.

You are declared atmel-ice… in the lib_deps section? Please show your whole platformio.ini.

Hi Maxgerhardt,

Please see below for the Platformio.ini file.

[env:nanoatmega328new]
platform = atmelavr
board = nanoatmega328new
framework = arduino
lib_deps = adafruit/Adafruit INA219@^1.1.1
  lib/PWM-master
 debug_tool = atmel-ice 
 upload_protocol = atmel-ice

Regards,

Louis

No spaces at the front, otherwise it will be seen as a continuation of the line before it.

Hi Maxgerhardt,

I removed the spaces and now I am getting the below errors.

Verbose mode can be enabled via -v, --verbose option
DebugInvalidOptionsError: Unknown debug tool atmel-ice. Please use one of avr-stub, simavr or custom:
File “C:\Users\lcesero.platformio\penv\Lib\site-packages\platformio\builder\main.py”, line 177:
env.SConscript("$BUILD_SCRIPT")
File “C:\Users\lcesero.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Script\SConscript.py”, line 591:
return _SConscript(self.fs, *files, **subst_kw)
File “C:\Users\lcesero.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Script\SConscript.py”, line 280:
exec(compile(scriptdata, scriptname, ‘exec’), call_stack[-1].globals)
File “C:\Users\lcesero.platformio\platforms\atmelavr\builder\main.py”, line 162:
target_elf = env.BuildProgram()
File “C:\Users\lcesero.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Util.py”, line 658:
return self.method(*nargs, **kwargs)
File “C:\Users\lcesero.platformio\penv\Lib\site-packages\platformio\builder\tools\platformio.py”, line 61:
env.ProcessProgramDeps()
File “C:\Users\lcesero.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Util.py”, line 658:
return self.method(*nargs, **kwargs)
File “C:\Users\lcesero.platformio\penv\Lib\site-packages\platformio\builder\tools\platformio.py”, line 113:
env.PrintConfiguration()
File “C:\Users\lcesero.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Util.py”, line 658:
return self.method(*nargs, **kwargs)
File “C:\Users\lcesero.platformio\penv\Lib\site-packages\platformio\builder\tools\pioplatform.py”, line 234:
_get_debug_data(),
File “C:\Users\lcesero.platformio\penv\Lib\site-packages\platformio\builder\tools\pioplatform.py”, line 198:
% board_config.get_debug_tool_name(env.GetProjectOption(“debug_tool”)),
File “C:\Users\lcesero.platformio\penv\lib\site-packages\platformio\platform\board.py”, line 139:
raise DebugInvalidOptionsError(
=================================================================================== [FAILED] Took 0.94 seconds ===================================================================================
The terminal process “C:\Users\lcesero.platformio\penv\Scripts\platformio.exe ‘run’” terminated with exit code: 1.

Regards,
Louis

Oh right, yeah that won’t work. PlatformIO does not support debugging via an Atmel-ICE out of the box that way. The supported upload and debug options are listed in the documentation of the board.

https://docs.platformio.org/en/latest/boards/atmelavr/nanoatmega328new.html?highlight=nanoatmega328new#debugging

It not being supported out of the box mainly stems from Atmel refusing to release tools that open a standard GDB server and something that does not depend on AtmelStudio.

You can use the Atmel-ICE for upload since AVRDude supports it, but for that you need to set upload_protocol to the programmer id value that AVRDude expects. That should be atmelice_isp. See How to setup Atmel-ICE to program an ATmega328 on PlatformIO with VSCode on Windows 10 for full config.

You can also use experimental Atmel-ICE debugging through the avarice tool. See CLion / Avarice debug not working for config and AVaRICE download | SourceForge.net for a binary download.

Hi Maxgerhardt,

I will give that a try sometime this week. Thank you for the help.