AnsweredAssumed Answered

OpenOCD support for external STLink debugger

Question asked by Lubos Medovarsky on Nov 5, 2017
Latest reply on Nov 14, 2017 by Lubos Medovarsky

Hi all,

 

Is anyone using OpenOCD with genuine external STLinkV2 debugger/programmer and STM32L0? Clearly, there is an issue as I have tested multiple units and OpenOCD releases (0.9, 0.10.).

 

The debuggers are fully functional in non-OpenOCD environments like STLink utility, QSTLink, Keil, etc. Additionally, I have tested STLinkV2-1 firmware with L053-Discovery, Nucleo-L053R8, EVAL-L073VZ. The boards work with OpenOCD as expected.

 

Besides USB VID/PID, OpenOCD makes no difference between STLinkV2 and STLinkV2-1 in the scripts referenced below.

 

Tested devices: STM32L052/053/063 C6/C8 (QFP48, 16/32 kiB FLASH).

Environment: Linux.

 

Command line with freshly built release 0.10.0 and stlink support enabled:

/patch/to/openocd -s /path/to/openocd/share/scripts -f interface/stlink-v2.cfg -c 'transport select hla_swd' -f target/stm32l0.cfg --debug

returns:

...

Info : 306 36 cortex_m.c:2056 cortex_m_examine(): stm32l0.cpu: hardware has 4 breakpoints, 2 watchpoints
Debug: 307 36 target.c:1517 target_call_event_callbacks(): target event 22 (examine-end)
Debug: 308 36 target.c:4313 target_handle_event(): target: (0) stm32l0.cpu (hla_target) event: 22 (examine-end) action:
    # DBGMCU_CR |= DBG_STANDBY | DBG_STOP | DBG_SLEEP
    mmw 0x40015804 0x00000007 0

 

    # Stop watchdog counters during halt
    # DBGMCU_APB1_FZ |= DBG_IWDG_STOP | DBG_WWDG_STOP
    mmw 0x40015808 0x00001800 0

 

Debug: 309 36 hla_target.c:750 adapter_read_memory(): adapter_read_memory 0x40015804 4 1
Debug: 310 38 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_mww 0x40015804 7
Debug: 311 38 command.c:143 script_debug(): command - mww ocd_mww 0x40015804 7
Debug: 313 39 hla_target.c:764 adapter_write_memory(): adapter_write_memory 0x40015804 4 1
Debug: 314 40 hla_target.c:750 adapter_read_memory(): adapter_read_memory 0x40015808 4 1
Debug: 315 41 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_mww 0x40015808 6144
Debug: 316 41 command.c:143 script_debug(): command - mww ocd_mww 0x40015808 6144
Debug: 318 42 hla_target.c:764 adapter_write_memory(): adapter_write_memory 0x40015808 4 1
Debug: 319 43 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_flash init
Debug: 320 43 command.c:143 script_debug(): command - ocd_flash ocd_flash init
Debug: 322 44 tcl.c:1099 handle_flash_init_command(): Initializing flash devices...
Debug: 323 44 command.c:364 register_command_handler(): registering 'ocd_flash'...
Debug: 324 44 command.c:364 register_command_handler(): registering 'ocd_flash'...
Debug: 325 44 command.c:364 register_command_handler(): registering 'ocd_flash'...
Debug: 326 44 command.c:364 register_command_handler(): registering 'ocd_flash'...
Debug: 327 44 command.c:364 register_command_handler(): registering 'ocd_flash'...
Debug: 328 45 command.c:364 register_command_handler(): registering 'ocd_flash'...
Debug: 329 45 command.c:364 register_command_handler(): registering 'ocd_flash'...
Debug: 330 45 command.c:364 register_command_handler(): registering 'ocd_flash'...
Debug: 331 45 command.c:364 register_command_handler(): registering 'ocd_flash'...
Debug: 332 45 command.c:364 register_command_handler(): registering 'ocd_flash'...
Debug: 333 45 command.c:364 register_command_handler(): registering 'ocd_flash'...
Debug: 334 45 command.c:364 register_command_handler(): registering 'ocd_flash'...
Debug: 335 45 command.c:364 register_command_handler(): registering 'ocd_flash'...
Debug: 336 45 command.c:364 register_command_handler(): registering 'ocd_flash'...
Debug: 337 45 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_mflash init
Debug: 338 45 command.c:143 script_debug(): command - ocd_mflash ocd_mflash init
Debug: 340 46 mflash.c:1377 handle_mflash_init_command(): Initializing mflash devices...
Debug: 341 46 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_nand init
Debug: 342 46 command.c:143 script_debug(): command - ocd_nand ocd_nand init
Debug: 344 47 tcl.c:497 handle_nand_init_command(): Initializing NAND devices...
Debug: 345 47 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_pld init
Debug: 346 47 command.c:143 script_debug(): command - ocd_pld ocd_pld init
Debug: 348 48 pld.c:205 handle_pld_init_command(): Initializing PLDs...
<hangs here>

The complete OpenOCD log is attached.

 

Using fake debuggers is not an option as I'm developing devices operating at low voltages, and we have already bought multiple genuine devices for our team.

 

Any suggestions are welcome.

Attachments

Outcomes