Working PlatformIO configuration for AVRISP MKII flashing Arduino Uno (ATMega328P)

The following configuration works for flashing the Arduino Uno with the AVRISP MKII:

platformio.ini
[env:uno]
platform = atmelavr
board = uno
framework = arduino
upload_protocol= custom
upload_port = usb
upload_flags =
   -C
   $PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf
   -p
   $BOARD_MCU
   -P
   $UPLOAD_PORT
   -c
   avrispmkII
 ;   -c stk500v2
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i

Check out similar posts by category: Arduino, Embedded