How to use multiple ST boards simultaneously
Hello Jack, Pascale,
Since SW4STM32 integrates openocd 0.9+, so this is possible by using hla_serial feature.
This is kind of tricky but possible
Supposing that we want to debug one STM32F429I-DISC1 (containing ST-LINK V2-1) and NUCLEO-L031K6 simultaneously.
To do that, we need to obtain the embedded ST-LINK serial of each board and specify it within your customized board configuration.
Get the serial number
Here I will force openocd to tell us the serial number by provoking an error
- copy your board config file ‘nucleo_l031k6.cfg’ (or ‘stm32f429i_disc1.cfg’) from
‘C:\Ac6\SystemWorkbench\plugins\fr.ac6.mcu.debug_...\resources\openocd\scripts\st_board’ to your project folder - modify the copied cfg to provoke the error:
after this line (source [find interface/...cfg])
add this line (hla_serial wrong_serial)
⇒ resulting cfg for nucleo_l031k6
# This is an STM32L0 nucleo board with a single STM32L031K6T6 chip. # ### To be updated ### http://www.st.com/internet/evalboard/product/.jsp # # This is for using the onboard STLINK/V2-1 source [find interface/stlink-v2-1.cfg] hla_serial wrong_serial transport select hla_swd # increase working area to 4KB set WORKAREASIZE 0x1000 source [find target/stm32l0.cfg] # use hardware reset, connect under reset reset_config srst_only srst_nogate
- from SW4STM32 → debug configurations, create your Ac6 STM32 debugging configuration, then from ‘Debugger’ tab select the modified cfg (select ‘Use local script’ then browse for it)
- set openocd verbosity to maximum add ‘-d3’ to OpenOCD Command
- @see snapshot1.png
- connect your board and launch debug session, this will fail automatically
- from openocd console search the string ‘Device serial number’ (use ‘Find/Replace’ from contextual menu), the matched line (for me) is:
Debug: 252 316 libusb1_common.c:67 string_descriptor_equal(): Device serial number ‘066EFF515456707067174639’ doesn’t match requested serial ‘wrong_serial’ - Now we have the serial number: 066EFF515456707067174639
- reduce openocd verbosity (remove ‘-d3’)
Once we have the serial number
return to the cfg file and modify the added line, by replacing wrong_serial by the correct one:
⇒ hla_serial 066EFF515456707067174639
Do this to your boards that you want to debug simultaneously (two or more)
Finally do not forget to select a different port number for each debug configuration (from debugger tab), for me I have used ‘4444’ for L031 and ‘3333’ for F429
I have tested this with two projects, each one is opened a different instance of SW4STM32
@see snapshot2.png
Best Regards,
TarekB