OK I have tried to figure out how to create custom board/platform, and it is very confusing.
For example I looked at the atmelsam platform and it is a confusing as there is a platform.json and platform.py which seems to duplicate information, why is the data duplicated? Also there is the builder for frameworks, ie arduino.py, simba.py, _bare.py, etc. It appears that these scripts define the compiler flags (CCFLAGS) thus it is a bit confusing how one would build a project for debugging (-O0) when in the build script it is hard coded for -Os. Specifically I usually compile code with -O0 when I am debugging and then compile with -Os for release builds. Sometimes I even have to compile some files -Os and then compile specific files I am debugging with -O0. Is this possible in PlaftormIO?
I can see the value in PlatformIO downloading the packages (tool chain, debugger, etc) that is needed for a board, however it appears to remove all flexibility and configuration for your project. So I am wondering if PlatformIO is intentionally this confusing, or am I missing some key design philosophy which is limiting my mental model of how PlatformIO is intended to work?
That is why would I choose to use PlatformIO over cmake or makefile?