I need to modify some of the Teensy core files to add support for single wire serial, but I couldn’t find out where PlatformIO is taking the source code files from.
Ideally those source code files should also be integrated directly in the project so other developers do not also have to modify the files. Is there a way to do this?
Depending on your operating system, the files will be coming from
Linux (Mac also?): ~/.platformio/packages/
Windows: %userprofile%/.platformio/packages/
But that is not the best way to do things, as changes would be lost if the platform files are updated, and it isn’t project specific. I was just thinking you could do a pre-build script that made the changes, but I don’t know what that would look like, or was feasible…
I’m working on a Mac and I already looked into the .platformio folder, but I didn’t find the Teensy core source files. In the Teensy board folders are the exact same files as in this GitHub repository.
I have not figured out yet how this build process works and where it get’s the source files. But I guess it should be possible to copy the files into the project and create a custom board as described here. Has anyone already done this and is there a guide how to do this?
So no packages/framework-arduinoteensy folder? Have you actually compiled something for the teensy, so that all required packages are installed?
With PIO, Teensy needs framework-arduinoteensy and toolchain-gccarmnoneeabi to build, and tool-teensy to upload. framework-arduinoteensy has all the core files and teensy libraries. `toolchain-gccarmnoneeabi is the compiler toolchain.
Thanks for the hint. I found the core sources in the packages/framework-arduinoteensy folder and I was able to modify the files to implement the singe wire serial function.
Do you think it would be possible to implement this framework including the changes directly into the project?
I’ve never fiddled with that level of change, so it would be more in the realms of something for @maxgerhardt or @ivankravets to comment on. Is this not something that might be useful to be integrated into the teensy core proper? Something to ask Paul Stoffregen maybe?
I’ve managed to create a separate platform and framework package including the changes for single wire serial. So the changes will not be overwritten by automatic updates. But the two folders still have to be copied manually to the .platformio folder. Maybe it would be possible to copy the two directories automatically using a Python script.
@maxgerhardt@ivankravets Is this the right way to publish a project that needs changes to the core framework files of the device or is there a better way? Would it also be possible to copy the two directories automatically?
I’ve managed to create a separate platform and framework package including the changes for single wire serial. So the changes will not be overwritten by automatic updates. But the two folders still have to be copied manually to the .platformio folder. Maybe it would be possible to copy the two directories automatically using a Python script.
Is this the right way to publish a project that needs changes to the core framework files of the device or is there a better way? Would it also be possible to copy the two directories automatically?
This seems like a fab solution - one that I’m struggling to implement myself. Is there anyway you could point me at or publish a reasonably detailed “how to” on this. It seems to be what would be needed as a first step towards generalising another board to be included in a more broad distro by uploading and sharing with the community.
You have modified your framework core files. Thus in the PIO architecture, you’ve modified the framework-arduinoteensypackage. These sources for these packages and the packages themselves are defined in the platform’splatform.json file.
Example
So the actual clean way would be to fork the platform-teensy repository, modiy the platform.json to point to a different package repository which you control, and in this manifest add a new version of the framework-arduinoteensy and the download link to where you have your modified files.
Thanks for the hint. I didn’t know that I can simply point the platform to a GitHub link. I created a fork of the platform and simply added a manifest.json to my GitHub project. The platform and modified package is now downloaded automatically. Thanks for the quick help!
I also need to modify a Teensy core (Teensy41).
Now that issue 1367 is implemented, is there a better/easier way to use my own fork of GitHub - PaulStoffregen/cores: Teensy Core Libraries for Arduino ?
I’ve tried using [env:override_framework] without success.
Do I still need to make my own framework-arduinoteensy package?
I don’t understand how platform-teensy actually refers to PaulStoffregen’s cores.
including the download links. These packages are uploaded by PlatformIO staff. So, platform-teensy never has a direct reference to https://github.com/PaulStoffregen/cores, only to the framework-arduinoteensy, which is the Teensy core (with added package.json).
In the special case of https://github.com/PaulStoffregen/cores, it doesn’t have the actual core package used by the Arduino IDE (there’s no platform.txt, boards.txt, libraries etc), the core is actually better packaged at Teensyduino: Download and Install Teensy support into the Arduino IDE.
Sure, just change the version. The package.json is all metadata, not really used in the build process. But there must be at least a package.json with the correct name field to identify the package.
You misunderstand the example and the syntax, you shouldn’t create a new [env:..], you should place the platform_packages in that environment in which you want to override stuff. Also you can’t just rename the framework-arduinoteensy package as cores, you need to specify the right name. So,