Introduction: Exporting Binary (.bin) File From PlatformIO

Learn how to export a binary file (.bin extension) from PlatformIO.

PlatformIO is a Visual Studio Code (or in short VS Code) extension which allows you to develop for IoT firmware. You can download it freely from Download PlatformIO.

Step 1: Build

Once you have your project open in PlatformIO, start off by building your project. You can that by clicking on the Check icon in the bottom left toolbar. Once you've done that, PlatformIO will open a new terminal task (on the right), starting to debug and build your firmware. You'll know it's finished when it shows a green SUCCESS text at the bottom of the terminal.

Step 2: Copy Build Location

After the build process is finished, copy the location of the firmware file. This location will vary depending on the type of board you are using. In my example, I'm using a NodeMCU board and therefore the binary file location is .pioenvs\nodemcu\firmware.bin. However, since that's the location of the file and not the folder containing the file, what I'm interested in is .pioenvs\nodemcu . Don't forget to include the dot (.) at the start.

Step 3: Open Project Location in Explorer

The location we've gathered from the previous step is not enough for us to extract the binary file since it's relative to the project location. Therefore, now we need to open the project location in explorer. We can do that by:

  1. Open the search bar by clicking on F1
  2. Inside the search box, type "reveal"
  3. Click Enter (or click on the first result with your mouse).

Now a new explorer window will open with the source files of your project. In the next step we will navigate to the compiled binary file from the window we've just opened.

Step 4: Find the Binary File

We're almost finished. In the previous step we've opened the SRC folder of our project (where the source files are stored). From the SRC we can navigate to the binary file location by going to the SRC's parent folder (by clicking on the back space button), then we will navigate to the folder location we've extracted in the second step (in my case it was .pioenvs\nodemcu) . Now you can find your binary file (usually named firmware.bin) and do whatever you want with it!