Platform specific project task

I am adding a custom platform to Platformio. I am unable to find a way to add platform specific tasks, like ESP32 has platform specific project tasks as highlighted below.

Similar way I need custom task for my platform. How can I add them? I searched in platforms/espressif32 I could not find anything that add those task to the list.

I think what you’re after is Custom Tasks… I don’t know if they’re added to project tasks list, but they should be available through the main ‘Run task’ option anyway…

I am looking for custom task but they should be added by itself when platform is selected. Just like in case of ESP32 the highlighted tasks get added by itself. There is no entry to be made by user or no tasks.json needs to be created. I searched pio core as well as platform source of esp32 I could not search for “Erase Flash” string anywhere. I am not sure how or where these tasks get added. I hope you get my real question now.

Since you’re looking at something VSCode related, it helps to look at the VSCode extension.

This file seems to have something to do with getting the tasks.

But not directly, it looks to be serviced by platformio-node-helpers, so this file ultimately seems responsible to the tasks list.

Maybe reading through that will make some sense to you, but I don’t know VSCode extensions, so it’s all javascript to me!

Thank you so much. Atleast now I know where is it coming from :slight_smile:
But now the question is, Does node-helpers have options to hook platform specific tasks? Looking at the source I dont think there is any option of that sort. Its all hardcoded for platforms

  name: 'Upload using Programmer and Set Fuses',
  args: ['run', '--target', 'fuses', '--target', 'program'],
  multienv: true,
  filter: data => data.platform.includes('atmelavr')

I would rather post an issue in the node-helpers repo, That might be the best thing to do.

1 Like

@ivankravets will be the best person to comment on the ability to add tasks to the projects list in the VSCode extension, but posting an issue probably won’t hurt. He usually responds within a day or so if specifically mentioned though.

Hey, it looks like you’re going to get your wish… the roadmap for the VSCode extension includes mention of custom targets :slight_smile:


looking forward to it :+1:

Hi @pfeerick
Sorry for posting this in an old thread. Is there a documentation for creating platform specific tasks?


1 Like

I was using env.Alias earlier, changed it to AddCustomTarget and I can see the target in PIO CLI but it does not show in project tasks. which is the main question here.

    env.AddCustomTarget("reflash", None, [
        env.VerboseAction("$REFLASH_CMD", "Reflashing core...")
    ], title="Reflash Module Core", description="Reflash module core firmware."))


Did you click on the upper-right “Refresh Tasks” icon in the “project tasks” view? It will show up under the “Custom” category.

1 Like

silly me!! I wasn’t looking there. :+1: Thanks looks like the request is finally completed. Thank you PlatformIO Team for such an amazing IDE.