How to have custom platform/framework add starter files?

I have a custom platform and framework for my boards that run (currently) as bare metal. I find that I generally have to manually add a ‘main.c’ file to the source directory whenever I create a new project.

Is there a way to add this into the platform, so that it will automatically create some starter files including baseline code whenever a new project gets created for that board/platform? When a new Arduino project gets created, it creates a ‘main.cpp’ file with functions for setup and loop by default. I’m basically looking to have something like that, in addition to some configuration files (FreeRTOS_config.h, for example).

Creating default files with their content is something that is done in PlatformIO core logic, not the platform’s logic

I’m not sure whether the platform can hook the project creation and act accordingly to fill these default files as you want it. If I had to guess, I’d say no. Maybe @ivankravets can confirm that for sure.

1 Like