When you start a new project in PlatformIO, it gives you a choice of board. Then, it will usually pre-select Arduino framework.
The new project that is created has setup() and loop() functions in it already.
Using the main() function perhaps confused it. You normally don't need to #include avr.h
I just tested your program but put the
in setup().
The rest of the code should be in loop. Of course, you won't need the while(), since loop will do that for you.
Led blinks