PlatformIO Community

Uploading to STM32 using stm32 core with STLink V2

I’ve been trying to make this test program for PWM control upload to my blue pill over an STLink V2 programmer. It makes use of the analogWriteFrequency(uint32_t) function, which is only available in the stm32duino core, not in the maple core.

#include <Arduino.h>

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  analogWriteFrequency(10);
}

void loop() {
  for (uint32_t i = 0; i < 4096; i++) {
    analogWrite(LED_BUILTIN, i);
    delay(10);
  }

  delay(500);
}

As such, I’ve been trying to use the following target in platformio.ini:

[env:genericSTM32F103C8]
platform = ststm32
board = genericSTM32F103C8
framework = arduino
upload_protocol = stlink
debug_tool = stlink
; board_build.core = maple
board_build.core = stm32

If I comment the board_build.core = stm32 line and replace it with board_build.core = maple, the program will upload just fine (once I strip out the analogWriteFrequency(uint32_t) call), however with the stm32duino core enabled, I get this:

> Executing task: C:\Users\neilb\.platformio\penv\Scripts\platformio.exe run --target upload --target monitor <

Processing genericSTM32F103C8 (platform: ststm32; board: genericSTM32F103C8; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/genericSTM32F103C8.html
PLATFORM: ST STM32 5.6.0 > STM32F103C8 (20k RAM. 64k Flash)
HARDWARE: STM32F103C8T6 72MHz, 20KB RAM, 64KB Flash
DEBUG: Current (stlink) External (blackmagic, jlink, stlink)
PACKAGES: toolchain-gccarmnoneeabi 1.70201.0 (7.2.1), framework-arduinoststm32 3.10601.190716 (1.6.1), tool-stm32duino 1.0.1, tool-openocd 2.1000.190707 (10.0), tool-dfuutil 1.9.190708
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 7 compatible libraries
Scanning dependencies...
No dependencies
Compiling .pio\build\genericSTM32F103C8\FrameworkArduinoVariant\PeripheralPins.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduinoVariant\variant.cpp.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\HardwareSerial.cpp.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\IPAddress.cpp.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\Print.cpp.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\RingBuffer.cpp.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\Stream.cpp.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\Tone.cpp.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\USBSerial.cpp.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\WInterrupts.cpp.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\WMath.cpp.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\WSerial.cpp.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\WString.cpp.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\abi.cpp.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\avr\dtostrf.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\board.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\hooks.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\itoa.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\main.cpp.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\new.cpp.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\pins_arduino.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_adc.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_adc_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_can.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_cec.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_comp.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_comp_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_cortex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_crc.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_crc_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_cryp.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_cryp_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_dac.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_dac_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_dcmi.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_dcmi_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_dfsdm.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_dfsdm_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_dma.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_dma2d.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_dma_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_dsi.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_eth.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_eth_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_exti.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_fdcan.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_firewall.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_flash.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_flash_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_flash_ramfunc.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_fmpi2c.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_fmpi2c_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_gfxmmu.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_gpio.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_gpio_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_hash.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_hash_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_hcd.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_hrtim.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_hsem.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_i2c.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_i2c_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_i2s.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_i2s_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_ipcc.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_irda.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_iwdg.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_jpeg.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_lcd.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_lptim.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_ltdc.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_ltdc_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_mdios.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_mdma.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_mmc.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_mmc_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_msp_template.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_nand.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_nor.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_opamp.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_opamp_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_ospi.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_pccard.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_pcd.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_pcd_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_pka.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_pwr.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_pwr_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_qspi.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_ramecc.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_rcc.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_rcc_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_rng.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_rtc.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_rtc_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_sai.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_sai_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_sd.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_sd_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_sdadc.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_sdram.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_smartcard.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_smartcard_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_smbus.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_spdifrx.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_spi.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_spi_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_sram.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_swpmi.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_tim.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_tim_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_timebase_rtc_alarm_template.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_timebase_rtc_wakeup_template.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_timebase_tim_template.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_tsc.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_uart.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_uart_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_usart.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_usart_ex.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\HAL\stm32yyxx_hal_wwdg.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_adc.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_bdma.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_comp.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_crc.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_crs.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_dac.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_delayblock.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_dma.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_dma2d.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_exti.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_fmc.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_fsmc.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_gpio.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_hrtim.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_i2c.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_lptim.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_lpuart.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_mdma.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_opamp.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_pka.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_pwr.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_rcc.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_rng.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_rtc.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_sdmmc.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_spi.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_swpmi.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_tim.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_ucpd.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_usart.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_usb.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\LL\stm32yyxx_ll_utils.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\PortNames.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\analog.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\bootloader.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\clock.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\core_callback.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\dwt.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\hw_config.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\interrupt.cpp.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\low_power.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\pinmap.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\rtc.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\spi_com.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\startup_stm32yyxx.S.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\stm32_def.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\stm32_eeprom.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\system_stm32yyxx.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\timer.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\twi.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\uart.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\usb\cdc\cdc_queue.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\usb\cdc\usbd_cdc.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\usb\cdc\usbd_cdc_if.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\usb\hid\usbd_hid_composite.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\usb\hid\usbd_hid_composite_if.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\usb\usb_device_core.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\usb\usb_device_ctlreq.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\usb\usb_device_ioreq.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\usb\usbd_conf.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\usb\usbd_desc.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\stm32\usb\usbd_if.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\syscalls.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\wiring_analog.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\wiring_digital.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\wiring_pulse.cpp.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\wiring_shift.c.o
Compiling .pio\build\genericSTM32F103C8\FrameworkArduino\wiring_time.c.o
Compiling .pio\build\genericSTM32F103C8\src\main.cpp.o
Linking .pio\build\genericSTM32F103C8\firmware.elf
Checking size .pio\build\genericSTM32F103C8\firmware.elf
Memory Usage -> http://bit.ly/pio-memory-usage
DATA:    [          ]   3.6% (used 740 bytes from 20480 bytes)
PROGRAM: [==        ]  19.6% (used 12848 bytes from 65536 bytes)
Configuring upload protocol...
AVAILABLE: blackmagic, dfu, jlink, serial, stlink
CURRENT: upload_protocol = stlink
Uploading .pio\build\genericSTM32F103C8\firmware.elf
xPack OpenOCD, 64-bit Open On-Chip Debugger 0.10.0+dev (2019-07-17-11:28)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 1

hla_swd
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x08000380 msp: 0x20005000
** Programming Started **
** Programming Finished **
** Verify Started **
** Verified OK **
** Resetting Target **
shutdown command invoked
========================================================== [SUCCESS] Took 31.70 seconds ==========================================================

--- Available ports:
--- Enter port index or full name: 

The hex file appears to have been uploaded just fine, but the program isn’t run. The red power light on the blue pill is lit, but there is no light activity. When switched to the maple core (and the unsupported call removed once more), the light stays lit, as I believe is expected. Does anyone know what is wrong here, preventing the stm32 core from uploading via STLink V2?

The built-in LED is connected to pin PC13, which does not support analogWrite() / PWM.

Connect an separate LED and a resistor to one of the PWM capable pins and try again.

1 Like

Thank you for pointing that out, you are correct. However, I don’t believe that addresses my question about the apparent difference in behavior between the maple core and the stm32 core.

I see you have an STLink probe, why don’t you simply debug what is happening after uploading firmware that was compiled with the stm32duino core?

1 Like

It seems I don’t understand your question. What happens and what do you expect to happen instead?

And are you sure we’re not discussing how the undefined behavior of analogWrite() on a non-PWM capable pin differs between Maple and stm32duino? Because that discussion wouldn’t make much sense.

1 Like

I think I know what the problem is (and the unfortunate use of analogWrite() was just a red herring). Hover with your mouse over LED_BUILTIN and you’ll see the cause:

  • With the Maple core, it’s defined as PC13.
  • With the stm32duino core, it’s defined as PB12

I guess there’s no LED connected to PB12 on your board.

2 Likes

Ah, yes. Thank you, @manuelbl, for correcting my stupidity. Not exactly sure how I didn’t think to check the constant definition for LED_BUILTIN.

I also wasn’t aware that trying to operate PWM on a non-PWM pin would have indeterminate behavior… how does that work exactly? Once I corrected the LED_BUILTIN definition issue, I saw the same behavior (steady on) from the LED on PC13 as I did with the maple core.