Using mBed OS 2 single thread

Even for mbed-os that’s a bit much (16 minutes). PIO compiles the entirety of the framework there (if not given .mbedignore files). But still, that should be like 5 min max and not 16. For me on Windows, I had problems with Windows Defender interfering and heavily slowing down the process (Hang creating new projects. Hang using pio install - #2 by maxgerhardt), maybe that is also the case here?

Per NuMaker-PFM-NANO130 | Mbed that board has NANO130KE3BN ARM-Cortex M0+ MCU. PlatformIO doesn’t have any support for Nuvoton MCUs at this point, only one feature requets for another Nuvoton board was filed a year ago. So, you should also open an issue there for a feature request for that board.

If you have the time, you can test a self-made integration: Create any new project, e.g. for the Nucleo F103RB and the mbedos framework. Create a new folder boards in that project, and therein the file numaker_pfm_nano130.json. Fill it with the content

{
    "build": {
      "core": "stm32",
      "cpu": "cortex-m0",
      "extra_flags": "-Dnano130ke3bn",
      "f_cpu": "42000000L",
      "mcu": "nano130ke3bn",
      "product_line": "STM32F103xB",
      "variant": "NUMAKER_PFM_NANO130",
      "mbed_variant": "NUMAKER_PFM_NANO130"
    },
    "debug": {
      "default_tools": [
      ],
      "jlink_device": "NANO130KE3BN",
      "onboard_tools": [
      ],
      "openocd_target": "numicro",
      "svd_path": "STM32F103xx.svd"
    },
    "frameworks": [
      "mbed"
    ],
    "name": "NuMaker-PFM-NANO130",
    "upload": {
      "maximum_ram_size": 16384,
      "maximum_size": 131072,
      "protocol": "mbed",
      "protocols": [
        "jlink",
        "cmsis-dap",
        "stlink",
        "blackmagic",
        "mbed"
      ]
    },
    "url": "https://os.mbed.com/platforms/NUMAKER-PFM-NANO130/",
    "vendor": "Nuvoton"
  }

then change the platformio.ini to

[env:numaker_pfm_nano130]
platform = ststm32
board = numaker_pfm_nano130
framework = mbed

And as src\main.cpp

#include <mbed.h>

int main() {

  // available pins see https://github.com/ARMmbed/mbed-os/blob/mbed-os-6.9.0/targets/TARGET_NUVOTON/TARGET_NANO100/PinNames.h
  DigitalOut led(LED_RED);

  while(1) {
      led = 0;
      ThisThread::sleep_for(500);
      led = 1;
      ThisThread::sleep_for(500);
  }
}

compilation should give

RAM:   [=====     ]  45.7% (used 7489 bytes from 16384 bytes)
Flash: [==        ]  21.8% (used 28552 bytes from 131072 bytes)
=================== [SUCCESS] Took 9.68 seconds ===================

and you can try uploading the firmware normally via the upload button, which should use the USB storage device programming method.