Teensy 3.1 support

This commit is contained in:
Kyle Brown 2018-09-03 16:22:04 -07:00
parent 5c55ffd790
commit b69fed1199
3 changed files with 47 additions and 0 deletions

2
.gitmodules vendored
View File

@ -10,3 +10,5 @@
[submodule "micropython"]
path = vendor/micropython
url = https://github.com/micropython/micropython.git
branch = "3cd2c281d7cf990b3afb78287a58cf4ee3f23ca5"
ignore = dirty

View File

@ -28,25 +28,50 @@ lint: devdeps
@cd vendor/circuitpython/ports/nrf && ./drivers/bluetooth/download_ble_stack.sh 2>/dev/null >/dev/null
@touch .circuitpy-deps
.micropython-deps: .submodules
@echo "===> Building micropython/mpy-cross"
@make -C vendor/micropython/mpy-cross
@touch .circuitpy-deps
circuitpy-deps: .circuitpy-deps
micropython-deps: .micropython-deps
freeze-nrf-vendor-deps: vendor/circuitpython/ports/nrf/freeze/.kmk_frozen
freeze-teensy3.1-vendor-deps: vendor/micropython/ports/teensy/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 $@
vendor/micropython/ports/teensy/freeze/.kmk_frozen: upy-freeze.txt
@echo "===> Preparing vendored dependencies for bundling"
@mkdir vendor/micropython/ports/teensy/freeze/
@rm -rf vendor/micropython/ports/teensy/freeze/*
@cat $< | xargs -I '{}' cp -a {} vendor/micropython/ports/teensy/freeze/
@touch $@
circuitpy-freeze-kmk-nrf: freeze-nrf-vendor-deps
@echo "===> Preparing KMK source for bundling into CircuitPython"
@rm -rf vendor/circuitpython/ports/nrf/kmk*
@cp -av kmk vendor/circuitpython/ports/nrf/freeze/
micropython-freeze-kmk-teensy3.1: freeze-teensy3.1-vendor-deps
@echo "===> Preparing KMK source for bundling into MicroPython"
@rm -rf vendor/micropython/ports/teensy/kmk*
@cp -av kmk vendor/micropython/ports/teensy/memzip_files/
circuitpy-flash-nrf:
@echo "===> Building and flashing CircuitPython with KMK and your keymap"
@make -C vendor/circuitpython/ports/nrf BOARD=feather_nrf52832 SERIAL=${NRF_DFU_PORT} SD=s132 FROZEN_MPY_DIR=freeze clean dfu-gen dfu-flash
micropython-flash-teensy3.1:
@cp entrypoints/teensy31.py vendor/micropython/ports/teensy/memzip_files/main.py
@make -C vendor/micropython/ports/teensy/ BOARD=TEENSY_3.1 deploy
circuitpy-flash-nrf-entrypoint:
@echo "===> Flashing entrypoint if it doesn't already exist"
@sleep 2
@ -64,6 +89,16 @@ build-feather-nrf52832: lint devdeps circuitpy-deps circuitpy-freeze-kmk-nrf
@$(MAKE) circuitpy-flash-nrf circuitpy-flash-nrf-entrypoint
endif
ifndef BOARD
build-teensy-3.1:
@echo "===> Must provide a board (usually from boards/...) to build!"
else
build-teensy-3.1: lint devdeps micropython-deps micropython-freeze-kmk-teensy3.1
@echo "===> Preparing keyboard script for bundling into MicroPython"
@cp -av ${BOARD} vendor/micropython/ports/teensy/freeze/kmk_keyboard_user.py
@$(MAKE) micropython-flash-teensy3.1
endif
# 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"

10
entrypoints/teensy31.py Normal file
View File

@ -0,0 +1,10 @@
import sys
from kmk_keyboard_user import main
if __name__ == '__main__':
try:
main()
except Exception as e:
sys.print_exception(e)
sys.exit(1)