Flashing Code to ST uC
In order to use any of the code, from the other tutorials it is necessary to flash the code to the microcontroller (uC). Flashing is the method used to write a compiled program into a in this case a uC. In order to actually use the code we have written in past tutorials we need to flash it onto the uC. Note that this tutorial assumes you are using either one of the ST Discovery Boards or a different PCB with ST-Flash built in
Physical Connections
In order to connect our computer to the uC all that is necessary is a USB-A to mini USB connector. The male mini USB connector will plug into the discovery board and the USB-A will plug into your computer.

Once the Discovery Board is plugged in the red lights closest to the mini-usb port should turn on. These lights indicate that the board is powered and that it is using ST-Link.
Flashing From VSCode
Now that the board is connected to your computer it can be flashed from VSCode. To do this first we need to open a terminal in VSCode. To do this go to the top menu in VSCode, select terminal --> New terminal. This will open a new terminal in the VSCode. Now we need to navigate to the top level directory of our project. This directory will contain the Makefile for your project. The Makefile can be run by typing <make> into the terminal. See the video below for details
Now that our code has been compiled you will notice that a <build> directory was added to the top directory of your project. This directory contains all of the binary files that we need to upload to the uC. Once in this directory verify the existance of a file named <projectName>.bin. This file is the file you should flash to your uC. In my case the project I am working on is named GPIO_Tutorial, so I will be looking for a file named GPIO_Tutorial.bin. Once you have found the file do not open or modify it, go to the terminal and type the command
​
St-flash write <projectName>.bin 0x8000000
​
This command tells St-flash to write the binary file to the uC's ROM which starts at memory location (address) 0x8000000. This address could change depending on which uC you are using. Be sure to refer to your uC's datasheet, if an error occurs.
​
If everything works correctly the ST-link light on your board will flash red-green-red-green, until the program has been written.