I want to make a platform support myself, but I don't quite understand some things

I want to make a platform support myself, but I was looking at some released versions and found something that doesn’t exist on documentation for example platform-espressif32 this repository.
I found a platform.py file in its root directory, where a class called Espressif32Platform inherits from the class PlatformBase and overloads some functions. But I don’t quite understand what this class does and where it is called, and I haven’t found any documentation on it.
Thank you for your answer, thank you very much!

1 Like

I’ve created 4 or so new platforms, or signifcant extensions to them, in the past years and all I can say is: Learn by doing. You start to recognize patterns when you look at different official platforms like https://github.com/platformio/platform-ststm32, https://github.com/platformio/platform-atmelavr/, https://github.com/platformio/platform-raspberrypi/, et cetara.

The class Espressif32Platform is instantiated by the PlatformIO core code with a certain expected name based on the platform’s name declared in the platform.json, lowercased except the first letter.

The PlatformIO core will call the magic methods defined in that class for getting the configuration options for boards, packages, debug tools, et cetara. It’s really best to learn by the examples here and recognize the common code patterns for inclusion of packages, definition of debug servers etc.

I really, really want good documentation on the very intricate details of that too, but they’re not provided in that depth yet. There are lots of scattered islands of knowledge one has to have to create this.

Best I can give you is some thing I wrote some ago for helping you understand the build system (aka, SCons) and some PlatformIO specifics: Arduino Due (or other SAM3/4) upload fails with ATMEL ICE JTAG on VSCode with PlatformIO - #8 by maxgerhardt

Along with the platforms I’ve created or expanded…