STM32F411CE SPI.begin() breaks the serial COM port

I’ve used this board in the past without any problems, but it’s been a while so I just wanted to write a simple test program to test the Serial, HardwareTimer and SPI libraries.

#include <Arduino.h>
#include <HardwareTimer.h>
#include <SPI.h>

// Bare minimum test code: hardware timer interrupt, UART and SPI
bool ledOn = false;
HardwareTimer *tim1 = new HardwareTimer(TIM1);
void timer1ISR()
  ledOn = !ledOn;     
  digitalWrite(PC13, ledOn ? HIGH:LOW);
  Serial.print("LED state: "); Serial.println(ledOn);

void setup() {
    tim1->setOverflow(1000000, MICROSEC_FORMAT);

    //SPI.begin();    // Problematic SPI.begin() call

void loop() {

With the build flags as follows:

platform = ststm32
board = genericSTM32F411CE
framework = arduino
debug_tool = stlink
upload_protocol = stlink
build_flags =

monitor_dtr = 1

With SPI.begin()commented out, I get a COM port in the device manager, and I can see the serial transmissions from the board, no problem.

But if I uncomment the one call to SPI.begin(), the COM port no longer enumerates, and I get a “USB device not recognized” error:

Is there perhaps something really simple I’m missing?

As usual, figured it out moments after posting the question.
For my hardware the board should be blackpill_f411ce instead of genericSTM32F411CE.