Merge pull request #936 from keyboardio/f/arduino-cli

Switch us over from arduino-builder to arduino-cli
pull/982/head
Jesse Vincent 4 years ago committed by GitHub
commit 780edea8b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,62 +3,50 @@ name: Build
on: [push, pull_request] on: [push, pull_request]
env: env:
BOARD_HARDWARE_PATH: ../hardware LC_ALL: C
ARDUINO_PATH: ./arduino-1.8.13 KALEIDOSCOPE_CCACHE: 1
ARDUINO_DOWNLOAD_URL: https://downloads.arduino.cc/arduino-1.8.13-linux64.tar.xz ARDUINO_DIRECTORIES_USER: ${{ github.workspace }}/.arduino/user
jobs: jobs:
smoke-sketches: smoke-sketches:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- run: git clone --quiet --depth 1 --recurse-submodules=build-tools --recurse-submodules=toolchain --recurse-submodules=avr/libraries/ --jobs 16 --shallow-submodules git://github.com/keyboardio/Kaleidoscope-Bundle-Keyboardio ../hardware/keyboardio
- run: rm -rf ../hardware/keyboardio/avr/libraries/Kaleidoscope ## We delete the Bundle's version of Kaleidoscope, and symlink ourselves in.
- run: ln -s $(pwd) ../hardware/keyboardio/avr/libraries/Kaleidoscope ## This makes sure we're using the current version of the library.
# - run: make adjust-git-timestamps - run: sudo apt-get install ccache
- run: wget --quiet $ARDUINO_DOWNLOAD_URL -O - | tar xJf - - run: make setup
- run: make -j 8 smoke-sketches - run: make -j $(nproc) smoke-sketches
run-google-tests: run-google-tests:
runs-on: ubuntu-latest runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- run: git clone --quiet --depth 1 --recurse-submodules=build-tools --recurse-submodules=toolchain --recurse-submodules=avr/libraries/ --jobs 16 --shallow-submodules git://github.com/keyboardio/Kaleidoscope-Bundle-Keyboardio $HOME/Arduino/hardware/keyboardio # - uses: mxschmitt/action-tmate@v3
- run: rm -rf $HOME/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope - run: sudo apt-get install ccache
- run: ln -s $(pwd) $HOME/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope - run: make setup
# - run: make adjust-git-timestamps - run: make -j $(nproc) simulator-tests
- run: wget --quiet $ARDUINO_DOWNLOAD_URL -O - | tar xJf -
- run: BOARD_HARDWARE_PATH=$HOME/Arduino/hardware ARDUINO_PATH=$GITHUB_WORKSPACE/arduino-1.8.13 ARDUINO_BUILDER=$ARDUINO_PATH/arduino-builder make simulator-tests
check-astyle: check-astyle:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- run: sudo apt-get install astyle
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- run: git clone --quiet --depth 1 --recurse-submodules=build-tools --recurse-submodules=toolchain --recurse-submodules=avr/libraries/ --jobs 16 --shallow-submodules git://github.com/keyboardio/Kaleidoscope-Bundle-Keyboardio ../hardware/keyboardio - run: make setup
- run: rm -rf ../hardware/keyboardio/avr/libraries/Kaleidoscope
- run: ln -s $(pwd) ../hardware/keyboardio/avr/libraries/Kaleidoscope
# - run: make adjust-git-timestamps
- run: make check-astyle - run: make check-astyle
check-shellcheck: check-shellcheck:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- run: git clone --quiet --depth 1 --recurse-submodules=build-tools --recurse-submodules=toolchain --recurse-submodules=avr/libraries/ --jobs 16 --shallow-submodules git://github.com/keyboardio/Kaleidoscope-Bundle-Keyboardio ../hardware/keyboardio - run: make setup
- run: rm -rf ../hardware/keyboardio/avr/libraries/Kaleidoscope
- run: ln -s $(pwd) ../hardware/keyboardio/avr/libraries/Kaleidoscope
- run: make shellcheck - run: make shellcheck
check-cpplint: check-cpplint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- run: git clone --quiet --depth 1 --recurse-submodules=build-tools --recurse-submodules=toolchain --recurse-submodules=avr/libraries/ --jobs 16 --shallow-submodules git://github.com/keyboardio/Kaleidoscope-Bundle-Keyboardio ../hardware/keyboardio - run: make setup
- run: rm -rf ../hardware/keyboardio/avr/libraries/Kaleidoscope
- run: ln -s $(pwd) ../hardware/keyboardio/avr/libraries/Kaleidoscope
# - run: make adjust-git-timestamps
- run: make cpplint - run: make cpplint
find-filename-conflicts: find-filename-conflicts:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- run: git clone --quiet --depth 1 --recurse-submodules=build-tools --recurse-submodules=toolchain --recurse-submodules=avr/libraries/ --jobs 16 --shallow-submodules git://github.com/keyboardio/Kaleidoscope-Bundle-Keyboardio ../hardware/keyboardio - run: make setup
- run: rm -rf ../hardware/keyboardio/avr/libraries/Kaleidoscope
- run: ln -s $(pwd) ../hardware/keyboardio/avr/libraries/Kaleidoscope
- run: make find-filename-conflicts - run: make find-filename-conflicts

1
.gitignore vendored

@ -11,3 +11,4 @@
/_build/ /_build/
/results/ /results/
generated-testcase.cpp generated-testcase.cpp
.arduino

@ -13,7 +13,6 @@ env:
global: global:
- LC_ALL: C - LC_ALL: C
- CCACHE_WRAPPER_PATH: /tmp/kaleidoscope-ccache - CCACHE_WRAPPER_PATH: /tmp/kaleidoscope-ccache
- ARDUINO_DOWNLOAD_URL: https://downloads.arduino.cc/arduino-1.8.13-linux64.tar.xz
git: git:
quiet: true quiet: true
depth: false depth: false
@ -23,17 +22,15 @@ before_install:
install: install:
- cd $TRAVIS_BUILD_DIR - cd $TRAVIS_BUILD_DIR
- git clone --depth 1 --recurse-submodules=build-tools --recurse-submodules=toolchain --recurse-submodules=avr/libraries/ --jobs 16 --shallow-submodules git://github.com/keyboardio/Kaleidoscope-Bundle-Keyboardio ../hardware/keyboardio - git clone --depth 1 --recurse-submodules=build-tools --recurse-submodules=toolchain --recurse-submodules=avr/libraries/ --jobs 16 --shallow-submodules git://github.com/keyboardio/Kaleidoscope-Bundle-Keyboardio $TRAVIS_BUILD_DIR/.arduino/user/hardware/keyboardio
## We delete the Bundle's version of Kaleidoscope, and symlink ourselves in. ## We delete the Bundle's version of Kaleidoscope, and symlink ourselves in.
## This makes sure we're using the current version of the library. ## This makes sure we're using the current version of the library.
- rm -rf ../hardware/keyboardio/avr/libraries/Kaleidoscope
- ln -s $(pwd) ../hardware/keyboardio/avr/libraries/Kaleidoscope
- export KALEIDOSCOPE_TEMP_PATH=$TRAVIS_BUILD_DIR/.kaleidoscope-build-cache - export KALEIDOSCOPE_TEMP_PATH=$TRAVIS_BUILD_DIR/.kaleidoscope-build-cache
- export BOARD_HARDWARE_PATH=$TRAVIS_BUILD_DIR/../hardware - export KALEIDOSCOPE_ETC_DIR=$TRAVIS_BUILD_DIR/etc
- export ARDUINO_PATH=$TRAVIS_BUILD_DIR/arduino-1.8.13
- make adjust-git-timestamps - make adjust-git-timestamps
- wget --quiet $ARDUINO_DOWNLOAD_URL -O - | tar xJf - - make install-arduino-cli
- make prepare-ccache - make configure-arduino-cli
- make install-arduino-core-avr
jobs: jobs:
include: include:
- env: TEST_CMD="make -j 2 smoke-sketches" - env: TEST_CMD="make -j 2 smoke-sketches"
@ -53,5 +50,4 @@ cache:
apt: true apt: true
ccache: true ccache: true
directories: directories:
- .download-cache
- .kaleidoscope-build-cache - .kaleidoscope-build-cache

