sudo apt-get install --no-install-recommends --yes \
build-essential \
intltool \
git \
ca-certificates \
automake \
gcc \
make \
cmake \
binutils \
libc6-dev \
gcc-arm-none-eabi \
gdb-arm-none-eabi \
libnewlib-arm-none-eabi \
binutils-arm-linux-gnueabi \
autoconf \
pkg-config \
libusb-1.0.0-dev \
wget
Project can be found here: https://github.com/texane/stlink
Here is a list of commands which should download and compile st-link:
git clone https://github.com/texane/stlink.git
cd stlink
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Debug ..
make
Create a build
folder if you still don't have it in your project tree, set the stlink
path in your makefile then just :
make
: to compile and link your hex filemake burn
: to flash the target boardmake gdb
: to debug your program after launching thest-utils
utility in another shell
Here is some tips to get up and running with cdc communication with a pc :
- Get a serial terminal like
gtkterm
on your pc - have a look at the
usb/user/usbd_cdc_if.h
andusb/user/usbd_cdc_if.c
files, they containt the two main functions you will have to use :CDC_Receive_FS
this is the function that get called back after receiving a packet from the pc, you should change its content to suit your application needsCDC_Transmit_FS
this is the function to call when you want to send out something to the pc these are basically wrappers around the combo :
USBD_CDC_SetTxBuffer(hUsbDevice_0, &buff_TX[0], *Len); // set packet to transmit
USBD_CDC_TransmitPacket(hUsbDevice_0); // transmit packet
and for receiving :
USBD_CDC_SetRxBuffer(hUsbDevice_0, &buff_RX[0]); // set receive buffer location
USBD_CDC_ReceivePacket(hUsbDevice_0); // receive packet
- Then connect the board to the pc and check if everything is ok with the
dmesg
andlsusb
commands - Launch
gtkterm
(withsudo
if you aren't in thedialout
group) - In
Configuration/Port
select the board's port (typicallyttyACM0
orttyUSB0
) - Optionnally you can play around with the
local echo
andCR LF auto
options in theConfiguration
menu - You can send bytes by typing on your keyboard or send directly hexadecimal data with the
View/Send hexadecimal data
option