Go to file
André van Schoubroeck e4db367313 Merge branch 'master' of github.com:a-v-s/gethla 2020-04-04 14:50:32 +02:00
LICENSE Create LICENSE 2020-04-03 12:17:11 +02:00
Makefile Initial COmmit 2020-04-03 12:05:53 +02:00
README.md Create README.md 2020-04-03 12:12:43 +02:00
gethla.c Binary Serial Numbers might contain zeroes! 2020-04-04 14:50:21 +02:00

README.md

gethla

Simple tool to get the ST-Link Serial String for use with OpenOCD. When multiple ST-Links are connected, one must specify the serial number to connect. As the ST-Link V2 uses a serial number consisting of non-ascii characters, it is not straight forwards to capture the serial number using for example lsusb.

$ lsusb -d 0483: -v | grep Serial
  iSerial                 3 HÿpexUU% !g

Therefore I have created this tool to generate the serial string for use with OpenOCD

Running

$ ./gethla 
Scanning for connected STLink
STLink V2   hla_serial \x48\x3F\x70\x06\x65\x78\x55\x55\x25\x20\x21\x67

Using

$ openocd -f "interface/stlink.cfg" -c "hla_serial \x48\x3F\x70\x06\x65\x78\x55\x55\x25\x20\x21\x67" -f "target/stm32f1x.cfg" 

Building

At the moment I have created a minimum Makefile to build the executable. Dependencies: libusb-1.0

$ make 
cc -I/usr/include/libusb-1.0  -lusb-1.0  -ogethla gethla.c