Merge pull request #5 from klardotsh/topic-zoom-enhance
Make builds a bit more robust and reusable
This commit is contained in:
		
							
								
								
									
										7
									
								
								.ampy
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								.ampy
									
									
									
									
									
								
							@@ -1,7 +0,0 @@
 | 
			
		||||
# These values work only for Feathers on Linux hosts
 | 
			
		||||
# right now. If using Docker, requires execution as such:
 | 
			
		||||
#
 | 
			
		||||
# docker run -t kmk_firmware:latest --device /dev/ttyUSB0
 | 
			
		||||
AMPY_PORT=/dev/ttyUSB0
 | 
			
		||||
AMPY_BAUD=115200
 | 
			
		||||
AMPY_DELAY=1.5
 | 
			
		||||
							
								
								
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -102,3 +102,7 @@ venv.bak/
 | 
			
		||||
 | 
			
		||||
# mypy
 | 
			
		||||
.mypy_cache/
 | 
			
		||||
 | 
			
		||||
.ampy
 | 
			
		||||
.submodules
 | 
			
		||||
.circuitpy-deps
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										9
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							@@ -1,3 +1,12 @@
 | 
			
		||||
[submodule "circuitpython"]
 | 
			
		||||
	path = vendor/circuitpython
 | 
			
		||||
	url = https://github.com/adafruit/circuitpython.git
 | 
			
		||||
	branch = "9b98ad779468676c3d5f1efdc06b454aaed7c407"
 | 
			
		||||
[submodule "pydux"]
 | 
			
		||||
	path = vendor/pydux
 | 
			
		||||
	url = https://github.com/usrlocalben/pydux.git
 | 
			
		||||
	branch = "943ca1c75357b9289f55f17ff2d997a66a3313a4"
 | 
			
		||||
[submodule "upy-lib"]
 | 
			
		||||
	path = vendor/upy-lib
 | 
			
		||||
	url = https://github.com/micropython/micropython-lib.git
 | 
			
		||||
	branch = "f20d89c6aad9443a696561ca2a01f7ef0c8fb302"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										53
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										53
									
								
								Makefile
									
									
									
									
									
								
							@@ -1,31 +1,65 @@
 | 
			
		||||
.PHONY: build-feather devdeps lint
 | 
			
		||||
.PHONY: \
 | 
			
		||||
	build-feather \
 | 
			
		||||
	circuitpy-deps \
 | 
			
		||||
	circuitpy-freeze-kmk-nrf \
 | 
			
		||||
	devdeps \
 | 
			
		||||
	freeze-nrf-vendor-deps \
 | 
			
		||||
	lint
 | 
			
		||||
 | 
			
		||||
devdeps: Pipfile.lock
 | 
			
		||||
	pipenv install --dev --ignore-pipfile
 | 
			
		||||
	@pipenv install --dev --ignore-pipfile
 | 
			
		||||
 | 
			
		||||
lint: devdeps
 | 
			
		||||
	pipenv run flake8
 | 
			
		||||
	@pipenv run flake8
 | 
			
		||||
 | 
			
		||||
build-feather-test: lint devdeps
 | 
			
		||||
.submodules: .gitmodules
 | 
			
		||||
	@echo "===> Pulling dependencies, this may take several minutes"
 | 
			
		||||
	@git submodule update --init --recursive
 | 
			
		||||
	@touch .submodules
 | 
			
		||||
 | 
			
		||||
.circuitpy-deps: .submodules
 | 
			
		||||
	@echo "===> Building circuitpython/mpy-cross"
 | 
			
		||||
	@make -C vendor/circuitpython/mpy-cross
 | 
			
		||||
	@echo "===> Pulling Nordic BLE stack"
 | 
			
		||||
	@cd vendor/circuitpython/ports/nrf && ./drivers/bluetooth/download_ble_stack.sh 2>/dev/null >/dev/null
 | 
			
		||||
	@touch .circuitpy-deps
 | 
			
		||||
 | 
			
		||||
circuitpy-deps: .circuitpy-deps
 | 
			
		||||
 | 
			
		||||
freeze-nrf-vendor-deps: vendor/circuitpython/ports/nrf/freeze/.kmk_frozen
 | 
			
		||||
 | 
			
		||||
