Section D.3 Building and Running Blinky
We are now ready for Blinky! You are about to make the on-board LED on your Nucleo, which is connected to D13 (PA5), blink for the first time. This is the “hello, world” of embedded system programming. Have your Nucleo, its USB cable and a USB adapter (if your laptop needs one) ready. Do not plug the board in yet.
-
In the Project Explorer, right-click on
TemplateProjectand select Copy. -
Right-click again (on
TemplateProject), select Paste, type inBlinkyfor the project name and click Copy.
Figure D.3.1. The Copy Project popup with Blinkyentered as the project name. Keep Use default location checked, so that the copy goes into yourworkspacefolder; the Location field is blanked out here. -
Download
blinky.c(be sure to use the download option, not the open in the browser option) and find the downloaded file on your hard drive. Copy the file (right-click in your file browser and select Copy, or use the keyboard shortcut), return to the IDE and paste the file from your clipboard into theSrcfolder in theBlinkyproject. This is what you should now have:
Figure D.3.2. The Blinkyproject in the Project Explorer, withblinky.cin itsSrcfolder besidesyscalls.candsysmem.c. -
Select your
Blinkyproject and right-click. Select Close Unrelated Project from the context menu. -
Double-click on
blinky.cto open the source code in the IDE. -
Build the project using the hammer symbol on the top menu bar (Figure D.3.3).

Figure D.3.3. The top menu bar of STM32CubeIDE. The Build button (a hammer) is circled on the left and the Run button (a green circle with a white triangle) on the right. The hammer is grayed out here only because no project was open when the screenshot was taken. -
Plug your Nucleo into an empty USB port on your computer. Upload and run the Blinky code using the Run button on the top menu bar.
-
If you see a warning about updating the firmware of the ST-LINK, the programmer and debugger built into your Nucleo board, follow the instructions in Subsection D.4.1. If you see a message that ST-LINK Server is required, follow the instructions in Subsection D.4.2.
-
In the popup about the launch configuration, accept the defaults.
Congratulations: you made it! Watch the on-board LED blink!
