Stm32 with arduino framework flashed but seems not working


I am using PlatformIO VSCode in Windows 10 professional.
And my configuration as follows:
Arduino framework
self defined board .json file which modified from the official nucleo_f030r8.json;
self defined variants files which also modified from above;

self designed board with STM32F030K6T6 mounted;
J-Link v10 PRO with SWD port connected to board;

The problem is upload success but when I trying to debug the blinky demo, the breakpoint never hit, and board LED on PA1 not blinking, but led on J-LINK blinking seems that it working.

The researching I have done:
Running a blinky demo in KEIL MDK 5 env, it works. hardware design problem and/or J-LINK hardware or connection problem excluded;
Trying replace J-LINK with ST-LINK/V2, modified related config in platformio.ini, also upload success but not working.

Debug trace:

Processing custom_f030k6 (framework: arduino; platform: ststm32; board: custom_f030k6)

Verbose mode can be enabled via -v, --verbose option
PLATFORM: ST STM32 > Self defined F030K6
HARDWARE: STM32F030K6T6 48MHz 4KB RAM (32KB Flash)
DEBUG: CURRENT(jlink) EXTERNAL(blackmagic, jlink, stlink)
Library Dependency Finder ->
Collected 13 compatible libraries
Scanning dependencies…
No dependencies
Checking size .pioenvscustom_f030k6/firmware.elf
Memory Usage ->
DATA: [= ] 7.9% (used 324 bytes from 4096 bytes)
PROGRAM: [== ] 18.9% (used 6180 bytes from 32768 bytes)
[SUCCESS] Took 7.08 seconds
Reading symbols from f:/MyProj/Ardu/Firm/.pioenvs/custom_f030k6/firmware.elf…
PlatformIO Unified Debugger > ht/
PlatformIO: Initializing remote target…
SEGGER J-Link GDB Server V6.32h Command Line Version
JLinkARM.dll V6.32h (DLL compiled Jul 5 2018 18:11:19)
Command line: -singlerun -if SWD -select USB -device STM32F030K6 -port 2331
-----GDB Server start settings-----
GDBInit file: none
GDB Server Listening port: 2331
SWO raw output listening port: 2332
Terminal I/O port: 2333
Accept remote connection: localhost only
Generate logfile: off
Verify download: off
Init regs on start: off
Silent mode: off
Single run mode: on
Target connection timeout: 0 ms
------J-Link related settings------
J-Link Host interface: USB
J-Link script: none
J-Link settings file: none
------Target related settings------
Target device: STM32F030K6
Target interface: SWD
Target interface speed: 4000kHz
Target endian: little

Connecting to J-Link…
J-Link is connected.
Firmware: J-Link V10 compiled Jun 27 2018 10:57:29
Hardware: V10.10
S/N: *******
Feature(s): FlashBP, GDB, FlashDL, JFlash, RDI
Checking target voltage…
Target voltage: 3.33 V
Listening on TCP/IP port 2331
Connecting to target…Connected to target
Waiting for GDB connection…Connected to
Reading all registers
Received monitor command: halt
Halting target CPU…
…Target halted (PC = 0x080002CC)
Received monitor command: reset

WWDG_IRQHandler () at C:\users\ahe.platformio\packages\framework-arduinoststm32\STM32\system\Drivers\CMSIS\Device\ST\STM32F0xx\Source\Templates\gcc\startup_stm32f030x6.s:123
123 b Infinite_Loop
Temporary breakpoint 1 at 0x800025e: file C:\users\ahe.platformio\packages\framework-arduinoststm32\STM32\cores\arduino\main.cpp, line 55.
Resetting target

Loading section .isr_vector, size 0xc0 lma 0x8000000
Loading section .text, size 0x17a4 lma 0x80000c0
Loading section .rodata, size 0x7c lma 0x8001864
Loading section .init_array, size 0x8 lma 0x80018e0
Loading section .fini_array, size 0x4 lma 0x80018e8
Loading section .data, size 0x4 lma 0x80018ec
Start address 0x800027c, load size 6384
Resetting target

Writing register (PC = 0x0800027C)
Received monitor command: halt
Halting target CPU…
…Target halted (PC = 0x0800027C)
Received monitor command: reset
Transfer rate: 1246 KB/sec, 1064 bytes/write.
Resetting target

PlatformIO: Initialization completed
Resetting target
PlatformIO: Resume the execution to debug_init_break = tbreak main
Starting target CPU…

Related files


#include <Arduino.h>
  #undef LED_BUILTIN

void setup()
  // initialize LED digital pin as an output.

void loop()
  // turn the LED on (HIGH is the voltage level)
  digitalWrite(LED_BUILTIN, HIGH);
  // wait for a second
  // turn the LED off by making the voltage LOW
  digitalWrite(LED_BUILTIN, LOW);
   // wait for a second


platform = ststm32
board = custom_f030k6
framework = arduino
; change microcontroller
board_build.mcu = stm32f030k6t6
board_build.variant = custom_030k6

debug_tool = jlink

; SWD interface
upload_protocol = jlink


  "build": {
    "cpu": "cortex-m0",
    "extra_flags": "-DSTM32F030x6",
    "f_cpu": "48000000L",
    "mcu": "stm32f030k6t6",
    "variant": "custom_f030k6"
  "debug": {
    "default_tools": [
    "jlink_device": "STM32F030K6",
    "openocd_board": "st_nucleo_f0",
    "openocd_target": "stm32f0x",
    "svd_path": "STM32F030.svd"
  "frameworks": [
  "name": "Self defined F030K6",
  "upload": {
    "maximum_ram_size": 4096,
    "maximum_size": 32768,
    "protocol": "stlink",
    "protocols": [
  "url": "",
  "vendor": "ST"