vendor/circuitpython/ports/nrf/freeze/.kmk_frozen: upy-freeze.txt
 | 
			
		||||
	@echo "===> Preparing vendored dependencies for bundling"
 | 
			
		||||
	@rm -rf vendor/circuitpython/ports/nrf/freeze/*
 | 
			
		||||
	@cat $< | xargs -I '{}' cp -a {} vendor/circuitpython/ports/nrf/freeze/
 | 
			
		||||
	@touch $@
 | 
			
		||||
 | 
			
		||||
circuitpy-freeze-kmk-nrf: freeze-nrf-vendor-deps
 | 
			
		||||
	@echo "===> Preparing KMK source for bundling into CircuitPython"
 | 
			
		||||
	@rm -rf vendor/circuitpython/ports/nrf/freeze/kmk
 | 
			
		||||
	@rm -rf vendor/circuitpython/ports/nrf/freeze/kmk_keyboard_user.py
 | 
			
		||||
	@rm -rf vendor/circuitpython/ports/nrf/kmk*
 | 
			
		||||
	@cp -av kmk vendor/circuitpython/ports/nrf/freeze/
 | 
			
		||||
	@cp -av boards/klardotsh/twotwo_matrix_feather.py vendor/circuitpython/ports/nrf/freeze/kmk_keyboard_user.py
 | 
			
		||||
 | 
			
		||||
circuitpy-flash-nrf: circuitpy-freeze-kmk-nrf
 | 
			
		||||
	@echo "===> Building and flashing CircuitPython with KMK and your keymap"
 | 
			
		||||
	@make -C vendor/circuitpython/ports/nrf BOARD=feather_nrf52832 SERIAL=/dev/ttyUSB0 SD=s132 FROZEN_MPY_DIR=freeze clean dfu-gen dfu-flash
 | 
			
		||||
 | 
			
		||||
circuitpy-flash-nrf-entrypoint:
 | 
			
		||||
	@echo "===> Flashing entrypoint if it doesn't already exist"
 | 
			
		||||
	@sleep 2
 | 
			
		||||
	@-timeout -k 5s 10s pipenv run ampy rm main.py 2>/dev/null
 | 
			
		||||
	@-timeout -k 5s 10s pipenv run ampy put entrypoints/feather_nrf52832.py main.py
 | 
			
		||||
	@echo "===> Flashed keyboard successfully!"
 | 
			
		||||
 | 
			
		||||
build-feather-test: lint devdeps circuitpy-deps circuitpy-freeze-kmk-nrf
 | 
			
		||||
	@echo "===> Preparing keyboard script for bundling into CircuitPython"
 | 
			
		||||
	@cp -av boards/klardotsh/twotwo_matrix_feather.py vendor/circuitpython/ports/nrf/freeze/kmk_keyboard_user.py
 | 
			
		||||
	@$(MAKE) circuitpy-flash-nrf circuitpy-flash-nrf-entrypoint
 | 
			
		||||
 | 
			
		||||
build-feather-noop: lint devdeps circuitpy-deps circuitpy-freeze-kmk-nrf
 | 
			
		||||
	@echo "===> Preparing keyboard script for bundling into CircuitPython"
 | 
			
		||||
	@cp -av boards/noop.py vendor/circuitpython/ports/nrf/freeze/kmk_keyboard_user.py
 | 
			
		||||
	@$(MAKE) circuitpy-flash-nrf circuitpy-flash-nrf-entrypoint
 | 
			
		||||
 | 
			
		||||
# Fully wipe the board with only stock CircuitPython
 | 
			
		||||
burn-it-all-with-fire: lint devdeps
 | 
			
		||||
	@echo "===> Flashing STOCK CircuitPython with no KMK or user keyboard scripts, and wiping entrypoint"
 | 
			
		||||
@@ -38,10 +72,9 @@ burn-it-all-with-fire: lint devdeps
 | 
			
		||||
	@echo "===> Pulling Nordic BLE stack"
 | 
			
		||||
	@cd vendor/circuitpython/ports/nrf && ./drivers/bluetooth/download_ble_stack.sh 2>/dev/null >/dev/null
 | 
			
		||||
	@echo "===> Preparing KMK source for bundling into CircuitPython"
 | 
			
		||||
	@rm -rf vendor/circuitpython/ports/nrf/freeze/kmk
 | 
			
		||||
	@rm -rf vendor/circuitpython/ports/nrf/freeze/kmk_keyboard_user.py
 | 
			
		||||
	@rm -rf vendor/circuitpython/ports/nrf/*
 | 
			
		||||
	@echo "===> Building CircuitPython WITHOUT KMK or user keyboard script to induce ImportError"
 | 
			
		||||
	@make -C vendor/circuitpython/ports/nrf BOARD=feather_nrf52832 SERIAL=/dev/ttyUSB0 SD=s132 FROZEN_MPY_DIR=freeze clean dfu-gen dfu-flash
 | 
			
		||||
	@$(MAKE) circuitpy-flash-nrf
 | 
			
		||||
	@echo "===> Wiping keyboard config"
 | 
			
		||||
	@sleep 2
 | 
			
		||||
	@-pipenv run ampy rm main.py 2>/dev/null
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										5
									
								
								boards/noop.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								boards/noop.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
import sys
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def main():
 | 
			
		||||
    sys.exit(0)
 | 
			
		||||
							
								
								
									
										4
									
								
								upy-freeze.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								upy-freeze.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
vendor/upy-lib/__future__/__future__.py
 | 
			
		||||
vendor/upy-lib/functools/functools.py
 | 
			
		||||
vendor/upy-lib/string/string.py
 | 
			
		||||
vendor/pydux/pydux
 | 
			
		||||
							
								
								
									
										1
									
								
								vendor/pydux
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								vendor/pydux
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule vendor/pydux added at 943ca1c753
									
								
							
							
								
								
									
										1
									
								
								vendor/upy-lib
									
									
									
									
										vendored
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								vendor/upy-lib
									
									
									
									
										vendored
									
									
										Submodule
									
								
							 Submodule vendor/upy-lib added at f20d89c6aa
									
								
							
		Reference in New Issue
	
	Block a user