Loss of USB connection is usually a sign of TinyUSB not being correctly compiled.
First of all, try running the simplest possible sketch
#include <Arduino.h>
void setup() { Serial.begin(115200); }
void loop() { Serial.println("Hello"); delay(1000); }
(this may additionally need #include <Adafruit_TinyUSB.h>
at the top) and upload that. Does it work? If not, additionally add lib_archive = no
in your platformio.ini
, this resolves some special issues in regards to linkage.