J.W. BRUCE / TTU_CSC1300

Dependents:   CSC1300_EduBaseV2_Lab0 mbed_blinky EduBaseV2_Lab0 mbed_blinky ... more

Tutorial 6 Compiling and Uploading

Compiling and Uploading a Program

At this point, you should know how to create, write, import libraries into, save, commit, and publish your own program on Mbed. The final basics you need to learn are how to compile and run your program onto your Nucleo F031K6 and EduBase boards to determine whether your program runs as it should.

What is a Compiler?

A compiler is a computer program that translates code written in a particular programming language (such as C++ or C) into machine language that a microprocessor can understand and execute. Essentially, the Mbed compiler will turn your program into a .bin file that can be downloaded and uploaded to run on the Nucleo F031K6, which will then execute your program on the connected EduBase.

How to Compile a Program

Compiling and downloading a program on Mbed is the same whether you are on a Windows or Mac computer.

1. Make sure the file you have opened in the text editor in the Mbed IDE is part of the program you want to compile. Click on the Compile button in the toolbar at the top of your page.

https://os.mbed.com/media/uploads/kesternucum/compiling_step1.jpg

2. A pop-up box labeled "Compiling program_name" should appear on your screen. Wait for your program to compile.

https://os.mbed.com/media/uploads/kesternucum/compiling_step2.jpg

3. Open your Downloads folder. You should see a file named program_name.NUCLEO_F031K6.bin appear.

https://os.mbed.com/media/uploads/kesternucum/compiling_step3.jpg

How to Upload a Program onto the Nucleo F031K6

After you have compiled your program, you will need to upload it onto your Nucleo F031K6 board so that the Nucleo F031K6 could run your program on your EduBase.

1. Plug a USB cable to connect your PC with the Nucleo F031K6 on the EduBase. If you are still unsure how to set-up your EduBase and Nucleo F031K6 boards, please refer to Setting Up the EduBase-V2.

2. Open File Explorer (Windows) or Finder (Mac). You should see a new external device labeled NODE_F031K6. When you open NODE_F031K6, the device location should have two files: DETAILS.TXT and MBED.HTM. DETAILS.TXT contains a couple of lines about the Nucleo F031K6, and MBED.HTM links to a webpage with more information about the Nucleo F031K6.

https://os.mbed.com/media/uploads/kesternucum/uploading_step2.jpg

3. To upload your program_name.NUCLEO_F031K6.bin file onto your Nucleo F031K6, either drag and drop or copy and paste your .bin file from your Downloads folder into NODE_F031K6.

https://os.mbed.com/media/uploads/kesternucum/uploading_step3.jpg

4. The NODE_F031K6 page will exit out by itself once the program has been uploaded. If you were to revisit that page, your program_name.NUCLEO_F031K6.bin will be gone, meaning that it has been uploaded successfully to your Nucleo F031K6. You should then look at your EduBase board and test whether your program is running as it should.

You have just learned how to compile and upload a program onto your Nucleo F031K6 and EduBase boards. You are now all set to conquer your first lab! Please review any of the previous tutorials if you are still uncertain about any aspect of setting up and programming the EduBase board using Mbed.


All wikipages