You can interface PlatformIO with the GitHub - Florin-Popescu/avarice: AVaRICE with support for newer devices program and an AVR Dragon to connect to the chip and debug it. This has already been discussed at e.g. ATMEGA1284P Debugging - #2 by maxgerhardt