# How do I create a UF2 file from 2.x?

**URL:** <https://forum.arduino.cc/t/how-do-i-create-a-uf2-file-from-2-x/1299840>\
**Category:** IDE 2.x\
**Created:** [September 9, 2024, 5:10am UTC](https://forum.arduino.cc/t/how-do-i-create-a-uf2-file-from-2-x/1299840 "2024-09-09T05:10:07Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ptillisch](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@ptillisch](https://forum.arduino.cc/u/ptillisch)\
**Post date:** [September 9, 2024, 6:32am UTC](https://forum.arduino.cc/t/how-do-i-create-a-uf2-file-from-2-x/1299840/2 "2024-09-09T06:32:27Z")

</div>

Hi @distropolis.

> [@distropolis](#):
>
> I used a “tool” from the tools menu for building UF2 files

Was it this one?:

> **[GitHub - blurfl/makeUF2-tool: A tool for the Arduino IDE to make a UF2 file from...](https://github.com/blurfl/makeUF2-tool/tree/master)**
>
> master

I see there that the "tool" is based on this JavaScript program:

> <https://github.com/adafruit/uf2-samdx1/blob/master/scripts/bin2uf2.js>

The script takes the path of a `.bin` file as its argument.

I'll provide instructions you can follow to use it.

## A. Install Prerequisites

### Script

First you need to download that `bin2uf2.js` file:

1. Click the following link:  
[https://raw.githubusercontent.com/adafruit/uf2-samdx1/master/scripts/bin2uf2.js](https://raw.githubusercontent.com/adafruit/uf2-samdx1/master/scripts/bin2uf2.js)  
The plaintext version of the script will open in your web browser.
2. Press the **Ctrl** + **S** keyboard shortcut.  
The " **Save As**" dialog will open.
3. Save the script to a convenient location on your computer.

### Node.js

If you don't already have it, you will need to install **Node.js** in order to run the JavaScript program. You can follow the instructions here to install it:

> **[Node.js — Download Node.js®](https://nodejs.org/en/download)**
>
> Node.js® is a free, open-source, cross-platform JavaScript runtime environment that lets developers create servers, web apps, command line tools and scripts.

## B. Convert .bin to UF2

1. Open the sketch in Arduino IDE.
2. Select **Tools \> Board \> Adafruit SAMD Boards \> Adafruit QT Py M0 (SAMD21)** from the Arduino IDE menus.
3. Select **Sketch \> Export Compiled Binary** from the Arduino IDE menus.  
A compilation will start.
4. Wait for the compilation to finish successfully.
5. Select **Sketch \> Show Sketch Folder** from the Arduino IDE menus.  
The sketch folder will open in your file manager.
6. Open a command line terminal in the `build\adafruit.samd.adafruit_qtpy_m0` subfolder of the sketch folder.  
**ⓘ** Arduino IDE's " **Export Compiled Binary**" feature saves the compiled sketch binary in this folder.
7. Type the following command into the terminal:

```plaintext
node <path to bin2uf2.js> <.bin filename>

```

(where `<path to bin2uf2.js>` is the path to the location where you saved `bin2uf2.js` while following the instructions above, and `<.bin filename>` is the filename of the `.bin` file from the `build\adafruit.samd.adafruit_qtpy_m0` folder.
8. Press the **Enter** key.

The command should run successfully (you might see some deprecation warnings, but you can ignore those). After that, you will find a file named `flash.uf2` in the folder.

---

_[View the full topic](https://forum.arduino.cc/t/how-do-i-create-a-uf2-file-from-2-x/1299840)._
