uf2
uf2 copied to clipboard
No build description or instructions
Is this meant for Linux, Windows OSx? How to build on Windows? Do you need to create some VS project, or do you have to install make, mingw and or gccwin ?
Not clear at all, some of us are new to Github. A how-to one liner would help a lot. Thank you.
LOL, yeah, it isn't you
macOS
devel]$ git clone https://github.com/Microsoft/uf2
devel]$ git clone https://github.com/adafruit/uf2-samdx1
devel]$ ln -s uf2-samdx1 uf2-samd21
devel]$ cd ufl2
devel/uf2]$ git submodule init
devel/uf2]$ git submodule update
devel/uf2]$ cd uf2tool
devel/uf2/uf2tool]$ make
devel/uf2/uf2tool]$ ../built/uf2tool
usage: ../built/uf2tool COMMAND [ARGUMENTS...]
Commands include:
serial - run 'serial' port forwarding
list - list devices
dmesg - dump internal runtime logs from the device
info - dump information about the device
FILE - write specified BIN or UF2 file
random - write randomly generated bin file
devel/uf2/uf2tool]$ ../built/uf2tool info
INFO: UF2 Bootloader v1.23.1-adafruit.2 SFHR
Model: ItsyBitsy M0 Express
Board-ID: SAMD21G18A-ItsyBitsy-v0
page size: 256, total: 256kB
I'm posting this on all of the issues that seem somewhat relevant, but there's a pip-installable option as well (see: https://github.com/microsoft/uf2/issues/42#issuecomment-1551077808).
I took similar steps to https://github.com/microsoft/uf2/issues/5#issuecomment-440898681 to compile this on Linux, with a couple of additional steps:
- Install the udev libraries and header files. On Ubuntu, I used
apt-get install libudev-dev
. - Apply the patch below to disable the macOS linker options, and link against libudev, and add a header that's required on Linux.
diff --git a/uf2tool/Makefile b/uf2tool/Makefile
index efc615b..4189070 100644
--- a/uf2tool/Makefile
+++ b/uf2tool/Makefile
@@ -1,3 +1,6 @@
all:
mkdir -p ../built
- $(CC) -g -Wall tool.c ../hidapi/mac/hid.c -I../../uf2-samd21/inc -I../hidapi/hidapi -I. -framework IOKit -framework CoreFoundation -o ../built/uf2tool
+# $(CC) -g -Wall tool.c ../hidapi/mac/hid.c -I../../uf2-samd21/inc -I../hidapi/hidapi -I. -framework IOKit -framework CoreFoundation -o ../built/uf2tool
+#
+# apt-get install libudev-dev
+ $(CC) -g -Wall tool.c ../hidapi/linux/hid.c -I../../uf2-samd21/inc -I../hidapi/hidapi -I. -o ../built/uf2tool -ludev
diff --git a/uf2tool/tool.c b/uf2tool/tool.c
index 9ec20a7..c390f54 100644
--- a/uf2tool/tool.c
+++ b/uf2tool/tool.c
@@ -2,6 +2,7 @@
#include <windows.h>
#endif
#include <stdio.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>