Yep, that's the plan -- rebase on top of new versions of the library; see if a PR for the changes will be accepted.
I have it working now. There were more gotchas than I expected, but I learned things. Another goal that developed was to have minimal changes to the other files in the framework package and platform. Some names did have to change, but it was a fairly manageable amount.
I settled on submodule repositories within the project directory, with the actual files coming from the working directories, not the repositories. The short of it is, the end goal is to get PlatformIO to copy the framework-arduinoteensy directory to ~/.platformio/packages (and name it something NOT framework-arduinoteensy) and the platform-teensy directory to ~/.platformio/platforms (and name it "teensy"), then use both of those to build the project. Sounds a lot simpler than it felt.
Here are the things I learned along the way:
- Open platformio.ini and save it to refresh the platform and framework packages; the Output tab shows progress and errors
- The framework package needs to contain more than just the
Teensy cores repo; the other stuff surrounding it is easy to pull from ~/.platformio/packages/framework-arduinoteensy, though. This was stated in
the thread I linked earlier.
- If you change the name of the framework package (originally "framework-arduinoteensy"), you won't end up with
this problem.
- To specify a local directory (as opposed to the git repo inside the directory),
prepend file:// to the path; e.g.,
Code:
file://./framework-arduinoteensy-cjd
for that directory inside the build directory (I experienced mixed results with local git repositories, but bare ones generally worked better)
- The name of the framework package directory (e.g., "framework-arduinoteensy-cjd") matters, and needs to match the framework name before the @ symbol, e.g.,
Code:
platform_packages = framework-arduinoteensy-cjd @ file://./framework-arduinoteensy-cjd
- The names of the framework package inside the framework's files don't seem to matter at all (package.json, .piopm both contain framework-arduinoteensy) and everything builds regardless of whether it is changed to framework-arduinoteensy-cjd
- The names of the framework package inside the platform DO matter (builder/frameworks/arduino.py, platform.json)
- The name of the platform directory doesn't seem to matter, and doesn't need to be different from the original; when PlatformIO copies it to the build directory, it will append some long SHA1-looking thing to disambiguate. Note that this is first-come, first-serve; if you clear the ~/.platformio/platforms directory, the next time you save platformio.ini, it will repopulate with "teensy", containing the files from "platform = ". The directory named "teensy" without the suffix is NOT necessarily the unmodified library, just the first one of that name to be built since the directory was emptied.
- The name of the platform within the platform.json file determines the name of the directory in the build directory -- renaming from "name" : "teensy" to "name" : "teensy-cjd" caused a directory named "teensy-cjd" to appear in ~/.platformio/platforms, and caused the refresh to fail. I imagine more things would need to change for this to work.
- Don't rename the board or the framework. Attempting to rename the arduino framework (e.g., "framework = arduino" in platformio.ini) was neither necessary nor helpful. After I tracked down all of the locations and changed them, PlatformIO wouldn't fetch the dependencies that are regular Arduino libraries.
Also, after I finished, I found this:
https://docs.platformio.org/en/latest/scripting/examples/override_package_files.html