aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/makefile22
-rw-r--r--main/readme.md21
2 files changed, 43 insertions, 0 deletions
diff --git a/main/makefile b/main/makefile
new file mode 100644
index 0000000..833fd02
--- /dev/null
+++ b/main/makefile
@@ -0,0 +1,22 @@
+# this file is for lazy people (loek)
+
+.PHONY: FORCE
+
+all: FORCE build/main.uf2
+
+build/build.ninja: CMakeLists.txt
+ mkdir -p build
+ cmake -B build -G Ninja
+
+build/main.uf2: build/build.ninja FORCE
+ ninja -C build
+# ninja automatically builds in parallel, so is preferred
+
+flash: build/main.uf2 FORCE
+ picotool load -fx $<
+# -f forces a reboot of the pico before flashing
+# -x resets the pico after flashing
+
+clean: FORCE
+ $(RM) -r build
+
diff --git a/main/readme.md b/main/readme.md
new file mode 100644
index 0000000..425a00b
--- /dev/null
+++ b/main/readme.md
@@ -0,0 +1,21 @@
+# main controller firmware
+
+This directory contains the software for the main controller of the Puzzle Box.
+
+## building
+
+1. make sure the submodules are initialized
+2. copy [`config.def.h`](./config.def.h) to `config.h` and edit the defaults
+3. `mkdir build`
+4. `cmake -B build`
+5. `make -C build` or `ninja -C build` (choose your preference)
+
+alternatively, a makefile is provided for convenience
+
+## "flashing"
+
+1. [build](#building)
+2. (re)connect the raspberry pi pico while holding the BOOTSEL button (this is
+ the only button)
+3. `picotool load build/main.uf2`
+