@ -1,75 +1,4 @@
# This stub makefile for a Kaleidoscope plugin pulls in include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/etc/makefiles/arduino-cli.mk
# all targets from the Kaleidoscope-Plugin library
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
SKETCHBOOK_DIR ?= $(HOME)/Documents/Arduino
PACKAGE_DIR ?= $(HOME)/Library/Arduino15
else
SKETCHBOOK_DIR ?= $(HOME)/Arduino
PACKAGE_DIR ?= $(HOME)/.arduino15
endif
ARDUINO_INSTALLED_ENV=$(shell ls -dt $(PACKAGE_DIR)/packages/keyboardio/hardware/avr 2>/dev/null |head -n 1)
MANUALLY_INSTALLED_ENV=$(shell ls -dt $(SKETCHBOOK_DIR)/hardware/keyboardio/avr 2>/dev/null |head -n 1)
ifneq ("$(wildcard $(ARDUINO_INSTALLED_ENV)/boards.txt)","")
ifneq ("$(wildcard $(MANUALLY_INSTALLED_ENV)/boards.txt)","")
$(info ***************************************************************************)
$(info It appears that you have installed two copies of Kaleidoscope. One copy was)
$(info installed using Arduino's "Board Manager", while the other was installed by)
$(info hand, probably using "git".)
$(info )
$(info This will likely cause some trouble as you try to build keyboard firmware)
$(info using Kaleidoscope. You may want to remove either: )
$(info )
$(info $(PACKAGE_DIR)/packages/keyboardio/ which was installed using Arduino)
$(info )
$(info or)
$(info )
$(info $(SKETCHBOOK_DIR)/hardware/keyboardio/ which was installed by hand.)
$(info )
$(info ***************************************************************************)
$(info )
endif
BOARD_HARDWARE_PATH = $(ARDUINO_INSTALLED_ENV)
KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= build-tools/makefiles/
KALEIDOSCOPE_BUILDER_DIR ?= $(ARDUINO_INSTALLED_ENV)/libraries/Kaleidoscope/bin/
endif
BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware
KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/build-tools/makefiles/
# If Kaleidoscope's Arduino libraries cannot be found, e.g. because
# they reside outside of SKETCHBOOK_DIR, we fall back to assuming that
# the hardware directory can be determined in relation to the position of
# this Makefile.
ifeq ("$(wildcard $(BOARD_HARDWARE_PATH)/keyboardio/build-tools/makefiles/rules.mk)","")
# Determine the path of this Makefile
MKFILE_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
BOARD_HARDWARE_PATH = $(MKFILE_DIR)/../../../..
endif
ifeq ("$(wildcard $(BOARD_HARDWARE_PATH)/keyboardio/build-tools/makefiles/rules.mk)","")
$(info ***************************************************************************)
$(info Unable to autodetect a proper BOARD_HARDWARE_PATH. Please define it manually.)
$(info ***************************************************************************)
$(info )
endif
include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk
# Set up an argument for passing to the simulator tests in docker # Set up an argument for passing to the simulator tests in docker
# but if the var isn't set, don't even pass the definition # but if the var isn't set, don't even pass the definition
@ -80,26 +9,43 @@ ifneq ($(TEST_PATH),)
endif endif
DEFAULT_GOAL: smoke-sketches
clean: PLUGIN_TEST_SUPPORT_DIR ?= $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/build-tools/
$(MAKE) -C tests clean PLUGIN_TEST_BIN_DIR ?= $(PLUGIN_TEST_SUPPORT_DIR)/../toolchain/$(shell gcc --print-multiarch)/bin
rm -rf testing/googletest/build/*
setup: $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/boards.txt $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/virtual/boards.txt $(ARDUINO_CLI_PATH) configure-arduino-cli install-arduino-core-avr
@:
prepare-virtual:
$(MAKE) -C $(BOARD_HARDWARE_PATH)/keyboardio prepare-virtual
checkout-platform: $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/boards.txt
@:
simulator-tests: prepare-virtual prepare-virtual: $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/virtual/boards.txt
@:
$(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/virtual/boards.txt:
$(MAKE) -C $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio prepare-virtual
$(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/boards.txt:
git clone -c core.symlinks=true --recurse-submodules=":(exclude)avr/libraries/Kaleidoscope" --recurse-submodules=build-tools --recurse-submodules=toolchain --recurse-submodules=avr/libraries/ git://github.com/keyboardio/Kaleidoscope-Bundle-Keyboardio $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio
rm -d $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/libraries/Kaleidoscope
ln -s $(KALEIDOSCOPE_DIR) $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/libraries/Kaleidoscope
simulator-tests: configure-arduino-cli $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/virtual/boards.txt
$(MAKE) -C tests all $(MAKE) -C tests all
docker-simulator-tests: docker-simulator-tests:
BOARD_HARDWARE_PATH="$(BOARD_HARDWARE_PATH)" ./bin/run-docker "make simulator-tests ${TEST_PATH_ARG}" ARDUINO_DIRECTORIES_USER="$(ARDUINO_DIRECTORIES_USER)" ./bin/run-docker "make simulator-tests $(TEST_PATH_ARG)"
docker-clean:
ARDUINO_DIRECTORIES_USER="$(ARDUINO_DIRECTORIES_USER)" ./bin/run-docker "make clean"
docker-bash: docker-bash:
BOARD_HARDWARE_PATH="$(BOARD_HARDWARE_PATH)" ./bin/run-docker "bash" ARDUINO_DIRECTORIES_USER="$(ARDUINO_DIRECTORIES_USER)" ./bin/run-docker "bash"
run-tests: prepare-virtual build-gtest-gmock run-tests: $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/virtual/boards.txt build-gtest-gmock
$(MAKE) -c tests $(MAKE) -c tests
@: # blah @: # blah
@ -115,20 +61,20 @@ find-filename-conflicts:
bin/find-filename-conflicts; \ bin/find-filename-conflicts; \
fi fi
#.PHONY: astyle test cpplint cpplint-noisy shellcheck smoke-examples find-filename-conflicts: .PHONY: astyle test cpplint cpplint-noisy shellcheck smoke-examples find-filename-conflicts prepare-virtual checkout-platform adjust-git-timestamps docker-bash docker-simulator-tests run-tests simulator-tests setup
astyle: astyle:
PATH="$(PLUGIN_TEST_BIN_DIR):$(PATH)" $(PLUGIN_TEST_SUPPORT_DIR)/quality/run-astyle bin/run-astyle
check-astyle: astyle check-astyle: astyle
PATH="$(PLUGIN_TEST_BIN_DIR):$(PATH)" $(PLUGIN_TEST_SUPPORT_DIR)/quality/astyle-check bin/astyle-check
cpplint-noisy: cpplint-noisy:
-$(PLUGIN_TEST_SUPPORT_DIR)/quality/cpplint.py --filter=-legal/copyright,-build/include,-readability/namespace,-whitespace/line_length,-runtime/references --recursive --extensions=cpp,h,ino --exclude=$(BOARD_HARDWARE_PATH) src examples -bin/cpplint.py --filter=-legal/copyright,-build/include,-readability/namespace,-whitespace/line_length,-runtime/references --recursive --extensions=cpp,h,ino src examples
cpplint: cpplint:
$(PLUGIN_TEST_SUPPORT_DIR)/quality/cpplint.py --quiet --filter=-whitespace,-legal/copyright,-build/include,-readability/namespace,-runtime/references --recursive --extensions=cpp,h,ino src examples bin/cpplint.py --quiet --filter=-whitespace,-legal/copyright,-build/include,-readability/namespace,-runtime/references --recursive --extensions=cpp,h,ino src examples
SHELL_FILES = $(shell if [ -d bin ]; then egrep -n -r -l "(env (ba)?sh)|(/bin/(ba)?sh)" bin; fi) SHELL_FILES = $(shell if [ -d bin ]; then egrep -n -r -l "(env (ba)?sh)|(/bin/(ba)?sh)" bin; fi)
@ -144,13 +90,18 @@ check-docs:
python $(PLUGIN_TEST_SUPPORT_DIR)/quality/doxy-coverage.py /tmp/undocced/xml python $(PLUGIN_TEST_SUPPORT_DIR)/quality/doxy-coverage.py /tmp/undocced/xml
SMOKE_SKETCHES=$(shell if [ -d ./examples ]; then find ./examples -type f -name \*ino | xargs -n 1 dirname; fi) SMOKE_SKETCHES=$(sort $(shell if [ -d ./examples ]; then find ./examples -type f -name \*ino | xargs -n 1 dirname; fi))
smoke-sketches: $(SMOKE_SKETCHES) smoke-sketches: $(SMOKE_SKETCHES)
@echo "Smoke-tested all the sketches" @echo "Smoke-tested all the sketches"
.PHONY: force .PHONY: force all clean test
clean:
$(MAKE) -C tests clean
rm -rf -- "testing/googletest/build/*"
rm -rf -- "_build/*"
$(SMOKE_SKETCHES): force $(SMOKE_SKETCHES): force
@BOARD_HARDWARE_PATH="$(BOARD_HARDWARE_PATH)" $(KALEIDOSCOPE_BUILDER_DIR)/kaleidoscope-builder $@ compile $(MAKE) -C $@ -f $(KALEIDOSCOPE_ETC_DIR)/makefiles/sketch.mk compile

@ -1,5 +1,6 @@
# Kaleidoscope # Kaleidoscope
Flexible firmware for Arduino-powered keyboards. Flexible firmware for Arduino-powered keyboards.
This package contains the "core" of Kaleidoscope and a number of [example firmware "Sketches"](https://github.com/keyboardio/Kaleidoscope/tree/master/examples). This package contains the "core" of Kaleidoscope and a number of [example firmware "Sketches"](https://github.com/keyboardio/Kaleidoscope/tree/master/examples).
@ -8,65 +9,59 @@ If you're just getting started with the Keyboardio Model 01, the [introductory d
# Getting Started # Getting Started
## Setup the Arduino IDE
Setup the Arduino IDE on your system. Make sure you install at least version 1.8.6, since older version may not support all required features. If you want to use Kaleidoscope to customize or compile a "sketch" to power a supported keyboard, the fastest way to get started is to use the Arduino IDE. You can find [setup instructions](https://kaleidoscope.readthedocs.io/en/latest/quick_start.html) on [kaleidoscope.readthedocs.io](https://kaleidoscope.readthedocs.io)
* On Linux, follow the instructions [on the wiki](https://github.com/keyboardio/Kaleidoscope/wiki/Install-Arduino-support-on-Linux). If you prefer to work from the command line or intend to work on Kaleidscope itself, please follow the instructions below
* On macOS, install using [homebrew](http://brew.sh/) [cask](https://caskroom.github.io/) with `brew cask install arduino` or download the application from [the official website](https://www.arduino.cc/en/Main/Software) and move it to your `/Applications` folder.
## Get into the right directory # Use git to check out a copy of Kaleidoscope
### macOS 1. Open a commandline shell and navigate to where you want to check out Kaleidoscope.
```sh
mkdir -p $HOME/Documents/Arduino/hardware
cd $HOME/Documents/Arduino/hardware
```
### Linux For the purposes of this tutorial, we'll assume your checkout is in a directory called `kaleidoscope` inside a directory called `git` in your home directory.
```sh ```sh
mkdir -p $HOME/Arduino/hardware $ mkdir ${HOME}/git
cd $HOME/Arduino/hardware $ cd ${HOME}/git
``` ```
### Windows (Assuming cmd) 2. Use git to download the latest version of Kaleidoscope
```sh ```sh
mkdir %userprofile%\Documents\Arduino\hardware $ git clone https://github.com/keyboardio/Kaleidoscope
cd %userprofile%\Documents\Arduino\hardware
``` ```
3. Ask Kaleidoscope to install the compiler toolchain, arduino-cli and platform support
### Install the libraries and hardware definitions ```sh
$ cd ${HOME}/git/Kaleidoscope
## Clone the hardware definitions $ make setup
```
Because git for Windows doesn't always have symlink support enabled by default, you may need to enable it for Kaleidoscope. To do that, add '-c core.symlinks=true' to your commandline. On all other platforms, that option is safe, but not necessary, as symlinks should work by default. 4. Tell your shell where to find your Kaleidoscope installation. This example is for bash. If you're using another shell, consult the shell's documentation for instructions about how to set an environment variable
```sh ```sh
git clone -c core.symlinks=true --recursive https://github.com/keyboardio/Kaleidoscope-Bundle-Keyboardio.git keyboardio $ export KALEIDOSCOPE_DIR=${HOME}/git/Kaleidoscope
$ echo "export KALEIDOSCOPE_DIR=${HOME}/git/Kaleidoscope" >> ${HOME}/.bash_profile
``` ```
## Build the Kaleidoscope Firmware for your keyboard 5. Build the Kaleidoscope Firmware for your keyboard
(This part assumes you're building firmware for the Keyboardio Model 01) (This part assumes you're building firmware for the Keyboardio Atreus)
```sh ```sh
# Go to your device firmware directory $ cd examples/Devices/Keyboardio/Atreus
cd keyboardio/avr/libraries/Model01-Firmware
# Build your firmware! $ make compile
make ```
5. Install your firmware
# Install your firmware ```sh
make flash $ make flash
``` ```
<3 jesse <3 jesse
[![Build
Status](https://travis-ci.org/keyboardio/Kaleidoscope.svg?branch=master)](https://travis-ci.org/keyboardio/Kaleidoscope)

@ -0,0 +1,7 @@
#!/bin/sh
if ! git diff --exit-code; then
>&2 echo "'make astyle' found code style differences. Please make astyle and commit your changes"
exit 1;
fi
exit 0;

6583
bin/cpplint.py vendored

File diff suppressed because it is too large Load Diff

@ -586,6 +586,17 @@ EOF
} }
deprecation_message() {
echo "kaleidoscope-builder is deprecated and will be removed"
echo "by February 15, 2021"
echo ""
echo "To switch to the new build system, replace your sketch's"
echo "Makefile with a copy of:"
echo ""
echo "${KALEIDOSCOPE_DIR}/etc/Makefile.sketch"
echo ""
}
usage () { usage () {
cat <<- EOF cat <<- EOF
Usage: $0 SKETCH commands... Usage: $0 SKETCH commands...
@ -627,6 +638,12 @@ usage () {
EOF EOF
} }
KALEIDOSCOPE_DIR="$(cd "$(dirname "$0")"/..; pwd)"
# shellcheck disable=SC2034
KALEIDOSCOPE_BIN_DIR="${KALEIDOSCOPE_DIR}/bin/"
help () { help () {
usage usage
} }
@ -643,11 +660,8 @@ fi
## ##
## - if there is only one argument, that's a command ## - if there is only one argument, that's a command
KALEIDOSCOPE_DIR="$(cd "$(dirname "$0")"/..; pwd)"
# shellcheck disable=SC2034
KALEIDOSCOPE_BIN_DIR="${KALEIDOSCOPE_DIR}/bin/"
deprecation_message
# shellcheck disable=SC2155 # shellcheck disable=SC2155
@ -668,6 +682,7 @@ done
# shellcheck disable=SC1090 # shellcheck disable=SC1090
if [ -n "${VERBOSE}" ] && [[ "${VERBOSE}" -gt 0 ]]; then if [ -n "${VERBOSE}" ] && [[ "${VERBOSE}" -gt 0 ]]; then
ARDUINO_VERBOSE="-verbose" ARDUINO_VERBOSE="-verbose"
else else

@ -0,0 +1,4 @@
#!/bin/sh
ASTYLE_IGNORE_PATTERN='testing/googletest/'
find ./* -type f \( -name '*.h' -o -name '*.cpp' -o -name '*.ino' \) | grep -v "$ASTYLE_IGNORE_PATTERN" | xargs -n 1 astyle -q --style=google --unpad-paren --pad-header --pad-oper --indent-classes --indent=spaces=2 --max-continuation-indent=80

@ -13,25 +13,28 @@ fi
if [ "${uname_S}" = "Darwin" ]; then if [ "${uname_S}" = "Darwin" ]; then
ARDUINO_LOCAL_LIB_PATH="${ARDUINO_LOCAL_LIB_PATH:-${HOME}/Documents/Arduino}"
# This stops macos from copying resource forks into thigns like tar # This stops macos from copying resource forks into thigns like tar
export COPYFILE_DISABLE=true export COPYFILE_DISABLE=true
else else
ARDUINO_LOCAL_LIB_PATH="${ARDUINO_LOCAL_LIB_PATH:-${HOME}/Arduino}" ARDUINO_LOCAL_LIB_PATH="${ARDUINO_LOCAL_LIB_PATH:-${HOME}/Arduino}"
fi fi
BOARD_HARDWARE_PATH="${BOARD_HARDWARE_PATH:-${ARDUINO_LOCAL_LIB_PATH}/hardware}"
echo "Preparing Kaleidoscope and the bundle..." echo "Preparing Kaleidoscope and the bundle..."
XFER_DIR="$(pwd)/.docker_xfer" XFER_DIR="$(pwd)/.docker_xfer"
mkdir -p "${XFER_DIR}" mkdir -p "${XFER_DIR}"
tar -cf "${XFER_DIR}/kaleidoscope.tar" \ tar -cf "${XFER_DIR}/kaleidoscope.tar" \
--exclude .docker_xfer --exclude .git --exclude _build --exclude testing/googletest/build \ --exclude .arduino/data \
--exclude bin/arduino-cli \
--exclude .docker_xfer \
--exclude .git \
--exclude _build \
--exclude testing/googletest/build \
. .
(cd "${BOARD_HARDWARE_PATH}/keyboardio" && tar -cf "${XFER_DIR}/bundle.tar" \ echo "The bundle is coming from ${ARDUINO_DIRECTORIES_USER}/hardware/keyboardio"
(cd "${ARDUINO_DIRECTORIES_USER}/hardware/keyboardio" && tar -cf "${XFER_DIR}/bundle.tar" \
--exclude .git --exclude avr/libraries/Kaleidoscope .) --exclude .git --exclude avr/libraries/Kaleidoscope .)
echo "Building the docker image..." echo "Building the docker image..."
@ -39,11 +42,13 @@ docker build -q -t kaleidoscope/docker etc
# We do want word splitting since there are multiple options here # We do want word splitting since there are multiple options here
# shellcheck disable=SC2086 # shellcheck disable=SC2086
docker run --rm $DOCKER_RUN_INTERACTIVE_OPTS \ docker run --rm $DOCKER_RUN_INTERACTIVE_OPTS \
--tmpfs /kaleidoscope:exec \ --mount type=tmpfs,destination=/kaleidoscope:exec \
--mount type=bind,source="${XFER_DIR}",destination=/kaleidoscope-src,consistency=delegated,readonly \ --mount type=bind,source="${XFER_DIR}",destination=/kaleidoscope-src,consistency=delegated,readonly \
--mount type=volume,source=kaleidoscope-persist,destination=/kaleidoscope-persist,consistency=delegated \ --mount type=volume,source=kaleidoscope-persist,destination=/kaleidoscope-persist,consistency=delegated \
--mount type=volume,source=kaleidoscope-googletest-build,destination=/kaleidoscope/hardware/keyboardio/avr/libraries/Kaleidoscope/testing/googletest/build,consistency=delegated \ --mount type=volume,source=kaleidoscope-googletest-build,destination=/kaleidoscope/testing/googletest/build,consistency=delegated \
--mount type=volume,source=kaleidoscope-build,destination=/kaleidoscope/hardware/keyboardio/avr/libraries/Kaleidoscope/_build,consistency=delegated \ --mount type=volume,source=kaleidoscope-build,destination=/kaleidoscope/_build,consistency=delegated \
--env ARDUINO_DIRECTORIES_DATA=/arduino-cli/data \
--env ARDUINO_DIRECTORIES_USER=/kaleidoscope/.arduino/user/ \
kaleidoscope/docker "$*" kaleidoscope/docker "$*"

@ -7,6 +7,7 @@ If any of this does not make sense to you, or you have trouble updating your .in
* [Upgrade notes](#upgrade-notes) * [Upgrade notes](#upgrade-notes)
+ [New features](#new-features) + [New features](#new-features)
- [New build system](#new-build-system)
- [New device API](#new-device-api) - [New device API](#new-device-api)
- [New plugin API](#new-plugin-api) - [New plugin API](#new-plugin-api)
- [Bidirectional communication for plugins](#bidirectional-communication-for-plugins) - [Bidirectional communication for plugins](#bidirectional-communication-for-plugins)
@ -32,6 +33,10 @@ any API we've included in a release. Typically, this means that any code that us
## New features ## New features
### New build system
In this release, we replace kaleidoscope-builder with a new Makefile based build system that uses `arduino-cli` instead of of the full Arduino IDE. This means that you can now check out development copies of Kaliedoscope into any directory, using the `KALEIDOSCOPE_DIR` environment variable to point to your installation.
### New device API ### New device API
We are introducing - or rather, replacing - the older hardware plugins, with a system that's much more composable, more extensible, and will allow us to better support new devices, different MCUs, and so on. We are introducing - or rather, replacing - the older hardware plugins, with a system that's much more composable, more extensible, and will allow us to better support new devices, different MCUs, and so on.

@ -7,7 +7,7 @@ teensy2 variant too.
To select which one to build for, you can either use the Arduino IDE, and select To select which one to build for, you can either use the Arduino IDE, and select
the appropriate Pinout and CPU, or, if using `kaleidoscope-builder`, you can add the appropriate Pinout and CPU, or, if using `kaleidoscope-builder`, you can add
a `LOCAL_CFLAGS` setting to `.kaleidoscope-builder.conf`. a `LOCAL_CFLAGS` setting to your Makefile
For the post-2016 variant (the default, also used by the handwired variant from For the post-2016 variant (the default, also used by the handwired variant from
FalbaTech), if you want to explicitly select it, add FalbaTech), if you want to explicitly select it, add

@ -3,20 +3,16 @@ LABEL maintainer="Keyboard.io, inc"
RUN apt-get -qq update && \ RUN apt-get -qq update && \
DEBIAN_FRONTEND=noninteractive \ DEBIAN_FRONTEND=noninteractive \
apt-get -qq install -y xz-utils curl make build-essential libxtst-dev cmake ccache apt-get -qq install -y xz-utils curl make build-essential libxtst-dev cmake ccache vim
RUN ccache --set-config=cache_dir=/kaleidoscope-persist/ccache/cache RUN ccache --set-config=cache_dir=/kaleidoscope-persist/ccache/cache
ENV ARDUINO_VERSION "1.8.13"
WORKDIR /usr/local
RUN curl https://downloads.arduino.cc/arduino-${ARDUINO_VERSION}-linux64.tar.xz | \
xzcat | tar xf - && \
ln -s arduino-${ARDUINO_VERSION} arduino
RUN curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | \ RUN curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | \
sh sh
RUN /usr/local/bin/arduino-cli core install arduino:avr RUN ARDUINO_DIRECTORIES_DATA=/arduino-cli/data /bin/arduino-cli config init
RUN ARDUINO_DIRECTORIES_DATA=/arduino-cli/data /bin/arduino-cli update
RUN ARDUINO_DIRECTORIES_DATA=/arduino-cli/data /bin/arduino-cli core install arduino:avr
COPY docker-entrypoint.sh /usr/local/bin/entrypoint COPY docker-entrypoint.sh /usr/local/bin/entrypoint
@ -24,10 +20,9 @@ COPY docker-entrypoint.sh /usr/local/bin/entrypoint
VOLUME ["/kaleidoscope", \ VOLUME ["/kaleidoscope", \
"/kaleidoscope-src", \ "/kaleidoscope-src", \
"/kaleidoscope-persist", \ "/kaleidoscope-persist", \
"/kaleidoscope/hardware/keyboardio/avr/libraries/Kaleidoscope/testing/googletest/build", \ "/kaleidoscope/testing/googletest/build", \
"/kaleidoscope/hardware/keyboardio/avr/libraries/Kaleidoscope/_build"] "/kaleidoscope/_build"]
ENV BOARD_HARDWARE_PATH "/kaleidoscope/hardware"
ENV KALEIDOSCOPE_TEMP_PATH "/kaleidoscope-persist/temp" ENV KALEIDOSCOPE_TEMP_PATH "/kaleidoscope-persist/temp"

@ -0,0 +1,48 @@
# This makefile for a Kaleidoscope sketch pulls in all the targets
# required to build the example
ifneq ($(KALEIDOSCOPE_DIR),)
search_path += $(KALEIDOSCOPE_DIR)
endif
ifneq ($(ARDUINO_DIRECTORIES_USER),)
search_path += $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/libraries/Kaleidoscope
endif
ifeq ($(shell uname -s),Darwin)
search_path += $(HOME)/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
else
search_path += $(HOME)/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
endif
sketch_makefile := etc/makefiles/sketch.mk
$(foreach candidate, $(search_path), $(if $(wildcard $(candidate)/$(sketch_makefile)), $(eval ks_dir ?= $(candidate))))
ifneq ($(ks_dir),)
$(info Using Kaleidoscope from $(ks_dir))
export KALEIDOSCOPE_DIR := $(ks_dir)
include $(ks_dir)/$(sketch_makefile)
else
$(info I can't find your Kaleidoscope installation.)
$(info )
$(info I tried looking in:)
$(info )
$(foreach candidate, $(search_path), $(info $(candidate)))
$(info )
$(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment)
$(info variable to the location of your Kaleidoscope directory.)
endif
null-target:
$(info You should never see this message)
@:

@ -1,20 +1,24 @@
#! /bin/bash #! /bin/bash
set -e set -e
install -d /kaleidoscope/hardware/keyboardio \ install -d /kaleidoscope/ \
/kaleidoscope/hardware/keyboardio/avr/libraries/Kaleidoscope \ /kaleidoscope/.arduino/user/hardware/keyboardio \
/kaleidoscope-persist/temp \ /kaleidoscope-persist/temp \
/kaleidoscope-persist/ccache/cache /kaleidoscope-persist/ccache/cache
echo "Syncing the bundle..."
tar xf /kaleidoscope-src/bundle.tar -C /kaleidoscope/hardware/keyboardio
echo "Syncing Kaleidoscope..." echo "Syncing Kaleidoscope..."
tar xf /kaleidoscope-src/kaleidoscope.tar -C /kaleidoscope/hardware/keyboardio/avr/libraries/Kaleidoscope tar xf /kaleidoscope-src/kaleidoscope.tar -C /kaleidoscope/
echo "Syncing the bundle..."
tar xf /kaleidoscope-src/bundle.tar -C /kaleidoscope/.arduino/user/hardware/keyboardio
rm -f /kaleidoscope/.arduino/user/hardware/keyboardio/avr/libraries/Kaleidoscope
ln -s /kaleidoscope /kaleidoscope/.arduino/user/hardware/keyboardio/avr/libraries/Kaleidoscope
ln -s /kaleidoscope/hardware/keyboardio/virtual/libraries/Kaleidoscope \
/kaleidoscope/hardware/keyboardio/avr/libraries/Kaleidoscope
cd /kaleidoscope/hardware/keyboardio/avr/libraries/Kaleidoscope cd /kaleidoscope/
export ARDUINO_DIRECTORIES_DATA=/arduino-cli/data
export KALEIDOSCOPE_CCACHE=1
/bin/bash -c "$*" /bin/bash -c "$*"

@ -0,0 +1,4 @@
// this is a dummy sketch that's just here so that we can get
// arduino-cli to give us properties for our platform if we
// don't have a sketch, like happens when building parts of the
// simulator test infrastructure

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:keyboardio_atreus",
"port": ""
}
}

@ -0,0 +1,148 @@
mkfile_dir := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
ifeq ($(VERBOSE),)
ifeq ($(QUIET),)
$(info Building in quiet mode. For a lot more informatiion, add 'VERBOSE=1' to the beginning of your call to $(MAKE))
export QUIET = @
endif
export ARDUINO_VERBOSE ?=
else
export ARDUINO_VERBOSE ?= --verbose
endif
# Build path config
TMPDIR ?= /tmp
export KALEIDOSCOPE_DIR ?= $(abspath $(mkfile_dir)/../..)
KALEIDOSCOPE_BIN_DIR ?= $(KALEIDOSCOPE_DIR)/bin
KALEIDOSCOPE_ETC_DIR ?= $(KALEIDOSCOPE_DIR)/etc
KALEIDOSCOPE_TEMP_PATH ?= $(TMPDIR)/kaleidoscope-$(USER)
KALEIDOSCOPE_BUILD_PATH ?= $(KALEIDOSCOPE_TEMP_PATH)/build
KALEIDOSCOPE_OUTPUT_PATH ?= $(KALEIDOSCOPE_TEMP_PATH)/output
CORE_CACHE_PATH ?= $(KALEIDOSCOPE_TEMP_PATH)/arduino-cores
ARDUINO_CONTENT ?= $(KALEIDOSCOPE_DIR)/.arduino
export ARDUINO_DIRECTORIES_DATA ?= $(ARDUINO_CONTENT)/data
export ARDUINO_DIRECTORIES_DOWNLOADS ?= $(ARDUINO_CONTENT)/downloads
export ARDUINO_CLI_CONFIG ?= $(ARDUINO_DIRECTORIES_DATA)/arduino-cli.yaml
export ARDUINO_BOARD_MANAGER_ADDITIONAL_URLS ?= https://raw.githubusercontent.com/keyboardio/boardsmanager/master/package_keyboardio_index.json
# If it looks like Kaleidoscope is inside a "traditional" Arduino hardware directory
# in the user's homedir, let's use that.
ifeq ($(shell uname -s),Darwin)
traditional_path = $(HOME)/Documents/Arduino/
else
traditional_path = $(HOME)/Arduino/
endif
# use realpath to compare the real absolute path of the kaleidoscope dir
# and the arduino bundle, even if they're symlinked into the Arudino/hardware dir
ifeq ($(realpath $(traditional_path)/hardware/keyboardio/avr/libraries/Kaleidoscope), $(realpath $(KALEIDOSCOPE_DIR)))
export ARDUINO_DIRECTORIES_USER ?= $(traditional_path)
endif
# Otherwise, use the arduino-cli bundle
export ARDUINO_DIRECTORIES_USER ?= $(ARDUINO_CONTENT)/user
# If we're not calling setup, we should freak out if the hardware
# definitions don't exist
ifneq ($(MAKECMDGOALS),setup)
ifeq ($(wildcard $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/boards.txt),)
$(info Kaleidoscope hardware definitions not found in)
$(info $(ARDUINO_DIRECTORIES_USER))
$(info )
$(info You may be able to resolve this issue by running the following command)
$(info to initialize Kaleidoscope )
$(info )
$(info $(MAKE) -C $(KALEIDOSCOPE_DIR) setup )
$(info )
$(error )
endif
endif
system_arduino_cli=$(shell command -v arduino-cli || true)
arduino_env = ARDUINO_DIRECTORIES_USER=$(ARDUINO_DIRECTORIES_USER) \
ARDUINO_DIRECTORIES_DATA=$(ARDUINO_DIRECTORIES_DATA)
ifeq ($(system_arduino_cli),)
export ARDUINO_CLI_PATH ?= $(KALEIDOSCOPE_BIN_DIR)/arduino-cli
else
export ARDUINO_CLI_PATH ?= $(system_arduino_cli)
endif
export ARDUINO_CLI ?= $(arduino_env) $(ARDUINO_CLI_PATH)
ifneq ($(VERBOSE),)
$(info Using ardino-cli from $(ARDUINO_CLI_PATH))
endif
ifneq ($(FQBN),)
fqbn_arg = --fqbn $(FQBN)
endif
# if we don't have a sketch, make a pretend one so we can run --show properties
# This is because arduino-cli doesn't currently allow us to get props with
# just an FQBN. We've filed a bug with them
ifeq ($(SKETCH_FILE_PATH),)
_arduino_props_sketch_arg = $(KALEIDOSCOPE_ETC_DIR)/dummy-sketch/
else
_arduino_props_sketch_arg = $(SKETCH_FILE_PATH)
endif
# This is horrible. But because make doesn't really support
# multi-line variables and we want to cache the full
# _arduino_props in a variable, which means letting make
# split the properties on space, which is what it converts
# newlines into. To make this go, we we need to replace interior
# spaces in the variables with something. We chose the fire
# emoji, since it accurately represents our feelings on this
# state of affairs. Later, when finding props, we need to reverse
# this process, turning fire into space.
_arduino_props := $(shell ${ARDUINO_CLI} compile $(fqbn_arg) --show-properties "$(_arduino_props_sketch_arg)"|perl -p -e"s/ /🔥/g")
_arduino_prop = $(subst $1=,,$(subst 🔥, ,$(filter $1=%,$(_arduino_props))))
# How to use_arduino_prop
# $(call _arduino_prop,recipe.hooks.sketch.prebuild.2.pattern)
ifneq ($(KALEIDOSCOPE_CCACHE),)
ccache_wrapper_property := --build-properties "compiler.wrapper.cmd=ccache"
endif
.PHONY: configure-arduino-cli install-arduino-core-kaleidoscope install-arduino-core-avr
.PHONY: stupid-workaround-for-make-inclusion-semantics
stupid-workaround-for-make-inclusion-semantics: DEFAULT_GOAL
@: # This is here so that the sketch makefile including this file doesn't
@: # default to arduino-cli installation as its priamry target
$(KALEIDOSCOPE_BIN_DIR)/arduino-cli:
$(QUIET) curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR="$(KALEIDOSCOPE_BIN_DIR)" sh
install-arduino-cli: $(KALEIDOSCOPE_BIN_DIR)/arduino-cli
configure-arduino-cli:
$(QUIET) $(ARDUINO_CLI) config init
install-arduino-core-kaleidoscope:
$(QUIET) $(ARDUINO_CLI) core install "keyboardio:avr"
install-arduino-core-avr:
$(QUIET) $(ARDUINO_CLI) core install "arduino:avr"

@ -0,0 +1,211 @@
mkfile_dir := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
# If the sketch is defined
ifneq ($(SKETCH),)
# If the sketch isn't a directory, we want to get the directory the sketch is in
ifeq ($(wildcard $(SKETCH)/.),)
SKETCH_DIR := $(dir $(SKETCH))
endif
else
# If the sketch wasn't defined as we came in, assume the current directory
# is where we're looking
SKETCH_DIR := $(realpath $(CURDIR))
endif
SKETCH_BASE_NAME := $(notdir $(SKETCH_DIR))
SKETCH_FILE_NAME := $(addsuffix .ino, $(SKETCH_BASE_NAME))
# Find the path of the sketch file
SKETCH_DIR_CANDIDATES = $(sketch_dir) src/ .
sketch_exists_p = $(realpath $(wildcard $(dir)/$(SKETCH_FILE_NAME)))
SKETCH_FILE_PATH := $(firstword $(foreach dir,$(SKETCH_DIR_CANDIDATES),$(sketch_exists_p)))
include $(mkfile_dir)/arduino-cli.mk
ifeq ($(FQBN),)
export FQBN = $(call _arduino_prop,build.fqbn)
ifneq ($(VERBOSE),)
$(info Arduino provided FQBN $(call _arduino_prop,build.fqbn))
endif
endif
# We -could- check to see if sketch-dir is in git before running this command
# but since we'd just return an empty value in that case, why bother?
GIT_VERSION := $(shell git -C "$(SKETCH_DIR)" describe --abbrev=6 --dirty --alway 2>/dev/null || echo 'unknown')
SKETCH_IDENTIFIER ?= $(shell echo "${SKETCH_FILE_PATH}" | cksum | cut -d ' ' -f 1)-$(SKETCH_FILE_NAME)
BUILD_PATH ?= $(KALEIDOSCOPE_BUILD_PATH)/$(SKETCH_IDENTIFIER)
OUTPUT_PATH ?= $(KALEIDOSCOPE_OUTPUT_PATH)/$(SKETCH_IDENTIFIER)
OUTPUT_FILE_PREFIX := $(SKETCH_BASE_NAME)-$(GIT_VERSION)
HEX_FILE_PATH := $(OUTPUT_PATH)/$(OUTPUT_FILE_PREFIX).hex
HEX_FILE_WITH_BOOTLOADER_PATH := $(OUTPUT_PATH)/$(OUTPUT_FILE_PREFIX)-with-bootloader.hex
ELF_FILE_PATH := $(OUTPUT_PATH)/$(OUTPUT_FILE_PREFIX).elf
LIB_FILE_PATH := $(OUTPUT_PATH)/$(OUTPUT_FILE_PREFIX).a
KALEIDOSCOPE_PLATFORM_LIB_DIR := $(abspath $(KALEIDOSCOPE_DIR)/..)
ifeq ($(FQBN),)
possible_fqbns = $(shell $(ARDUINO_CLI) board list --format=json |grep FQBN| grep -v "keyboardio:virtual"|cut -d: -f 2-)
possible_fqbn = $(firstword $(possible_fqbns))
$(info *************************************************************** )
$(info )
$(info Arduino couldn't figure out what kind of device this sketch )
$(info is for. Usually, Arduino looks in a file called `sketch.json` )
$(info to figure this out. )
ifneq ($(possible_fqbn),)
fake_var_to_run_shell := $(shell $(ARDUINO_CLI) board attach $(possible_fqbn))
$(info )
$(info I have detected a connected device supported by Kaleidoscope and)
$(info attepted to automatically resolve this issue by running the)
$(info following command:)
$(info )
$(info $(ARDUINO_CLI) board attach $(possible_fqbn))
$(info )
$(info If the build fails or $(possible_fqbn) doesn't)
$(info look like your keyboard, you may need to manually edit your)
$(info `sketch.json` file or run )
$(info )
$(info $(ARDUINO_CLI) board attach )
$(info )
$(info manually, specifying the FQBN for your keyboard. )
$(info )
$(info *************************************************************** )
else
$(info )
$(info I'm unable to detect your keyboard, you may need to manually )
$(info edit your `sketch.json` file or run )
$(info )
$(info $(ARDUINO_CLI) board attach )
$(info )
$(info manually, specifying the FQBN for your keyboard. )
$(info )
$(info *************************************************************** )
$(error )
endif
endif
# Flashing related config
ifneq ($(FQBN),)
KALEIDOSCOPE_DEVICE_PORT ?= $(shell $(ARDUINO_CLI) board list --format=text | grep $(FQBN) |cut -d' ' -f 1)
endif
flashing_instructions := $(shell printf $(call _arduino_prop,build.flashing_instructions))
ifeq ($(flashing_instructions),)
flashing_instruction := "If your keyboard needs you to do something to put it in flashing mode, do that now."
endif
DEFAULT_GOAL: compile
#$(SKETCH_FILE_PATH):
# @: # dummy recipe for the sketch file
.PHONY: compile configure-arduino-cli install-arduino-core-kaleidoscope install-arduino-core-avr
.PHONY: disassemble decompile size-map flash clean all test
all: compile
@: ## Do not remove this line, otherwise `make all` will trigger the `%` rule too.
disassemble: ${ELF_FILE_PATH}
$(call _arduino_prop,compiler.objdump.cmd) \
$(call _arduino_prop,compiler.objdump.flags) \
"${ELF_FILE_PATH}"
size-map: ${ELF_FILE_PATH}
$(call _arduino_prop,compiler.size-map.cmd) \
$(call _arduino_prop,compiler.size-map.flags) \
"${ELF_FILE_PATH}"
flash: ${HEX_FILE_PATH}
${ELF_FILE_PATH}: compile
${HEX_FILE_PATH}: compile
BOOTLOADER_PATH := $(call _arduino_prop,runtime.platform.path)/bootloaders/$(call _arduino_prop,bootloader.file)
hex-with-bootloader: ${HEX_FILE_PATH}
$(QUIET) awk '/^:00000001FF/ == 0' "${HEX_FILE_PATH}" >"${HEX_FILE_WITH_BOOTLOADER_PATH}"
$(QUIET) cat "${BOOTLOADER_PATH}" >>"${HEX_FILE_WITH_BOOTLOADER_PATH}"
$(QUIET) ln -sf -- "${OUTPUT_FILE_PREFIX}-with-bootloader.hex" "${OUTPUT_PATH}/${SKETCH_BASE_NAME}-latest-with-bootloader.hex"
$(info Combined firmware and bootloader are now at)
$(info ${HEX_FILE_WITH_BOOTLOADER_PATH})
$(info )
$(info Make sure you have the bootloader version you expect.)
$(info )
$(info )
$(info And TEST THIS ON REAL HARDWARE BEFORE YOU GIVE IT TO ANYONE.)
clean:
$(QUIET) rm -rf -- "${OUTPUT_PATH}"/*
ifneq ($(LOCAL_CFLAGS),)
local_cflags_property = --build-properties "compiler.cpp.extra_flags=${LOCAL_CFLAGS}"
else
local_cflags_property =
endif
compile:
$(QUIET) install -d "${OUTPUT_PATH}"
$(QUIET) $(ARDUINO_CLI) compile --fqbn "${FQBN}" ${ARDUINO_VERBOSE} --warnings all ${ccache_wrapper_property} ${local_cflags_property} \
--libraries "${KALEIDOSCOPE_PLATFORM_LIB_DIR}" \
--build-path "${BUILD_PATH}" \
--output-dir "${OUTPUT_PATH}" \
--build-cache-path "${CORE_CACHE_PATH}" \
"${SKETCH_FILE_PATH}"
ifeq ($(LIBONLY),)
$(QUIET) cp "${BUILD_PATH}/${SKETCH_FILE_NAME}.hex" "${HEX_FILE_PATH}"
$(QUIET) cp "${BUILD_PATH}/${SKETCH_FILE_NAME}.elf" "${ELF_FILE_PATH}"
$(QUIET) ln -sf "${OUTPUT_FILE_PREFIX}.hex" "${OUTPUT_PATH}/${SKETCH_BASE_NAME}-latest.hex"
$(QUIET) ln -sf "${OUTPUT_FILE_PREFIX}.elf" "${OUTPUT_PATH}/${SKETCH_BASE_NAME}-latest.elf"
else
$(QUIET) cp "${BUILD_PATH}/${SKETCH_FILE_NAME}.a" "${LIB_FILE_PATH}"
$(QUIET) ln -sf "${OUTPUT_FILE_PREFIX}.a" "${OUTPUT_PATH}/${SKETCH_BASE_NAME}-latest.a"
endif
ifneq ($(VERBOSE),)
$(info Build artifacts can be found in ${BUILD_PATH})
endif
#TODO (arduino team) I'd love to do this with their json output
#but it's short some of the data we kind of need
flash:
ifeq ($(KALEIDOSCOPE_DEVICE_PORT),)
$(info ERROR: Unable to detect keyboard serial port.)
$(info )
$(info Arduino should autodetect it, but you could also set )
$(info KALEIDOSCOPE_DEVICE_PORt to your keyboard's serial port.)
$(info )
$(error )
endif
$(info $(flashing_instructions))
$(info )
$(info When you're ready to proceed, press 'Enter'.)
$(info )
@$(shell read)
$(QUIET) $(ARDUINO_CLI) upload --fqbn $(FQBN) \
--input-dir "${OUTPUT_PATH}" \
--port $(KALEIDOSCOPE_DEVICE_PORT) $(ARDUINO_VERBOSE)

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -1,24 +0,0 @@
flash_over_usb() {
sleep 1s
echo "Please reset your keyboard!"
teensy_loader_cli --mcu "${MCU}" -w "${HEX_FILE_PATH}"
}
flash () {
prepare_to_flash
# This is defined in the (optional) user config.
# shellcheck disable=SC2154
${preFlash_HOOKS}
flash_over_usb || flash_over_usb
# This is defined in the (optional) user config.
# shellcheck disable=SC2154
${postFlash_HOOKS}
}
NO_RESET=1
DEFAULT_SKETCH="ErgoDox"
BOARD="ergodox"

@ -1,55 +1,48 @@
# This stub makefile for a Kaleidoscope example pulls in all the targets # This makefile for a Kaleidoscope sketch pulls in all the targets
# required to build the example # required to build the example
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
SKETCHBOOK_DIR ?= $(HOME)/Documents/Arduino
PACKAGE_DIR ?= $(HOME)/Library/Arduino15 ifneq ($(KALEIDOSCOPE_DIR),)
search_path += $(KALEIDOSCOPE_DIR)
endif
ifneq ($(ARDUINO_DIRECTORIES_USER),)
search_path += $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/libraries/Kaleidoscope
endif
ifeq ($(shell uname -s),Darwin)
search_path += $(HOME)/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
else else
SKETCHBOOK_DIR ?= $(HOME)/Arduino search_path += $(HOME)/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
PACKAGE_DIR ?= $(HOME)/.arduino15
endif endif
sketch_makefile := etc/makefiles/sketch.mk
ARDUINO_INSTALLED_ENV=$(shell ls -dt $(PACKAGE_DIR)/packages/keyboardio/hardware/avr 2>/dev/null |head -n 1) $(foreach candidate, $(search_path), $(if $(wildcard $(candidate)/$(sketch_makefile)), $(eval ks_dir ?= $(candidate))))
MANUALLY_INSTALLED_ENV=$(shell ls -dt $(SKETCHBOOK_DIR)/hardware/keyboardio/avr 2>/dev/null |head -n 1)
ifneq ($(ks_dir),)
$(info Using Kaleidoscope from $(ks_dir))
ifneq ("$(wildcard $(ARDUINO_INSTALLED_ENV)/boards.txt)","") export KALEIDOSCOPE_DIR := $(ks_dir)
include $(ks_dir)/$(sketch_makefile)
ifneq ("$(wildcard $(MANUALLY_INSTALLED_ENV)/boards.txt)","") else
$(info ***************************************************************************) $(info I can't find your Kaleidoscope installation.)
$(info It appears that you have installed two copies of Kaleidoscope. One copy was)
$(info installed using Arduino's "Board Manager", while the other was installed by)
$(info hand, probably using "git".)
$(info )
$(info This will likely cause some trouble as you try to build keyboard firmware)
$(info using Kaleidoscope. You may want to remove either: )
$(info ) $(info )
$(info $(PACKAGE_DIR)/packages/keyboardio/ which was installed using Arduino) $(info I tried looking in:)
$(info ) $(info )
$(info or) $(foreach candidate, $(search_path), $(info $(candidate)))
$(info ) $(info )
$(info $(SKETCHBOOK_DIR)/hardware/keyboardio/ which was installed by hand.) $(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment)
$(info ) $(info variable to the location of your Kaleidoscope directory.)
$(info ***************************************************************************)
$(info )
endif
BOARD_HARDWARE_PATH = $(ARDUINO_INSTALLED_ENV)
KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= build-tools/makefiles/
KALEIDOSCOPE_BUILDER_DIR ?= $(ARDUINO_INSTALLED_ENV)/libraries/Kaleidoscope/bin/
endif endif
BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware null-target:
KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/avr/build-tools/makefiles/ $(info You should never see this message)
@:
include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:ergodox",
"port": ""
}
}

@ -1,26 +0,0 @@
flash_over_usb() {
sleep 1s
dfu-programmer ${MCU} erase
dfu-programmer ${MCU} flash "${HEX_FILE_PATH}"
dfu-programmer ${MCU} start
}
flash () {
prepare_to_flash
# This is defined in the (optional) user config.
# shellcheck disable=SC2154
${preFlash_HOOKS}
flash_over_usb || flash_over_usb
# This is defined in the (optional) user config.
# shellcheck disable=SC2154
${postFlash_HOOKS}
}
NO_RESET=1
DEFAULT_SKETCH="KBD4x"
BOARD="kbd4x"

@ -1,55 +1,48 @@
# This stub makefile for a Kaleidoscope example pulls in all the targets # This makefile for a Kaleidoscope sketch pulls in all the targets
# required to build the example # required to build the example
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
SKETCHBOOK_DIR ?= $(HOME)/Documents/Arduino
PACKAGE_DIR ?= $(HOME)/Library/Arduino15 ifneq ($(KALEIDOSCOPE_DIR),)
search_path += $(KALEIDOSCOPE_DIR)
endif
ifneq ($(ARDUINO_DIRECTORIES_USER),)
search_path += $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/libraries/Kaleidoscope
endif
ifeq ($(shell uname -s),Darwin)
search_path += $(HOME)/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
else else
SKETCHBOOK_DIR ?= $(HOME)/Arduino search_path += $(HOME)/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
PACKAGE_DIR ?= $(HOME)/.arduino15
endif endif
sketch_makefile := etc/makefiles/sketch.mk
ARDUINO_INSTALLED_ENV=$(shell ls -dt $(PACKAGE_DIR)/packages/keyboardio/hardware/avr 2>/dev/null |head -n 1) $(foreach candidate, $(search_path), $(if $(wildcard $(candidate)/$(sketch_makefile)), $(eval ks_dir ?= $(candidate))))
MANUALLY_INSTALLED_ENV=$(shell ls -dt $(SKETCHBOOK_DIR)/hardware/keyboardio/avr 2>/dev/null |head -n 1)
ifneq ($(ks_dir),)
$(info Using Kaleidoscope from $(ks_dir))
ifneq ("$(wildcard $(ARDUINO_INSTALLED_ENV)/boards.txt)","") export KALEIDOSCOPE_DIR := $(ks_dir)
include $(ks_dir)/$(sketch_makefile)
ifneq ("$(wildcard $(MANUALLY_INSTALLED_ENV)/boards.txt)","") else
$(info ***************************************************************************) $(info I can't find your Kaleidoscope installation.)
$(info It appears that you have installed two copies of Kaleidoscope. One copy was)
$(info installed using Arduino's "Board Manager", while the other was installed by)
$(info hand, probably using "git".)
$(info )
$(info This will likely cause some trouble as you try to build keyboard firmware)
$(info using Kaleidoscope. You may want to remove either: )
$(info ) $(info )
$(info $(PACKAGE_DIR)/packages/keyboardio/ which was installed using Arduino) $(info I tried looking in:)
$(info ) $(info )
$(info or) $(foreach candidate, $(search_path), $(info $(candidate)))
$(info ) $(info )
$(info $(SKETCHBOOK_DIR)/hardware/keyboardio/ which was installed by hand.) $(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment)
$(info ) $(info variable to the location of your Kaleidoscope directory.)
$(info ***************************************************************************)
$(info )
endif
BOARD_HARDWARE_PATH = $(ARDUINO_INSTALLED_ENV)
KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= build-tools/makefiles/
KALEIDOSCOPE_BUILDER_DIR ?= $(ARDUINO_INSTALLED_ENV)/libraries/Kaleidoscope/bin/
endif endif
BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware null-target:
KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/avr/build-tools/makefiles/ $(info You should never see this message)
@:
include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:kbd4x",
"port": ""
}
}

@ -1,56 +1,48 @@
# This stub makefile for a Kaleidoscope example pulls in all the targets # This makefile for a Kaleidoscope sketch pulls in all the targets
# required to build the example # required to build the example
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
SKETCHBOOK_DIR ?= $(HOME)/Documents/Arduino
PACKAGE_DIR ?= $(HOME)/Library/Arduino15 ifneq ($(KALEIDOSCOPE_DIR),)
else search_path += $(KALEIDOSCOPE_DIR)
SKETCHBOOK_DIR ?= $(HOME)/Arduino
PACKAGE_DIR ?= $(HOME)/.arduino15
endif endif
ifneq ($(ARDUINO_DIRECTORIES_USER),)
search_path += $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/libraries/Kaleidoscope
endif
ifeq ($(shell uname -s),Darwin)
search_path += $(HOME)/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
else
search_path += $(HOME)/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
endif
ARDUINO_INSTALLED_ENV=$(shell ls -dt $(PACKAGE_DIR)/packages/keyboardio/hardware/avr 2>/dev/null |head -n 1) sketch_makefile := etc/makefiles/sketch.mk
MANUALLY_INSTALLED_ENV=$(shell ls -dt $(SKETCHBOOK_DIR)/hardware/keyboardio/avr 2>/dev/null |head -n 1)
$(foreach candidate, $(search_path), $(if $(wildcard $(candidate)/$(sketch_makefile)), $(eval ks_dir ?= $(candidate))))
ifneq ($(ks_dir),)
ifneq ("$(wildcard $(ARDUINO_INSTALLED_ENV)/boards.txt)","") $(info Using Kaleidoscope from $(ks_dir))
ifneq ("$(wildcard $(MANUALLY_INSTALLED_ENV)/boards.txt)","") export KALEIDOSCOPE_DIR := $(ks_dir)
include $(ks_dir)/$(sketch_makefile)
$(info ***************************************************************************) else
$(info It appears that you have installed two copies of Kaleidoscope. One copy was)
$(info installed using Arduino's "Board Manager", while the other was installed by) $(info I can't find your Kaleidoscope installation.)
$(info hand, probably using "git".)
$(info )
$(info This will likely cause some trouble as you try to build keyboard firmware)
$(info using Kaleidoscope. You may want to remove either: )
$(info )
$(info $(PACKAGE_DIR)/packages/keyboardio/ which was installed using Arduino)
$(info )
$(info or)
$(info ) $(info )
$(info $(SKETCHBOOK_DIR)/hardware/keyboardio/ which was installed by hand.) $(info I tried looking in:)
$(info ) $(info )
$(info ***************************************************************************) $(foreach candidate, $(search_path), $(info $(candidate)))
$(info ) $(info )
$(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment)
$(info variable to the location of your Kaleidoscope directory.)
endif endif
BOARD_HARDWARE_PATH = $(ARDUINO_INSTALLED_ENV)
KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= build-tools/makefiles/
KALEIDOSCOPE_BUILDER_DIR ?= $(ARDUINO_INSTALLED_ENV)/libraries/Kaleidoscope/bin/
endif
BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware
KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/avr/build-tools/makefiles/
include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk null-target:
$(info You should never see this message)
@:

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:keyboardio_atreus",
"port": ""
}
}

@ -1,2 +0,0 @@
BOARD="keyboardio_imago"
SKETCH="Imago"

@ -1,55 +1,48 @@
# This stub makefile for a Kaleidoscope example pulls in all the targets # This makefile for a Kaleidoscope sketch pulls in all the targets
# required to build the example # required to build the example
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
SKETCHBOOK_DIR ?= $(HOME)/Documents/Arduino
PACKAGE_DIR ?= $(HOME)/Library/Arduino15 ifneq ($(KALEIDOSCOPE_DIR),)
search_path += $(KALEIDOSCOPE_DIR)
endif
ifneq ($(ARDUINO_DIRECTORIES_USER),)
search_path += $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/libraries/Kaleidoscope
endif
ifeq ($(shell uname -s),Darwin)
search_path += $(HOME)/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
else else
SKETCHBOOK_DIR ?= $(HOME)/Arduino search_path += $(HOME)/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
PACKAGE_DIR ?= $(HOME)/.arduino15
endif endif
sketch_makefile := etc/makefiles/sketch.mk
ARDUINO_INSTALLED_ENV=$(shell ls -dt $(PACKAGE_DIR)/packages/keyboardio/hardware/avr 2>/dev/null |head -n 1) $(foreach candidate, $(search_path), $(if $(wildcard $(candidate)/$(sketch_makefile)), $(eval ks_dir ?= $(candidate))))
MANUALLY_INSTALLED_ENV=$(shell ls -dt $(SKETCHBOOK_DIR)/hardware/keyboardio/avr 2>/dev/null |head -n 1)
ifneq ($(ks_dir),)
$(info Using Kaleidoscope from $(ks_dir))
ifneq ("$(wildcard $(ARDUINO_INSTALLED_ENV)/boards.txt)","") export KALEIDOSCOPE_DIR := $(ks_dir)
include $(ks_dir)/$(sketch_makefile)
ifneq ("$(wildcard $(MANUALLY_INSTALLED_ENV)/boards.txt)","") else
$(info ***************************************************************************) $(info I can't find your Kaleidoscope installation.)
$(info It appears that you have installed two copies of Kaleidoscope. One copy was)
$(info installed using Arduino's "Board Manager", while the other was installed by)
$(info hand, probably using "git".)
$(info )
$(info This will likely cause some trouble as you try to build keyboard firmware)
$(info using Kaleidoscope. You may want to remove either: )
$(info ) $(info )
$(info $(PACKAGE_DIR)/packages/keyboardio/ which was installed using Arduino) $(info I tried looking in:)
$(info ) $(info )
$(info or) $(foreach candidate, $(search_path), $(info $(candidate)))
$(info ) $(info )
$(info $(SKETCHBOOK_DIR)/hardware/keyboardio/ which was installed by hand.) $(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment)
$(info ) $(info variable to the location of your Kaleidoscope directory.)
$(info ***************************************************************************)
$(info )
endif
BOARD_HARDWARE_PATH = $(ARDUINO_INSTALLED_ENV)
KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= build-tools/makefiles/
KALEIDOSCOPE_BUILDER_DIR ?= $(ARDUINO_INSTALLED_ENV)/libraries/Kaleidoscope/bin/
endif endif
BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware null-target:
KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/avr/build-tools/makefiles/ $(info You should never see this message)
@:
include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:keyboardio_imago",
"port": ""
}
}

@ -1,71 +1,48 @@
# This stub makefile for a Kaleidoscope example pulls in all the targets # This makefile for a Kaleidoscope sketch pulls in all the targets
# required to build the example # required to build the example
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
SKETCHBOOK_DIR ?= $(HOME)/Documents/Arduino
PACKAGE_DIR ?= $(HOME)/Library/Arduino15
else
SKETCHBOOK_DIR ?= $(HOME)/Arduino
PACKAGE_DIR ?= $(HOME)/.arduino15
endif
ARDUINO_INSTALLED_ENV=$(shell ls -dt $(PACKAGE_DIR)/packages/keyboardio/hardware/avr 2>/dev/null |head -n 1)
MANUALLY_INSTALLED_ENV=$(shell ls -dt $(SKETCHBOOK_DIR)/hardware/keyboardio/avr 2>/dev/null |head -n 1)
ifneq ("$(wildcard $(ARDUINO_INSTALLED_ENV)/boards.txt)","") ifneq ($(KALEIDOSCOPE_DIR),)
search_path += $(KALEIDOSCOPE_DIR)
ifneq ("$(wildcard $(MANUALLY_INSTALLED_ENV)/boards.txt)","") endif
$(info ***************************************************************************) ifneq ($(ARDUINO_DIRECTORIES_USER),)
$(info It appears that you have installed two copies of Kaleidoscope. One copy was) search_path += $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/libraries/Kaleidoscope
$(info installed using Arduino's "Board Manager", while the other was installed by) endif
$(info hand, probably using "git".)
$(info )
$(info This will likely cause some trouble as you try to build keyboard firmware)
$(info using Kaleidoscope. You may want to remove either: )
$(info )
$(info $(PACKAGE_DIR)/packages/keyboardio/ which was installed using Arduino)
$(info )
$(info or)
$(info )
$(info $(SKETCHBOOK_DIR)/hardware/keyboardio/ which was installed by hand.)
$(info )
$(info ***************************************************************************)
$(info )
ifeq ($(shell uname -s),Darwin)
search_path += $(HOME)/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
else
search_path += $(HOME)/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
endif endif
BOARD_HARDWARE_PATH = $(ARDUINO_INSTALLED_ENV) sketch_makefile := etc/makefiles/sketch.mk
KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= build-tools/makefiles/
KALEIDOSCOPE_BUILDER_DIR ?= $(ARDUINO_INSTALLED_ENV)/libraries/Kaleidoscope/bin/
endif $(foreach candidate, $(search_path), $(if $(wildcard $(candidate)/$(sketch_makefile)), $(eval ks_dir ?= $(candidate))))
BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware ifneq ($(ks_dir),)
KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/avr/build-tools/makefiles/
ifneq ("$(wildcard $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk)","") $(info Using Kaleidoscope from $(ks_dir))
include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk export KALEIDOSCOPE_DIR := $(ks_dir)
include $(ks_dir)/$(sketch_makefile)
else else
$(info ****************************************************************************) $(info I can't find your Kaleidoscope installation.)
$(info I can't find an installed copy of Kaleidoscope's source code.)
$(info ) $(info )
$(info This usually means you're attempting to build a device's firmware from a git) $(info I tried looking in:)
$(info checkout without having previously told Arduino where to find Kaleidoscope.)
$(info ) $(info )
$(info It is probably the case that you want to move or symlink your git checkout ) $(foreach candidate, $(search_path), $(info $(candidate)))
$(info of the Kaleidoscope bundle to the directory: )
$(info ) $(info )
$(info $(SKETCHBOOK_DIR)/hardware/keyboardio ) $(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment)
$(info ****************************************************************************) $(info variable to the location of your Kaleidoscope directory.)
endif endif
null-target:
$(info You should never see this message)
@:

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -1,2 +0,0 @@
DEFAULT_SKETCH="Planck"
BOARD="planck"

@ -1,55 +1,48 @@
# This stub makefile for a Kaleidoscope example pulls in all the targets # This makefile for a Kaleidoscope sketch pulls in all the targets
# required to build the example # required to build the example
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
SKETCHBOOK_DIR ?= $(HOME)/Documents/Arduino
PACKAGE_DIR ?= $(HOME)/Library/Arduino15 ifneq ($(KALEIDOSCOPE_DIR),)
search_path += $(KALEIDOSCOPE_DIR)
endif
ifneq ($(ARDUINO_DIRECTORIES_USER),)
search_path += $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/libraries/Kaleidoscope
endif
ifeq ($(shell uname -s),Darwin)
search_path += $(HOME)/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
else else
SKETCHBOOK_DIR ?= $(HOME)/Arduino search_path += $(HOME)/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
PACKAGE_DIR ?= $(HOME)/.arduino15
endif endif
sketch_makefile := etc/makefiles/sketch.mk
ARDUINO_INSTALLED_ENV=$(shell ls -dt $(PACKAGE_DIR)/packages/keyboardio/hardware/avr 2>/dev/null |head -n 1) $(foreach candidate, $(search_path), $(if $(wildcard $(candidate)/$(sketch_makefile)), $(eval ks_dir ?= $(candidate))))
MANUALLY_INSTALLED_ENV=$(shell ls -dt $(SKETCHBOOK_DIR)/hardware/keyboardio/avr 2>/dev/null |head -n 1)
ifneq ($(ks_dir),)
$(info Using Kaleidoscope from $(ks_dir))
ifneq ("$(wildcard $(ARDUINO_INSTALLED_ENV)/boards.txt)","") export KALEIDOSCOPE_DIR := $(ks_dir)
include $(ks_dir)/$(sketch_makefile)
ifneq ("$(wildcard $(MANUALLY_INSTALLED_ENV)/boards.txt)","") else
$(info ***************************************************************************) $(info I can't find your Kaleidoscope installation.)
$(info It appears that you have installed two copies of Kaleidoscope. One copy was)
$(info installed using Arduino's "Board Manager", while the other was installed by)
$(info hand, probably using "git".)
$(info )
$(info This will likely cause some trouble as you try to build keyboard firmware)
$(info using Kaleidoscope. You may want to remove either: )
$(info ) $(info )
$(info $(PACKAGE_DIR)/packages/keyboardio/ which was installed using Arduino) $(info I tried looking in:)
$(info ) $(info )
$(info or) $(foreach candidate, $(search_path), $(info $(candidate)))
$(info ) $(info )
$(info $(SKETCHBOOK_DIR)/hardware/keyboardio/ which was installed by hand.) $(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment)
$(info ) $(info variable to the location of your Kaleidoscope directory.)
$(info ***************************************************************************)
$(info )
endif
BOARD_HARDWARE_PATH = $(ARDUINO_INSTALLED_ENV)
KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= build-tools/makefiles/
KALEIDOSCOPE_BUILDER_DIR ?= $(ARDUINO_INSTALLED_ENV)/libraries/Kaleidoscope/bin/
endif endif
BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware null-target:
KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/avr/build-tools/makefiles/ $(info You should never see this message)
@:
include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:planck",
"port": ""
}
}

@ -1,25 +0,0 @@
flash_over_usb() {
sleep 1s
dfu-programmer ${MCU} erase
dfu-programmer ${MCU} flash "${HEX_FILE_PATH}"
dfu-programmer ${MCU} start
}
flash () {
prepare_to_flash
# This is defined in the (optional) user config.
# shellcheck disable=SC2154
${preFlash_HOOKS}
flash_over_usb || flash_over_usb
# This is defined in the (optional) user config.
# shellcheck disable=SC2154
${postFlash_HOOKS}
}
NO_RESET=1
DEFAULT_SKETCH="Splitography"
BOARD="splitography"

@ -1,52 +1,48 @@
# This stub makefile for a Kaleidoscope example pulls in all the targets # This makefile for a Kaleidoscope sketch pulls in all the targets
# required to build the example # required to build the example
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
SKETCHBOOK_DIR ?= $(HOME)/Documents/Arduino
PACKAGE_DIR ?= $(HOME)/Library/Arduino15 ifneq ($(KALEIDOSCOPE_DIR),)
search_path += $(KALEIDOSCOPE_DIR)
endif
ifneq ($(ARDUINO_DIRECTORIES_USER),)
search_path += $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/libraries/Kaleidoscope
endif
ifeq ($(shell uname -s),Darwin)
search_path += $(HOME)/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
else else
SKETCHBOOK_DIR ?= $(HOME)/Arduino search_path += $(HOME)/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
PACKAGE_DIR ?= $(HOME)/.arduino15
endif endif
sketch_makefile := etc/makefiles/sketch.mk
ARDUINO_INSTALLED_ENV=$(shell ls -dt $(PACKAGE_DIR)/packages/keyboardio/hardware/avr 2>/dev/null |head -n 1) $(foreach candidate, $(search_path), $(if $(wildcard $(candidate)/$(sketch_makefile)), $(eval ks_dir ?= $(candidate))))
MANUALLY_INSTALLED_ENV=$(shell ls -dt $(SKETCHBOOK_DIR)/hardware/keyboardio/avr 2>/dev/null |head -n 1)
ifneq ($(ks_dir),)
$(info Using Kaleidoscope from $(ks_dir))
ifneq ("$(wildcard $(ARDUINO_INSTALLED_ENV)/boards.txt)","") export KALEIDOSCOPE_DIR := $(ks_dir)
include $(ks_dir)/$(sketch_makefile)
ifneq ("$(wildcard $(MANUALLY_INSTALLED_ENV)/boards.txt)","") else
$(info ***************************************************************************) $(info I can't find your Kaleidoscope installation.)
$(info It appears that you have installed two copies of Kaleidoscope. One copy was)
$(info installed using Arduino's "Board Manager", while the other was installed by)
$(info hand, probably using "git".)
$(info ) $(info )
$(info This will likely cause some trouble as you try to build keyboard firmware) $(info I tried looking in:)
$(info using Kaleidoscope. You may want to remove either: )
$(info ) $(info )
$(info $(PACKAGE_DIR)/packages/keyboardio/ which was installed using Arduino) $(foreach candidate, $(search_path), $(info $(candidate)))
$(info ) $(info )
$(info or) $(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment)
$(info ) $(info variable to the location of your Kaleidoscope directory.)
$(info $(SKETCHBOOK_DIR)/hardware/keyboardio/ which was installed by hand.)
$(info )
$(info ***************************************************************************)
$(info )
endif
BOARD_HARDWARE_PATH = $(ARDUINO_INSTALLED_ENV)
KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= build-tools/makefiles/
KALEIDOSCOPE_BUILDER_DIR ?= $(ARDUINO_INSTALLED_ENV)/libraries/Kaleidoscope/bin/
endif endif
BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware
KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/avr/build-tools/makefiles/
include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk null-target:
$(info You should never see this message)
@:

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:splitography",
"port": ""
}
}

@ -1,24 +0,0 @@
flash_over_usb() {
sleep 1s
echo "Please reset your keyboard!"
teensy_loader_cli --mcu "${MCU}" -w "${HEX_FILE_PATH}"
}
flash () {
prepare_to_flash
# This is defined in the (optional) user config.
# shellcheck disable=SC2154
${preFlash_HOOKS}
flash_over_usb || flash_over_usb
# This is defined in the (optional) user config.
# shellcheck disable=SC2154
${postFlash_HOOKS}
}
NO_RESET=1
DEFAULT_SKETCH="Atreus"
BOARD="atreus"

@ -1,55 +1,48 @@
# This stub makefile for a Kaleidoscope example pulls in all the targets # This makefile for a Kaleidoscope sketch pulls in all the targets
# required to build the example # required to build the example
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
SKETCHBOOK_DIR ?= $(HOME)/Documents/Arduino
PACKAGE_DIR ?= $(HOME)/Library/Arduino15 ifneq ($(KALEIDOSCOPE_DIR),)
search_path += $(KALEIDOSCOPE_DIR)
endif
ifneq ($(ARDUINO_DIRECTORIES_USER),)
search_path += $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/libraries/Kaleidoscope
endif
ifeq ($(shell uname -s),Darwin)
search_path += $(HOME)/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
else else
SKETCHBOOK_DIR ?= $(HOME)/Arduino search_path += $(HOME)/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
PACKAGE_DIR ?= $(HOME)/.arduino15
endif endif
sketch_makefile := etc/makefiles/sketch.mk
ARDUINO_INSTALLED_ENV=$(shell ls -dt $(PACKAGE_DIR)/packages/keyboardio/hardware/avr 2>/dev/null |head -n 1) $(foreach candidate, $(search_path), $(if $(wildcard $(candidate)/$(sketch_makefile)), $(eval ks_dir ?= $(candidate))))
MANUALLY_INSTALLED_ENV=$(shell ls -dt $(SKETCHBOOK_DIR)/hardware/keyboardio/avr 2>/dev/null |head -n 1)
ifneq ($(ks_dir),)
$(info Using Kaleidoscope from $(ks_dir))
ifneq ("$(wildcard $(ARDUINO_INSTALLED_ENV)/boards.txt)","") export KALEIDOSCOPE_DIR := $(ks_dir)
include $(ks_dir)/$(sketch_makefile)
ifneq ("$(wildcard $(MANUALLY_INSTALLED_ENV)/boards.txt)","") else
$(info ***************************************************************************) $(info I can't find your Kaleidoscope installation.)
$(info It appears that you have installed two copies of Kaleidoscope. One copy was)
$(info installed using Arduino's "Board Manager", while the other was installed by)
$(info hand, probably using "git".)
$(info )
$(info This will likely cause some trouble as you try to build keyboard firmware)
$(info using Kaleidoscope. You may want to remove either: )
$(info ) $(info )
$(info $(PACKAGE_DIR)/packages/keyboardio/ which was installed using Arduino) $(info I tried looking in:)
$(info ) $(info )
$(info or) $(foreach candidate, $(search_path), $(info $(candidate)))
$(info ) $(info )
$(info $(SKETCHBOOK_DIR)/hardware/keyboardio/ which was installed by hand.) $(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment)
$(info ) $(info variable to the location of your Kaleidoscope directory.)
$(info ***************************************************************************)
$(info )
endif
BOARD_HARDWARE_PATH = $(ARDUINO_INSTALLED_ENV)
KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= build-tools/makefiles/
KALEIDOSCOPE_BUILDER_DIR ?= $(ARDUINO_INSTALLED_ENV)/libraries/Kaleidoscope/bin/
endif endif
BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware null-target:
KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/avr/build-tools/makefiles/ $(info You should never see this message)
@:
include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:atreus",
"port": ""
}
}

@ -1,2 +0,0 @@
DEFAULT_SKETCH="ButterStick"
BOARD="gheavy_butterstick"

@ -1,55 +1,48 @@
# This stub makefile for a Kaleidoscope example pulls in all the targets # This makefile for a Kaleidoscope sketch pulls in all the targets
# required to build the example # required to build the example
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
SKETCHBOOK_DIR ?= $(HOME)/Documents/Arduino
PACKAGE_DIR ?= $(HOME)/Library/Arduino15 ifneq ($(KALEIDOSCOPE_DIR),)
search_path += $(KALEIDOSCOPE_DIR)
endif
ifneq ($(ARDUINO_DIRECTORIES_USER),)
search_path += $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/libraries/Kaleidoscope
endif
ifeq ($(shell uname -s),Darwin)
search_path += $(HOME)/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
else else
SKETCHBOOK_DIR ?= $(HOME)/Arduino search_path += $(HOME)/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
PACKAGE_DIR ?= $(HOME)/.arduino15
endif endif
sketch_makefile := etc/makefiles/sketch.mk
ARDUINO_INSTALLED_ENV=$(shell ls -dt $(PACKAGE_DIR)/packages/keyboardio/hardware/avr 2>/dev/null |head -n 1) $(foreach candidate, $(search_path), $(if $(wildcard $(candidate)/$(sketch_makefile)), $(eval ks_dir ?= $(candidate))))
MANUALLY_INSTALLED_ENV=$(shell ls -dt $(SKETCHBOOK_DIR)/hardware/keyboardio/avr 2>/dev/null |head -n 1)
ifneq ($(ks_dir),)
$(info Using Kaleidoscope from $(ks_dir))
ifneq ("$(wildcard $(ARDUINO_INSTALLED_ENV)/boards.txt)","") export KALEIDOSCOPE_DIR := $(ks_dir)
include $(ks_dir)/$(sketch_makefile)
ifneq ("$(wildcard $(MANUALLY_INSTALLED_ENV)/boards.txt)","") else
$(info ***************************************************************************) $(info I can't find your Kaleidoscope installation.)
$(info It appears that you have installed two copies of Kaleidoscope. One copy was)
$(info installed using Arduino's "Board Manager", while the other was installed by)
$(info hand, probably using "git".)
$(info )
$(info This will likely cause some trouble as you try to build keyboard firmware)
$(info using Kaleidoscope. You may want to remove either: )
$(info ) $(info )
$(info $(PACKAGE_DIR)/packages/keyboardio/ which was installed using Arduino) $(info I tried looking in:)
$(info ) $(info )
$(info or) $(foreach candidate, $(search_path), $(info $(candidate)))
$(info ) $(info )
$(info $(SKETCHBOOK_DIR)/hardware/keyboardio/ which was installed by hand.) $(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment)
$(info ) $(info variable to the location of your Kaleidoscope directory.)
$(info ***************************************************************************)
$(info )
endif
BOARD_HARDWARE_PATH = $(ARDUINO_INSTALLED_ENV)
KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= build-tools/makefiles/
KALEIDOSCOPE_BUILDER_DIR ?= $(ARDUINO_INSTALLED_ENV)/libraries/Kaleidoscope/bin/
endif endif
BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware null-target:
KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/avr/build-tools/makefiles/ $(info You should never see this message)
@:
include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:gheavy_butterstick",
"port": ""
}
}

@ -1,2 +0,0 @@
DEFAULT_SKETCH="FaunchPad"
BOARD="gheavy_faunchpad"

@ -1,55 +1,48 @@
# This stub makefile for a Kaleidoscope example pulls in all the targets # This makefile for a Kaleidoscope sketch pulls in all the targets
# required to build the example # required to build the example
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
SKETCHBOOK_DIR ?= $(HOME)/Documents/Arduino
PACKAGE_DIR ?= $(HOME)/Library/Arduino15 ifneq ($(KALEIDOSCOPE_DIR),)
search_path += $(KALEIDOSCOPE_DIR)
endif
ifneq ($(ARDUINO_DIRECTORIES_USER),)
search_path += $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/libraries/Kaleidoscope
endif
ifeq ($(shell uname -s),Darwin)
search_path += $(HOME)/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
else else
SKETCHBOOK_DIR ?= $(HOME)/Arduino search_path += $(HOME)/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
PACKAGE_DIR ?= $(HOME)/.arduino15
endif endif
sketch_makefile := etc/makefiles/sketch.mk
ARDUINO_INSTALLED_ENV=$(shell ls -dt $(PACKAGE_DIR)/packages/keyboardio/hardware/avr 2>/dev/null |head -n 1) $(foreach candidate, $(search_path), $(if $(wildcard $(candidate)/$(sketch_makefile)), $(eval ks_dir ?= $(candidate))))
MANUALLY_INSTALLED_ENV=$(shell ls -dt $(SKETCHBOOK_DIR)/hardware/keyboardio/avr 2>/dev/null |head -n 1)
ifneq ($(ks_dir),)
$(info Using Kaleidoscope from $(ks_dir))
ifneq ("$(wildcard $(ARDUINO_INSTALLED_ENV)/boards.txt)","") export KALEIDOSCOPE_DIR := $(ks_dir)
include $(ks_dir)/$(sketch_makefile)
ifneq ("$(wildcard $(MANUALLY_INSTALLED_ENV)/boards.txt)","") else
$(info ***************************************************************************) $(info I can't find your Kaleidoscope installation.)
$(info It appears that you have installed two copies of Kaleidoscope. One copy was)
$(info installed using Arduino's "Board Manager", while the other was installed by)
$(info hand, probably using "git".)
$(info )
$(info This will likely cause some trouble as you try to build keyboard firmware)
$(info using Kaleidoscope. You may want to remove either: )
$(info ) $(info )
$(info $(PACKAGE_DIR)/packages/keyboardio/ which was installed using Arduino) $(info I tried looking in:)
$(info ) $(info )
$(info or) $(foreach candidate, $(search_path), $(info $(candidate)))
$(info ) $(info )
$(info $(SKETCHBOOK_DIR)/hardware/keyboardio/ which was installed by hand.) $(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment)
$(info ) $(info variable to the location of your Kaleidoscope directory.)
$(info ***************************************************************************)
$(info )
endif
BOARD_HARDWARE_PATH = $(ARDUINO_INSTALLED_ENV)
KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= build-tools/makefiles/
KALEIDOSCOPE_BUILDER_DIR ?= $(ARDUINO_INSTALLED_ENV)/libraries/Kaleidoscope/bin/
endif endif
BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware null-target:
KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/avr/build-tools/makefiles/ $(info You should never see this message)
@:
include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:gheavy_faunchpad",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -1,55 +1,48 @@
# This stub makefile for a Kaleidoscope example pulls in all the targets # This makefile for a Kaleidoscope sketch pulls in all the targets
# required to build the example # required to build the example
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
SKETCHBOOK_DIR ?= $(HOME)/Documents/Arduino
PACKAGE_DIR ?= $(HOME)/Library/Arduino15 ifneq ($(KALEIDOSCOPE_DIR),)
search_path += $(KALEIDOSCOPE_DIR)
endif
ifneq ($(ARDUINO_DIRECTORIES_USER),)
search_path += $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/libraries/Kaleidoscope
endif
ifeq ($(shell uname -s),Darwin)
search_path += $(HOME)/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
else else
SKETCHBOOK_DIR ?= $(HOME)/Arduino search_path += $(HOME)/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
PACKAGE_DIR ?= $(HOME)/.arduino15
endif endif
sketch_makefile := etc/makefiles/sketch.mk
ARDUINO_INSTALLED_ENV=$(shell ls -dt $(PACKAGE_DIR)/packages/keyboardio/hardware/avr 2>/dev/null |head -n 1) $(foreach candidate, $(search_path), $(if $(wildcard $(candidate)/$(sketch_makefile)), $(eval ks_dir ?= $(candidate))))
MANUALLY_INSTALLED_ENV=$(shell ls -dt $(SKETCHBOOK_DIR)/hardware/keyboardio/avr 2>/dev/null |head -n 1)
ifneq ($(ks_dir),)
$(info Using Kaleidoscope from $(ks_dir))
ifneq ("$(wildcard $(ARDUINO_INSTALLED_ENV)/boards.txt)","") export KALEIDOSCOPE_DIR := $(ks_dir)
include $(ks_dir)/$(sketch_makefile)
ifneq ("$(wildcard $(MANUALLY_INSTALLED_ENV)/boards.txt)","") else
$(info ***************************************************************************) $(info I can't find your Kaleidoscope installation.)
$(info It appears that you have installed two copies of Kaleidoscope. One copy was)
$(info installed using Arduino's "Board Manager", while the other was installed by)
$(info hand, probably using "git".)
$(info )
$(info This will likely cause some trouble as you try to build keyboard firmware)
$(info using Kaleidoscope. You may want to remove either: )
$(info ) $(info )
$(info $(PACKAGE_DIR)/packages/keyboardio/ which was installed using Arduino) $(info I tried looking in:)
$(info ) $(info )
$(info or) $(foreach candidate, $(search_path), $(info $(candidate)))
$(info ) $(info )
$(info $(SKETCHBOOK_DIR)/hardware/keyboardio/ which was installed by hand.) $(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment)
$(info ) $(info variable to the location of your Kaleidoscope directory.)
$(info ***************************************************************************)
$(info )
endif
BOARD_HARDWARE_PATH = $(ARDUINO_INSTALLED_ENV)
KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= build-tools/makefiles/
KALEIDOSCOPE_BUILDER_DIR ?= $(ARDUINO_INSTALLED_ENV)/libraries/Kaleidoscope/bin/
endif endif
BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware null-target:
KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/avr/build-tools/makefiles/ $(info You should never see this message)
@:
include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -0,0 +1,6 @@
{
"cpu": {
"fqbn": "keyboardio:avr:model01",
"port": ""
}
}

@ -1,5 +1,2 @@
**/bin/
**/lib/
**/obj/
/googletest/googletest/generated/ /googletest/googletest/generated/
/googletest/build/ /googletest/build/

@ -1,73 +1,48 @@
# This stub makefile for a Kaleidoscope plugin pulls in # This makefile for a Kaleidoscope sketch pulls in all the targets
# all targets from the Kaleidoscope-Plugin library # required to build the example
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
SKETCHBOOK_DIR ?= $(HOME)/Documents/Arduino
PACKAGE_DIR ?= $(HOME)/Library/Arduino15
else
SKETCHBOOK_DIR ?= $(HOME)/Arduino
PACKAGE_DIR ?= $(HOME)/.arduino15
endif
ARDUINO_INSTALLED_ENV=$(shell ls -dt $(PACKAGE_DIR)/packages/keyboardio/hardware/avr 2>/dev/null |head -n 1)
MANUALLY_INSTALLED_ENV=$(shell ls -dt $(SKETCHBOOK_DIR)/hardware/keyboardio/avr 2>/dev/null |head -n 1)
ifneq ("$(wildcard $(ARDUINO_INSTALLED_ENV)/boards.txt)","")
ifneq ("$(wildcard $(MANUALLY_INSTALLED_ENV)/boards.txt)","") ifneq ($(KALEIDOSCOPE_DIR),)
search_path += $(KALEIDOSCOPE_DIR)
$(info ***************************************************************************) endif
$(info It appears that you have installed two copies of Kaleidoscope. One copy was)
$(info installed using Arduino's "Board Manager", while the other was installed by)
$(info hand, probably using "git".)
$(info )
$(info This will likely cause some trouble as you try to build keyboard firmware)
$(info using Kaleidoscope. You may want to remove either: )
$(info )
$(info $(PACKAGE_DIR)/packages/keyboardio/ which was installed using Arduino)
$(info )
$(info or)
$(info )
$(info $(SKETCHBOOK_DIR)/hardware/keyboardio/ which was installed by hand.)
$(info )
$(info ***************************************************************************)
$(info )
ifneq ($(ARDUINO_DIRECTORIES_USER),)
search_path += $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/libraries/Kaleidoscope
endif endif
BOARD_HARDWARE_PATH = $(ARDUINO_INSTALLED_ENV) ifeq ($(shell uname -s),Darwin)
KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= build-tools/makefiles/ search_path += $(HOME)/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
KALEIDOSCOPE_BUILDER_DIR ?= $(ARDUINO_INSTALLED_ENV)/libraries/Kaleidoscope/bin/ else
search_path += $(HOME)/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
endif
sketch_makefile := etc/makefiles/sketch.mk
$(foreach candidate, $(search_path), $(if $(wildcard $(candidate)/$(sketch_makefile)), $(eval ks_dir ?= $(candidate))))
endif ifneq ($(ks_dir),)
$(info Using Kaleidoscope from $(ks_dir))
BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware export KALEIDOSCOPE_DIR := $(ks_dir)
KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/build-tools/makefiles/ include $(ks_dir)/$(sketch_makefile)
# If Kaleidoscope's Arduino libraries cannot be found, e.g. because else
# they reside outside of SKETCHBOOK_DIR, we fall back to assuming that
# the hardware directory can be determined in relation to the position of
# this Makefile.
ifeq ("$(wildcard $(BOARD_HARDWARE_PATH)/keyboardio/build-tools/makefiles/rules.mk)","")
# Determine the path of this Makefile
MKFILE_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
BOARD_HARDWARE_PATH = $(MKFILE_DIR)/../../../../../..
endif
ifeq ("$(wildcard $(BOARD_HARDWARE_PATH)/keyboardio/build-tools/makefiles/rules.mk)","") $(info I can't find your Kaleidoscope installation.)
$(info ***************************************************************************) $(info )
$(info Unable to autodetect a proper BOARD_HARDWARE_PATH. Please define it manually.) $(info I tried looking in:)
$(info ***************************************************************************)
$(info ) $(info )
$(foreach candidate, $(search_path), $(info $(candidate)))
$(info )
$(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment)
$(info variable to the location of your Kaleidoscope directory.)
endif endif
include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk
null-target:
$(info You should never see this message)
@:

@ -1,51 +1,41 @@
top_dir := $(dir $(lastword ${MAKEFILE_LIST}))../.. mkfile_dir := $(dir $(lastword ${MAKEFILE_LIST}))
build_dir := ${top_dir}/_build top_dir := $(abspath $(mkfile_dir)../..)
ifndef BOARD_HARDWARE_PATH include $(mkfile_dir)/shared.mk
bundle_path = ${top_dir}/..
else
bundle_path = ${BOARD_HARDWARE_PATH}/keyboardio/avr/libraries build_dir := ${top_dir}/_build
endif
LIB_DIR := ${build_dir}/lib LIB_DIR := ${build_dir}/lib
OBJ_DIR := ${build_dir}/obj OBJ_DIR := ${build_dir}/obj
CXX_FILES := $(wildcard ${top_dir}/testing/*.cpp) CXX_FILES := $(sort $(wildcard ${top_dir}/testing/*.cpp))
H_FILES := $(wildcard ${top_dir}/testing/*.h) H_FILES := $(sort $(wildcard ${top_dir}/testing/*.h))
BARE_CXX_FILES := $(foreach path,${CXX_FILES},$(notdir ${path})) BARE_CXX_FILES := $(foreach path,${CXX_FILES},$(notdir ${path}))
OBJ_FILES := $(patsubst %.cpp,${OBJ_DIR}/%.o,$(BARE_CXX_FILES)) OBJ_FILES := $(patsubst %.cpp,${OBJ_DIR}/%.o,$(BARE_CXX_FILES))
LIB_FILE := libcommon.a LIB_FILE := libcommon.a
ifneq ($(KALEIDOSCOPE_CCACHE),)
COMPILER_WRAPPER := ccache
endif
.PHONY: all .PHONY: all
DEFAULT_GOAL: all
all: ${OBJ_FILES} ${LIB_DIR}/${LIB_FILE} all: ${OBJ_FILES} ${LIB_DIR}/${LIB_FILE}
${LIB_DIR}/${LIB_FILE}: ${OBJ_FILES} ${LIB_DIR}/${LIB_FILE}: ${OBJ_FILES}
@install -d "${LIB_DIR}" $(QUIET) install -d "${LIB_DIR}"
ar rcs "${LIB_DIR}/${LIB_FILE}" ${OBJ_FILES} $(QUIET) $(call _arduino_prop,compiler.ar.cmd) $(call _arduino_prop,compiler.ar.flags) "${LIB_DIR}/${LIB_FILE}" ${OBJ_FILES}
${OBJ_DIR}/%.o: ${top_dir}/testing/%.cpp ${H_FILES} ${OBJ_DIR}/%.o: ${top_dir}/testing/%.cpp ${H_FILES}
@echo "compile $@" $(info compile $@)
@install -d "${OBJ_DIR}" $(QUIET) install -d "${OBJ_DIR}"
g++ -o "$@" -c \ $(QUIET) $(COMPILER_WRAPPER) $(call _arduino_prop,compiler.cpp.cmd) -o "$@" -c -std=c++14 ${shared_includes} ${shared_defines} $<
-std=c++14 \
-I${top_dir} \
-I${top_dir}/src \
-I${bundle_path}/../../virtual/cores/arduino \
-I${bundle_path}/Kaleidoscope-HIDAdaptor-KeyboardioHID/src \
-I${bundle_path}/KeyboardioHID/src \
-I${top_dir}/testing/googletest/googlemock/include \
-I${top_dir}/testing/googletest/googletest/include \
-DARDUINO=10607 \
-DARDUINO_ARCH_VIRTUAL \
-DARDUINO_AVR_MODEL01 \
'-DKALEIDOSCOPE_HARDWARE_H="Kaleidoscope-Hardware-Model01.h"' \
-DKALEIDOSCOPE_VIRTUAL_BUILD=1 \
-DKEYBOARDIOHID_BUILD_WITHOUT_HID=1 \
-DUSBCON=dummy \
-DARDUINO_ARCH_AVR=1 \
'-DUSB_PRODUCT="Model 01"' \
$<
clean: clean:
rm -rf "${build_dir}" $(QUIET) rm -rf -- "${build_dir}"
include $(top_dir)/etc/makefiles/arduino-cli.mk

@ -0,0 +1,21 @@
arduino_platform_path := ${ARDUINO_DIRECTORIES_USER}/hardware/keyboardio/virtual/
shared_defines := \
-DARDUINO=10607 \
-DARDUINO_ARCH_VIRTUAL \
-DKALEIDOSCOPE_VIRTUAL_BUILD=1 \
-DKEYBOARDIOHID_BUILD_WITHOUT_HID=1 \
-DUSBCON=dummy \
-DARDUINO_ARCH_AVR=1 \
-DARDUINO_AVR_MODEL01 \
'-DKALEIDOSCOPE_HARDWARE_H="Kaleidoscope-Hardware-Model01.h"' \
'-DUSB_PRODUCT="Model 01"'
shared_includes := \
-I${top_dir} \
-I${top_dir}/src \
-I${arduino_platform_path}/cores/arduino \
-I${arduino_platform_path}/libraries/KeyboardioHID/src \
-I${top_dir}/testing/googletest/googlemock/include \
-I${top_dir}/testing/googletest/googletest/include \

@ -1,5 +1,7 @@
top_dir := $(dir $(lastword ${MAKEFILE_LIST}))../.. mkfile_dir := $(dir $(lastword ${MAKEFILE_LIST}))
top_dir := $(abspath $(mkfile_dir)../..)
include $(mkfile_dir)/shared.mk
build_dir := ${top_dir}/_build/${testcase} build_dir := ${top_dir}/_build/${testcase}
@ -9,13 +11,20 @@ BIN_DIR := ${build_dir}/bin
COMMON_LIB_DIR := ${top_dir}/_build/lib COMMON_LIB_DIR := ${top_dir}/_build/lib
include $(top_dir)/etc/makefiles/arduino-cli.mk
ifneq ($(KALEIDOSCOPE_CCACHE),)
COMPILER_WRAPPER := ccache
endif
SRC_DIR := test SRC_DIR := test
SKETCH_FILE=$(wildcard *.ino) SKETCH_FILE=$(wildcard *.ino)
BIN_FILE=$(subst .ino,,$(SKETCH_FILE)) BIN_FILE=$(subst .ino,,$(SKETCH_FILE))
LIB_FILE=${BIN_FILE}-latest.a LIB_FILE=${BIN_FILE}-latest.a
TEST_FILES=$(wildcard $(SRC_DIR)/*.cpp) TEST_FILES=$(sort $(wildcard $(SRC_DIR)/*.cpp))
# If we have a ktest file and no generated testcase, # If we have a ktest file and no generated testcase,
# we want to turn it into a generated testcase # we want to turn it into a generated testcase
@ -28,48 +37,31 @@ TEST_FILES += $(SRC_DIR)/generated-testcase.cpp
endif endif
endif endif
.DEFAULT_GOAL := build
TEST_OBJS=$(patsubst $(SRC_DIR)/%.cpp,${OBJ_DIR}/%.o,$(TEST_FILES)) TEST_OBJS=$(patsubst $(SRC_DIR)/%.cpp,${OBJ_DIR}/%.o,$(TEST_FILES))
ifndef BOARD_HARDWARE_PATH
bundle_path = ${top_dir}/..
else
bundle_path = ${BOARD_HARDWARE_PATH}/keyboardio/avr/libraries
endif
build: ${BIN_DIR}/${BIN_FILE} compile-sketch build: ${BIN_DIR}/${BIN_FILE} compile-sketch
all: run all: run
run: ${BIN_DIR}/${BIN_FILE} run: ${BIN_DIR}/${BIN_FILE}
@echo "run" $(QUIET) "${BIN_DIR}/${BIN_FILE}" -t -q
"${BIN_DIR}/${BIN_FILE}" -t -q
${BIN_DIR}/${BIN_FILE}: ${TEST_OBJS} ${BIN_DIR}/${BIN_FILE}: ${TEST_OBJS}
# We force sketch recompiliation because otherwise, make won't pick up changes to...anything on the arduino side # We force sketch recompiliation because otherwise, make won't pick up changes to...anything on the arduino side
compile-sketch: compile-sketch: ${TEST_OBJS}
@echo "link" @install -d "${BIN_DIR}" "${LIB_DIR}"
install -d "${BIN_DIR}" "${LIB_DIR}" $(QUIET) env LIBONLY=yes VERBOSE=${VERBOSE} \
env LIBONLY=yes \
LOCAL_CFLAGS='"-I$(shell pwd)"' \
OUTPUT_PATH="${LIB_DIR}" \ OUTPUT_PATH="${LIB_DIR}" \
VERBOSE=${VERBOSE} \
ARCH=virtual DEFAULT_SKETCH=sketch \
$(MAKE) -f ${top_dir}/testing/makefiles/delegate.mk compile $(MAKE) -f ${top_dir}/testing/makefiles/delegate.mk compile
g++ -o "${BIN_DIR}/${BIN_FILE}" \ $(QUIET) $(COMPILER_WRAPPER) $(call _arduino_prop,compiler.cpp.cmd) -o "${BIN_DIR}/${BIN_FILE}" \
-lpthread \ -lpthread -g -w ${TEST_OBJS} \
-g \ -L"${COMMON_LIB_DIR}" -lcommon \
-w \
${TEST_OBJS} \
-L"${COMMON_LIB_DIR}" \
-lcommon \
"${LIB_DIR}/${LIB_FILE}" \ "${LIB_DIR}/${LIB_FILE}" \
-L"${top_dir}/testing/googletest/build/lib" \ -L"${top_dir}/testing/googletest/build/lib" \
-lgtest \ -lgtest -lgmock -lpthread -lm
-lgmock \
-lpthread \
-lm
# If we have a test.ktest file, it should be processed into a c++ testcase # If we have a test.ktest file, it should be processed into a c++ testcase
@ -79,37 +71,20 @@ generate-testcase: $(if $(HAS_KTEST_FILE), ${SRC_DIR}/generated-testcase.cpp)
${SRC_DIR}/generated-testcase.cpp: test.ktest ${SRC_DIR}/generated-testcase.cpp: test.ktest
ifneq (,$(wildcard test.ktest)) ifneq (,$(wildcard test.ktest))
@echo "Compiling ${testcase} ktest script into ${SRC_DIR}/generated-testcase.cpp" $(info Compiling ${testcase} ktest script into ${SRC_DIR}/generated-testcase.cpp)
install -d "${SRC_DIR}" $(QUIET) install -d "${SRC_DIR}"
perl ${top_dir}/testing/bin/ktest-to-cxx \ $(QUIET) perl ${top_dir}/testing/bin/ktest-to-cxx \
--ktest=test.ktest \ --ktest=test.ktest \
--cxx=${SRC_DIR}/generated-testcase.cpp --cxx=${SRC_DIR}/generated-testcase.cpp
endif endif
${OBJ_DIR}/%.o: ${SRC_DIR}/%.cpp ${OBJ_DIR}/%.o: ${SRC_DIR}/%.cpp
@echo "compile $@" $(QUIET) install -d "${OBJ_DIR}"
install -d "${OBJ_DIR}" $(QUIET) $(COMPILER_WRAPPER) $(call _arduino_prop,compiler.cpp.cmd) -o "$@" -c -std=c++14 \
g++ -o "$@" -c \ ${shared_includes} ${shared_defines} $<
-std=c++14 \
-I${top_dir} \
-I${top_dir}/src \
-I${bundle_path}/../../virtual/cores/arduino \
-I${bundle_path}/KeyboardioHID/src \
-I${top_dir}/testing/googletest/googlemock/include \
-I${top_dir}/testing/googletest/googletest/include \
-DARDUINO=10607 \
-DARDUINO_ARCH_VIRTUAL \
-DARDUINO_AVR_MODEL01 \
'-DKALEIDOSCOPE_HARDWARE_H="Kaleidoscope-Hardware-Model01.h"' \
-DKALEIDOSCOPE_VIRTUAL_BUILD=1 \
-DKEYBOARDIOHID_BUILD_WITHOUT_HID=1 \
-DUSBCON=dummy \
-DARDUINO_ARCH_AVR=1 \
'-DUSB_PRODUCT="Model 01"' \
$<
clean: clean:
rm -f "${SRC_DIR}/generated-testcase.cpp" $(QUIET) rm -f -- "${SRC_DIR}/generated-testcase.cpp"
rm -rf "${build_dir}" $(QUIET) rm -rf -- "${build_dir}"
.PHONY: clean run all build .PHONY: clean run all build

@ -1,39 +1,56 @@
top_dir := $(abspath $(dir $(lastword ${MAKEFILE_LIST}))..)
tests_dir := $(abspath $(dir $(lastword ${MAKEFILE_LIST})))
top_dir := $(abspath $(tests_dir)/..)
build_dir := ${top_dir}/_build build_dir := ${top_dir}/_build
LIB_DIR := ${build_dir}/lib LIB_DIR := ${build_dir}/lib
libcommon_a := ${top_dir}/_build/lib/libcommon.a libcommon_a := ${top_dir}/_build/lib/libcommon.a
TEST_PATH ?= tests/ TEST_PATH ?= ./
export FQBN ?= keyboardio:virtual:model01
TESTS ?= $(shell cd $(tests_dir); find ${TEST_PATH} -name '*.ino' -exec dirname {} \;)
# If we start off in tests to run make all, the sketch makefiles guess the wrong location for
# Kaliedoscope's makefiles
KALEIDOSCOPE_ETC_DIR ?= $(top_dir)/etc
.PHONY: clean cmake-clean all googletest generate-testcases
TESTS ?= $(shell find ${top_dir}/${TEST_PATH} -name 'sketch.ino' -exec dirname {} \;)
.PHONY: clean cmake-clean all googletest
generate-testcases: generate-testcases:
@for test in ${TESTS}; do \ @for test in ${TESTS}; do \
${MAKE} -s -f ${top_dir}/testing/makefiles/testcase.mk -C $${test} top_dir=${top_dir} testcase=$${test} generate-testcase; \ ${MAKE} -s -f ${top_dir}/testing/makefiles/testcase.mk -C $${test} testcase=$${test} generate-testcase; \
done done
all: ${TESTS} all: ${TESTS} run-all
run-all: ${TESTS}
@for test in ${TESTS}; do \ @for test in ${TESTS}; do \
${MAKE} -s -f ${top_dir}/testing/makefiles/testcase.mk -C $${test} top_dir=${top_dir} testcase=$${test} run; \ ${MAKE} -s -f ${top_dir}/testing/makefiles/testcase.mk -C $${test} testcase=$${test} run; \
done || exit 1 done || exit 1
cmake-clean: cmake-clean:
rm -rf "${top_dir}/testing/googletest/build/*" rm -rf "${top_dir}"/testing/googletest/build/*
clean: cmake-clean clean: cmake-clean
# ${top_dir}/testing/googletest/build/Makefile
@for test in ${TESTS}; do \ @for test in ${TESTS}; do \
${MAKE} -s -f ${top_dir}/testing/makefiles/testcase.mk -C $${test} top_dir=${top_dir} testcase=$${test} clean; \ ${MAKE} -s -f ${top_dir}/testing/makefiles/testcase.mk -C $${test} testcase=$${test} clean; \
done done
rm -rf "${build_dir}"/*
rm -rf "${build_dir}/*"
googletest: ${top_dir}/testing/googletest/build/Makefile googletest: ${top_dir}/testing/googletest/build/Makefile
cd ${top_dir}/testing/googletest/build && $(MAKE) cd ${top_dir}/testing/googletest/build && $(MAKE)
${top_dir}/testing/googletest/build/Makefile: ${top_dir}/testing/googletest/build/Makefile:
$(info googletest Makefile is being remade)
install -d ${top_dir}/testing/googletest/build && cd ${top_dir}/testing/googletest/build && cmake .. install -d ${top_dir}/testing/googletest/build && cd ${top_dir}/testing/googletest/build && cmake ..
${libcommon_a}: ${libcommon_a}:
@ -43,7 +60,7 @@ Makefile:
@: @:
${TESTS}: ${libcommon_a} googletest ${TESTS}: ${libcommon_a} googletest
${MAKE} -f ${top_dir}/testing/makefiles/testcase.mk -C $@ top_dir=${top_dir} testcase=$@ ${MAKE} -f ${top_dir}/testing/makefiles/testcase.mk -C $@ testcase=$@ build
%+run: %+run:
${MAKE} -s -f ${top_dir}/testing/makefiles/testcase.mk -C $* top_dir=${top_dir} testcase=$* run ${MAKE} -s -f ${top_dir}/testing/makefiles/testcase.mk -C $* testcase=$* run

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save