Custom platform and packages from local folders

I’m trying to create a new custom platform (new chip) and package for the Arduino framework. I’ve been able to get the platform created and installed from a local directory on my computer but it fails when trying to create a new project for that platform because it can’t find and/or install the package required for the framework on this new chip (I have it in a local folder but I haven’t been able to figure out how to install it). Is there some way in the platform.json file to indicate a package comes from a local folder?

Hm I remember being in the same situation while developing GitHub - maxgerhardt/platform-w60x: PlatformIO platform for WinnerMicro W60X chips..

Try the following things:

  • install the packages locally in their expected path. If you are e.g. referencing a framework-arduino-w60x pacakge, create the folder C:\Users\<user>\.platformio\packages\framework-arduino-w60x and fill it with the data and the package.json. Maybe it tricks it into thinking it’s already installed.
  • use a platform_packages directive in the platformio.ini together with the file:// pseudoprotocol to link to your local folder. Syntax for the protocol is the same as here.
  • pio package publish package, wait for approval (typically 1-2 days), then it will be found during normal installation if you referenced it correctly in the platform.json (with owner and package name). You can still modify the files locally and publish a new version, so the initial version does not have to be final.

Thanks Max, I was able to install the “platform” locally but haven’t been able to get the “package” required by the platform to install locally. I’ll try the copy locally but I think I’ve already tried that (but maybe not after installing the platform). I did “publish” the package to the registry (and it got approved) but it got installed as a “platform” instead of a “package” so when it tries to install the package it fails because it can’t find a “package” with the correct name and instead just finds a platform with that name. Is there something I’m doing incorrectly that causes it to be installed as a platform rather than a package?

Hi Max, had already tried putting the files into the correct locations in the folder structure and that doesn’t find the required “package” when creating a new project for the installed platform. I had already “published” the package to the private repository using the pio package publish and I can see it when doing a pio access list. However, platformio doesn’t like it for some reason and it still fails when trying to create a new project. I’ll give the platform_packages directive to see if that allows me to get things going so I can at least work on supporting the new platform (I may also continue to try and debug why the repository package is failing, I know platformio finds it but it doesn’t like something about it). Is there anyone else i should ping about this issue?

Thanks,

Randy

If you’ve published a package as a platform by accident, @ivankravets can help to unpublish the wrong one and publish the right one. Just drop the name here or via PM.

1 Like

Thanks, I didn’t see an “option” to pio package publish to specify platform vs package. I pretty much copied the structure from an existing package so I’m not sure what I could have done wrong to get it published as a platform. I’ll check with @ivankravets!

You did everything correct. How do you try to use this published package?

Ok, finally managed to get back to this and it took me a bit to get back up to speed. It looks like when I list the “packages” I published it goes to https://api.registry.platformio.org/v3/resources and finds the package I published there (it is listed from a pio access list). However, when I try to initialize a new project with the platform (that I installed locally without any issues) it only looks in https://api.registry.platformio.org/v3/packages/platformio/tool for the package, which of course it can’t find. Any ideas what I’m doing incorrectly?

Any chance I could get some feedback from my last update? I was attempting to debug what happened but I’m not very familiar with web protocols (REST API, etc.) so I don’t know if my analysis is correct.

We don’t see any packages published from your account to our registry. How did you publish them?