Skip to content

Add dynamic interpolation for package paths #5233

@maxgerhardt

Description

@maxgerhardt

It is extremely common and even recommended for Atmel AVR chips, when uploading via a programmer, to reference the path of a tool via e.g.

upload_flags =
    -C
    ; use "tool-avrdude-megaavr" for the atmelmegaavr platform
    ${platformio.packages_dir}/tool-avrdude/avrdude.conf

However, this is extremely fragile and non-reproducable, because sometimes the "tool-avrdude" that the project uses is actually in tool-avrdude@1.70100.0. Or there might be a case where platform_packages is used with a e.g. symlink:// so that the tool isn't even in ${platformio.packages_dir}.

See e.g. https://community.platformio.org/t/unable-to-upload-to-attiny814

This leads to frustration when users have to search for the errors in platformio.ini directives that the official documentation gives them. PlatformIO has no builtin way to reference the actual path used for a certain package.

Of course, one can write an extra script and use

Import("env")
platform = env.PioPlatform()
path = platform.get_package_dir("tool-avrdude")

to get the actual path, but that's very cumbersome. PlatformIO should have an interpolation syntax of maybe

${packages.tool-avrdude}

that fills in the actual path for the package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions