Skip to content

Commit

Permalink
build script improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
waffle87 committed Feb 25, 2024
1 parent db727a2 commit 3180649
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
35 changes: 20 additions & 15 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
#!/bin/sh
ZMK_DIR=~/waffle_git/zmk
RED=$(tput setaf 1)
YELLOW=$(tput setaf 3)
GREEN=$(tput setaf 2)
BLUE=$(tput setaf 4)
BOLD=$(tput bold)
NORMAL=$(tput sgr0)
source $ZMK_DIR/.venv/bin/activate

build() {
printf "building $1 for $2...\n"
printf "building $GREEN$1$NORMAL for $BLUE$2$NORMAL...\n"
(cd $ZMK_DIR/app
west build -p always -b $2 -- -DSHIELD=$1 \
-DZMK_CONFIG="$HOME/waffle_git/zmk-build/config" \
&> /dev/null

read -p "flash? (y/n) " yn
read -p "${BOLD}flash? (y/n) $NORMAL" yn
case $yn in
[Yy]*)
printf "enter bootloader...\n"
mkdir tmp
sleep 10
doas mount /dev/sdb tmp
doas cp build/zephyr/zmk.uf2 tmp
doas umount /dev/sdb
rmdir tmp
printf "${YELLOW}enter bootloader$NORMAL...\n"
sleep 5
west flash
;;
[Nn]*) cp build/zephyr/zmk.uf2 ~/$1.uf2 ;;
* ) printf "invalid entry\n" ;;
* ) printf "${RED}invalid entry$NORMAL\n" ;;
esac
)
printf "complete\n"
printf "${GREEN}complete$NORMAL\n"
}

printf "firmware to build...\n"
printf "${BOLD}firmware to build...$NORMAL\n"
printf "(1) corne\t(2) revxlp\t(3) sweep\t(4) settings reset:\t"
read opt;
case $opt in
Expand All @@ -36,23 +38,26 @@ case $opt in
build corne_right nice_nano_v2
;;
2)
if [ ! -L $ZMK_DIR/app/boards/shields/revxlp ]; then
ln -sv revxlp $ZMK_DIR/app/boards/shields/revxlp
fi
build revxlp seeeduino_xiao_ble
;;
3)
build splitkb_aurora_sweep_left nice_nano_v2
build splitkb_aurora_sweep_right nice_nano_v2
;;
4)
printf "select microcontroller...\n"
printf "${BOLD}select microcontroller...$NORMAL\n"
printf "(1) nice nano\t(2) nice nano v2\t(3) xiao ble:\t"
read val;
case $val in
1) MCU="nice_nano" ;;
2) MCU="nice_nano_v2" ;;
3) MCU="seeeduino_xiao_ble" ;;
*) printf "invalid entry\n" ;;
*) printf "${RED}invalid entry$NORMAL\n" ;;
esac
build settings_reset $MCU
;;
*) printf "invalid entry\n" ;;
*) printf "${RED}invalid entry$NORMAL\n" ;;
esac
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
### zmk build repository
my [zmk](https://zmk.dev) configuration & keyboard code!
my [zmk](https://zmk.dev) configuration & keyboard code

![keyboard](https://i.imgur.com/bCRPsDyh.jpg)

### misc
* [`util.h`](util.h) contains some simple c macros for combos, 2-key tap dance, & home-row mods.
* [`build.sh`](build.sh) is a (convoluted) script to build and flash firmware using a local build environment.\
* [`build.sh`](build.sh) is an interactive script to build and flash firmware using a local build environment.\
coincidentally, my primary zmk keyboards use an identical layout, so the necessary files can be temporarily copied over at build time
* **layout** is near identical to my layout [here (keymapdb)](https://keymapdb.com/keymaps/waffle87), sans a couple things like unicode.

0 comments on commit 3180649

Please sign in to comment.