platformio / platform-atmelavr

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

please consider to add upload.mcu #327

Open diniig opened 9 months ago

diniig commented 9 months ago

Please consider to add upload.mcu like existing build.mcu in case upload.mcu is absent then pio would use build.mcu https://github.com/platformio/platform-atmelavr/blob/d9d2738bcb1c632e2f5e3c57318e6ae8281ee960/builder/main.py#L207C20-L207C20

it needs to support Amperka boards

they compile code as build.mcu=atmega328p but upload as upload.mcu=tmega328pb

see https://github.com/amperka/amperka-boards/blob/master/platform.txt#L11C8-L11C8

MCUdude commented 8 months ago

If you're uploading to an ATmega328PB, why not compile for it as well? PlatformIO supports the ATmega328PB.

And if you just have to upload to a different target than what you have compiled for, you can always use a custom upload command:

From the MiniCore PlatformIO README:

; Run the following command to upload with this environment
; pio run -e Upload_ISP -t upload
[env:Upload_ISP]
; Custom upload procedure
upload_protocol = custom
; Avrdude upload flags
upload_flags =
  -C$PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf
  -patmega328pb
  -PUSB
  -cusbasp
; Avrdude upload command
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i
diniig commented 8 months ago

why not compile for it as well

not everything compile well :( - yes, this looks as issue to amperka but i thought about agility of platform io. I would not write the full upload command, just set MCU in board file. upload_command - I use this currently.