Program stops as serial output (STM32F103) - please help

my platformio.ini

[env:genericSTM32F103C8]
platform = ststm32
board = genericSTM32F103C8
framework = arduino
upload_protocol = stlink
build_flags = 
	-D USBD_VID=0x0483
	-D USBD_PID=0x5740
	-D USBD_USE_CDC
	-D USBCON

    
board_build.upload_method = stlink
monitor_port = /dev/ttyACM0
monitor_speed = 115200

and here is the main program: it prints “ok1” on USB serial, but never makes ut to “ok2”

#include <Arduino.h>
#include <HardwareSerial.h>


HardwareSerial MavLinkSerial(PA9, PA10);
#define DbgSer Serial

  static uint32_t last_heartbeat_time = 0;

void setup() {
  MavLinkSerial.begin(57600);
  DbgSer.begin(115200);  //debug console
  delay(2000); //wait for USB port
}


loop() {

  if (millis() - last_heartbeat_time > 1000) {
    DbgSer.println("ok1"); 
    MavLinkSerial.print("XXXXXXXXXXXXX");
    DbgSer.println("ok2");
    last_heartbeat_time = millis();

  }
}

it seems RX/TX pins were swapped, causing this issue.