platformio / platform-atmelavr

Atmel AVR: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/atmelavr
Apache License 2.0
138 stars 105 forks source link

Debug probe support for atmel-ice / dragon and atmega328p processor #53

Open warrenwoolseyiii opened 7 years ago

warrenwoolseyiii commented 7 years ago

As the title states I am looking for debug probe support for the atmel-ice / and or dragon debug probes. I specifically need support for the atmega328p processor which I am using in a custom application.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/46371543-debug-probe-support-for-atmel-ice-dragon-and-atmega328p-processor?utm_campaign=plugin&utm_content=tracker%2F38207915&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F38207915&utm_medium=issues&utm_source=github).
valeros commented 7 years ago

Hi @warrenwoolseyiii ! Thanks for your request! We don't have required hardware, so it would be great if you could help us implement initial support for debugging in atmelavr platform. First steps: Install the development version of atmelavr:

pio platform uninstall atmelavr
pio platform install https://github.com/platformio/platform-atmelavr.git

Then create a new project and modify platformio.ini to fit your needs, e.g.:

[env:uno]
platform = atmelavr
framework = arduino
board = uno
debug_port = :4242
debug_tool = custom
debug_init_cmds =
  target remote $DEBUG_PORT
  file "$PROG_PATH"
  load
debug_server =
  /path/to/avarice
  --edbg
  --debugwire 
  --ignore-intr 
  :4242

Now you can start debugging session from terminal using pio debug --interface gdb -x .pioinit Some of above commands might not work, especially load (in this case you will need to upload debug version of firmware manually using avrdude)

warrenwoolseyiii commented 7 years ago

valerii this is awesome thank you so much for getting me started. I will keep you updated with progress.

On Tue, Jun 20, 2017 at 5:14 AM, Valerii Koval notifications@github.com wrote:

Hi @warrenwoolseyiii https://github.com/warrenwoolseyiii ! Thanks for your request! We don't have required hardware, so it would be great if you could help us implement initial support for debugging in atmelavr platform. First steps: Install the development version of atmelavr:

pio platform uninstall atmelavr pio platform install https://github.com/platformio/platform-atmelavr.git

Then create a new project and modify platformio.ini to fit your needs, e.g.:

[env:uno]platform = atmelavrframework = arduinoboard = unodebug_port = :4242debug_tool = customdebug_init_cmds = target remote $DEBUG_PORT file "$PROG_PATH" load tb maindebug_server = /path/to/avarice --edbg --debugwire --ignore-intr :4242

Now you can start debugging session from terminal using pio debug --interface gdb Some of above commands might now work, especially load (in this case you will need to upload debug version of firmware manually using avrdude)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/platformio/platform-atmelavr/issues/53#issuecomment-309734508, or mute the thread https://github.com/notifications/unsubscribe-auth/AF0ZGieEa6Y7OCXg32q_uMYeLgdEGNXHks5sF7eMgaJpZM4N-kdg .

-- Warren Woolsey warren.woolseyiii@gmail.com 805 602 0458

albertskog commented 6 years ago

How's the progress @warrenwoolseyiii, did you manage to get it working? 😄

kasbah commented 6 years ago

I tried this and got:

$ pio debug --interface gdb -x .pioinit
PlatformIO Plus (https://pioplus.com) v0.14.1
Error: Traceback (most recent call last):
  File "main.py", line 128, in main.main
  File "/home/kaspar/.local/lib/python2.7/site-packages/click/core.py", line 700, in __call__
    return self.main(*args, **kwargs)
  File "/home/kaspar/.local/lib/python2.7/site-packages/click/core.py", line 680, in main
    rv = self.invoke(ctx)
  File "/home/kaspar/.local/lib/python2.7/site-packages/click/core.py", line 1027, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/kaspar/.local/lib/python2.7/site-packages/click/core.py", line 873, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/kaspar/.local/lib/python2.7/site-packages/click/core.py", line 508, in invoke
    return callback(*args, **kwargs)
  File "/home/kaspar/.local/lib/python2.7/site-packages/click/decorators.py", line 16, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "cmd_debug.py", line 61, in cmd_debug.cli
  File "cmd_debug.py", line 66, in cmd_debug.cli
  File "cmd_debug.py", line 235, in cmd_debug.validate_debug_options
TypeError: argument of type 'NoneType' is not iterable

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

An unexpected error occurred. Further steps:

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

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

* Report this problem to support@pioplus.com

============================================================
$ pio --version
PlatformIO, version 3.5.2rc2
$ pio update
...
Platform Atmel AVR
--------
Updating atmelavr                        @ 5d08019        [Up-to-date]
Updating toolchain-atmelavr              @ 1.40902.0      [Up-to-date]
Updating framework-arduinoavr            @ 1.10620.2      [Up-to-date]
...

With PlatformIO 3.5.1 I get:

$ pio debug --interface gdb -x .pioinit
************************************************************************************
Obsolete PIO Core v3.5.1 is used (previous was 3.5.2rc2)
Please remove multiple PIO Cores from a system:
http://docs.platformio.org/page/faq.html#multiple-pio-cores-in-a-system
************************************************************************************
PlatformIO Plus (https://pioplus.com) v0.14.1
Error: Traceback (most recent call last):
  File "main.py", line 128, in main.main
  File "/tmp/venv/local/lib/python2.7/site-packages/click/core.py", line 700, in __call__
    return self.main(*args, **kwargs)
  File "/tmp/venv/local/lib/python2.7/site-packages/click/core.py", line 680, in main
    rv = self.invoke(ctx)
  File "/tmp/venv/local/lib/python2.7/site-packages/click/core.py", line 1027, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/tmp/venv/local/lib/python2.7/site-packages/click/core.py", line 873, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/tmp/venv/local/lib/python2.7/site-packages/click/core.py", line 508, in invoke
    return callback(*args, **kwargs)
  File "/tmp/venv/local/lib/python2.7/site-packages/click/decorators.py", line 16, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "cmd_debug.py", line 61, in cmd_debug.cli
  File "cmd_debug.py", line 66, in cmd_debug.cli
  File "cmd_debug.py", line 233, in cmd_debug.validate_debug_options
AttributeError: 'PlatformBoardConfig' object has no attribute 'get_debug_tool_name'

...
suroh001 commented 5 years ago

Any updates on this?

lloydjatkinson commented 4 years ago

Considering its now 2020 and the popularity of the 328/Arduino, I'm quite surprised debugging isn't supported yet. Is this being considered or not?

audryhome commented 4 years ago

Since Black Magic probe is supported, I think it may be possible to hack this firmware to make it pio friendly with AVR ... any other idea?

fatihelbl commented 2 years ago

Hello, I have PICKIT4. I want debugging . Arduino leonardo is also trying to make mistakes. But it didn't work out. How should I proceed? I have Win10, Visual Studio Code( 1.64.2), PlatformIO (v2.4.2)