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 \
wgetProject 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 ..
makeCreate 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-utilsutility in another shell
Here is some tips to get up and running with cdc communication with a pc :
- Get a serial terminal like
gtktermon your pc - have a look at the
usb/user/usbd_cdc_if.handusb/user/usbd_cdc_if.cfiles, they containt the two main functions you will have to use :CDC_Receive_FSthis 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_FSthis 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 packetand 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
dmesgandlsusbcommands - Launch
gtkterm(withsudoif you aren't in thedialoutgroup) - In
Configuration/Portselect the board's port (typicallyttyACM0orttyUSB0) - Optionnally you can play around with the
local echoandCR LF autooptions in theConfigurationmenu - You can send bytes by typing on your keyboard or send directly hexadecimal data with the
View/Send hexadecimal dataoption