Local per-project copy of framework?

Hi there,

I am working on a project using a Teensy LC and I have modified a few files inside the framework. (Specifically, .platformio/packages/framework-arduinoteensy/cores/teensy3/usb_desc.h, usb_desc.c and usb_joystick.h).

I’d like to have a local copy of the framework inside my project folder so that I can keep these edits project-specific, rather than making changes to the global version. This would be cleaner and I also wouldn’t have to keep copying my edited files back in after an update. Is there a way to do that?


See Redirecting... but I would more recommend Redirecting.... If you modify framework files, just upload your modified framework-arduinoteensy folder somwhere and set

platform_packages = 
   framework-arduinoteensy@<downloadlink or git link to your modified framework here>

This isn’t a per-project copy but a global resource multiple projects can use then.

If you need per-project modifications I guess you could script it.

1 Like

Hmm. Is there no way to do it without uploading the content to GitHub etc? I understand the issues with having some of the framework pulled from a server and some other files replaced with local copies, but the modifications I’ve made are so small (and unlikely to change in future versions of the Teensy software) that it seems kind of excessive.

How would you approach a custom script to do this? I think something that would work well for me might be

  • have local copies of the three files I need to replace
  • at build time, copy those three files into the target folder, backing up the originals
  • build
  • move the original files back after build and upload

but I have never added custom scripting to a PlatformIO project before.

Actually from what I’ve read here the framework-arduinoteensy=<path> can also be a local filesystem path, have you tried that?

1 Like

Putting the line

framework-arduinoteensy = C:\path\to\folder\

in platformio.ini under either [platformio] or [env:teensylc] just gives:

Warning! Ignore unknown configuration option framework-arduinoteensy in section [platformio]

How should this be configured? I wasn’t aware that frameworks could be replaced in this way, but it would solve my question perfectly if it works.

No I meant as in the above config

platform_packages = 
   framework-arduinoteensy@<downloadlink or git link to your modified framework here>

the link

This one is a bit odd…
The format for specifying a file is

platform_packages =

For a relative path, file://./platform
For an absolute path, file:///mnt/pio/platform

I dont think the format for this is specified in the docs