nRF51822 and mbed lib in PlatformIO

I’m developing code for board with nRF51822 chip. First I was writing it in mbed editor and everything was working fine.
Now I want to try PlatformIO integrated with VS Code. After installing everything, I created new project, added mbed and nrf51822 libs to it. Everything was fine, because simple blink code compile without error and after upload to board it works.

Then I wanted to test BLE and then I found problem. My code below:

#include "mbed.h"
#include "ble/BLE.h"
#include "BatteryService.h"

const static char DEVICE_NAME[] = "Button";
static const uint16_t uuid16_list[] = { GattService::UUID_BATTERY_SERVICE };

#define LED_PIN P0_18
#define BUTTON_PIN P0_19

BLEDevice ble;
DigitalOut statusLed(LED_PIN);
Ticker statusLedTicker;
BatteryService *batteryServicePtr;

void statusLedCallback()
    statusLed = !statusLed;

void bleInitComplete(BLE::InitializationCompleteCallbackContext *params)
    BLE &ble          = params->ble;
    ble_error_t error = params->error;
    if (error != BLE_ERROR_NONE) 
    BatteryService batteryService(ble, false);
    batteryServicePtr = &batteryService;
    /* Setup advertising. */ | GapAdvertisingData::LE_GENERAL_DISCOVERABLE);, (uint8_t *)uuid16_list, sizeof(uuid16_list));, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME));;; /* 1000ms */;

int main() 
    statusLedTicker.attach(statusLedCallback, LED_BLINK_INTERVAL_S);
    BLE& ble = BLE::Instance(BLE::DEFAULT_INSTANCE);
    while (ble.hasInitialized()  == false) { /* spin loop */ }

    while (true) 

Code compile without error, but after upload to device nothing happen. When I comment line:

BLEDevice ble;

led blink, but bleInitComplete con’t run and I don’t see my device on phone.
There is any way to debug step by step through constructor of BLEDevice to check what could happen?

Please report your issue to Issues · platformio/platform-nordicnrf51 · GitHub