As (part of) a challenge I try to upload a pre-compiled sketch (export compiled binary) using a programmer in IDE 2.x that uses the USB port of the target board (Nano clone).
The programmer is in place and seems to work. I however need the path to the sketch directory and according to the platform specification I should be able to use {sketch_path} or {build.source.path} as shown below
tools.avrdude.program.pattern="{cmd.path}" "-C{config.path}" {program.verbose} {program.verify} -p{build.mcu} -c{protocol} {program.extra_params} -D "-Uflash:w:{sketch_path}/{build.project_name}.{build.variant}.hex:i"
However performing an upload using programmer results in {sketch_path}
being literally in the avrdude command resulting in an error.
"C:\Users\bugge\AppData\Local\Arduino15\packages\arduinoAvrUploadOnly\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\bugge\AppData\Local\Arduino15\packages\arduinoAvrUploadOnly\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -patmega328p -carduino -PCOM9 -b57600 -D "-Uflash:w:{sketch_path}/SerialPrint.ino.eightanaloginputs.hex:i"
Same for {build.source.path}
.
This was a known bug in IDE 2.x that was fixed before IDE 2.3.2 was released but the fix does not seem to have made it into that release. See e.g. Pass source path to bootloader and The `sketch_path` platform property is not generated · Issue #2340 · arduino/arduino-cli · GitHub.
Also tested with an older nightly (20240910, I know that it's not the latest but with the date of the fix it should not matter too much) resulting in the same behaviour.
Is there a solution?
Note:
I'm aware that the path to the hex files might not yet be correct but that is the next step.