From ae612b8b5cdb5a3d4068ae6b824572b03e0344f4 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Tue, 14 Aug 2018 14:06:43 -0700 Subject: [PATCH] Starting to break out the content of the Arduino-Boards repository into something more multiplatform. --- COPYING | 11 ++++ Makefile | 59 ++++++++++++++++++++++ README.md | 25 +++++++++ avr/boards.txt | 60 ++++++++++++++++++++++ avr/platform.txt | 128 +++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 283 insertions(+) create mode 100644 COPYING create mode 100644 Makefile create mode 100644 README.md create mode 100644 avr/boards.txt create mode 100644 avr/platform.txt diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..03c02a5 --- /dev/null +++ b/COPYING @@ -0,0 +1,11 @@ +This repository should not, itself, contain any substantial source code. + +Most code included herein is included as a git submodule. Each submodule should have its own copyright and license information. + +Any code included in this repository should bear a copyright and license statement. + +Specifically the variants/ directory contains C header files which map between the Arduino core and hardware implementations. Each variant/ carries its own copyright statement. As of this writing, all are licensed under the terms of v2 of the GNU General Public License. + +Makefiles included in this repository are licensed under the terms of the MIT License. + +The boards.txt and platform.txt configuration files are configuration files. We make no copyright claims about them. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..102dc14 --- /dev/null +++ b/Makefile @@ -0,0 +1,59 @@ +# Copyright 2018 Keyboard.io, inc. +# +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + + + +ifeq ($(BOARD_HARDWARE_PATH),) +PLUGIN_TEST_SUPPORT_DIR =? ./build-tools +KALEIDOSCOPE_BUILDER_DIR =? ./libraries/Kaleidoscope/bin/ + +endif + +update-submodules: checkout-submodules + @echo "All Kaleidoscope libraries have been updated from GitHub" + +build-all: travis-test-all + +travis-test-all: travis-install-arduino + TRAVIS_ARDUINO_PATH=$(TRAVIS_ARDUINO_PATH) perl build-tools/quality/test-recursively travis-test + TRAVIS_ARDUINO_PATH=$(TRAVIS_ARDUINO_PATH) perl build-tools/quality/test-recursively cpplint + +checkout-submodules: git-pull + git submodule update --init --recursive + + + +maintainer-update-submodules: + git submodule update --recursive --remote --init + +git-pull: + git pull + +blindly-commit-updates: git-pull maintainer-update-submodules + git commit -a -m 'Blindly pull all plugins up to current' + git push + + +doxygen-generate: + doxygen build-tools/automation/etc/doxygen/doxygen.conf + + +-include build-tools/makefiles/rules.mk diff --git a/README.md b/README.md new file mode 100644 index 0000000..02fe8a7 --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +# Arduino Core for the Keyboardio Model 01 + +This repository contains a number of git submodules. + +As an end-user, you can recursively check out all the referenced modules: + +``` +% make checkout-submodules +``` + +As a maintainer, you can pull all the referenced modules to the latest upstream +tips of the modules' canonical branches: + +``` +% make maintainer-update-submodules +``` + +Do note that in order to commit the changes to the submodules of a given repository, +you'll need to commit and push the changes in that repository + +To add a submodule, use a commandline like this: + +``` +% git submodule add https://github.com/Keyboardio/Kaleidoscope-Plugin/ libraries/Kaleidoscope-Plugin +``` diff --git a/avr/boards.txt b/avr/boards.txt new file mode 100644 index 0000000..49e22af --- /dev/null +++ b/avr/boards.txt @@ -0,0 +1,60 @@ +# See: http://code.google.com/p/arduino/wiki/Platforms + +menu.cpu=Processor + +############################################################## + +model01.name=Keyboardio Model 01 +model01.vid.0=0x1209 +model01.pid.0=0x2301 + +model01.upload.tool=avrdude +model01.upload.protocol=avr109 +model01.upload.maximum_size=28672 +model01.upload.maximum_data_size=2560 +model01.upload.speed=57600 +model01.upload.disable_flushing=true +model01.upload.use_1200bps_touch=true +model01.upload.wait_for_upload_port=true + +model01.bootloader.tool=avrdude +model01.bootloader.low_fuses=0xff +model01.bootloader.high_fuses=0xd8 +model01.bootloader.extended_fuses=0xcb +model01.bootloader.file=caterina/Caterina.hex +model01.bootloader.unlock_bits=0x3F +model01.bootloader.lock_bits=0x2F +model01.bootloader.pid=0x2300 + +model01.build.mcu=atmega32u4 +model01.build.f_cpu=16000000L +model01.build.vid=0x1209 +model01.build.pid=0x2301 +model01.build.usb_product="Model 01" +model01.build.usb_manufacturer="Keyboardio" +model01.build.board=AVR_MODEL01 +model01.build.core=arduino:arduino +model01.build.variant=model01 +model01.build.extra_flags={build.usb_flags} '-DKALEIDOSCOPE_HARDWARE_H="Kaleidoscope-Hardware-Model01.h"' + +############################################################## + +ergodox.name=ErgoDox +ergodox.vid.0=0xfeed +ergodox.pid.0=0x1307 + +ergodox.upload.tool=teensy_loader_cli +ergodox.upload.protocol=halfkay +ergodox.upload.maximum_size=32256 +ergodox.upload.maximum_data_size=2560 + +ergodox.build.mcu=atmega32u4 +ergodox.build.f_cpu=16000000L +ergodox.build.vid=0xfeed +ergodox.build.pid=0x1307 +ergodox.build.usb_product="ErgoDox EZ" +ergodox.build.usb_manufacturer="ErgoDox EZ" +ergodox.build.board=AVR_ERGODOX +ergodox.build.core=arduino:arduino +ergodox.build.variant=ergodox +ergodox.build.extra_flags={build.usb_flags} '-DKALEIDOSCOPE_HARDWARE_H="Kaleidoscope-Hardware-EZ-ErgoDox.h"' '-DKALEIDOSCOPE_ENABLE_V1_PLUGIN_API=0' diff --git a/avr/platform.txt b/avr/platform.txt new file mode 100644 index 0000000..4d0c8fc --- /dev/null +++ b/avr/platform.txt @@ -0,0 +1,128 @@ + +# Arduino AVR Core and platform. +# ------------------------------ +# +# For more info: +# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification + +name=Keyboardio Keyboards +version=1.6.11 + +# AVR compile variables +# --------------------- + +compiler.warning_flags=-w +compiler.warning_flags.none=-w +compiler.warning_flags.default= +compiler.warning_flags.more=-Wall +compiler.warning_flags.all=-Wall -Wextra + +# Default "compiler.path" is correct, change only if you want to override the initial value +compiler.path={runtime.tools.avr-gcc.path}/bin/ +compiler.c.cmd=avr-gcc +compiler.c.flags=-c -g -Os {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -MMD +compiler.c.elf.flags={compiler.warning_flags} -Os -Wl,--gc-sections +compiler.c.elf.cmd=avr-gcc +compiler.S.flags=-c -g -x assembler-with-cpp +compiler.cpp.cmd=avr-g++ +compiler.cpp.flags=-c -g -Os {compiler.warning_flags} -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD +compiler.ar.cmd=avr-ar +compiler.ar.flags=rcs +compiler.objcopy.cmd=avr-objcopy +compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 +compiler.elf2hex.flags=-O ihex -R .eeprom +compiler.elf2hex.cmd=avr-objcopy +compiler.ldflags= +compiler.size.cmd=avr-size + +# This can be overridden in boards.txt +build.extra_flags= + +# These can be overridden in platform.local.txt +compiler.c.extra_flags= +compiler.c.elf.extra_flags= +compiler.S.extra_flags= +compiler.cpp.extra_flags=-Woverloaded-virtual -Wno-unused-parameter -Wno-unused-variable -Wno-ignored-qualifiers +compiler.ar.extra_flags= +compiler.objcopy.eep.extra_flags= +compiler.elf2hex.extra_flags= + +# AVR compile patterns +# -------------------- + +## Compile c files +recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}" + +## Compile c++ files +recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}" + +## Compile S files +recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.S.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}" + +## Create archives +# archive_file_path is needed for backwards compatibility with IDE 1.6.5 or older, IDE 1.6.6 or newer overrides this value +archive_file_path={build.path}/{archive_file} +recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}" + +## Combine gc-sections, archives, and objects +recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mmcu={build.mcu} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" -lm + +## Create output files (.eep and .hex) +recipe.objcopy.eep.pattern="{compiler.path}{compiler.objcopy.cmd}" {compiler.objcopy.eep.flags} {compiler.objcopy.eep.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.eep" +recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex" + +## Save hex +recipe.output.tmp_file={build.project_name}.hex +recipe.output.save_file={build.project_name}.{build.variant}.hex + +## Compute size +recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" +recipe.size.regex=^(?:\.text|\.data|\.bootloader)\s+([0-9]+).* +recipe.size.regex.data=^(?:\.data|\.bss|\.noinit)\s+([0-9]+).* +recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).* + +## Preprocessor +preproc.includes.flags=-w -x c++ -M -MG -MP +recipe.preproc.includes="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} {preproc.includes.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" + +preproc.macros.flags=-w -x c++ -E -CC +recipe.preproc.macros="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} {preproc.macros.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{preprocessed_file_path}" + +# AVR Uploader/Programmers tools +# ------------------------------ + +tools.avrdude.path={runtime.tools.avrdude.path} +tools.avrdude.cmd.path={path}/bin/avrdude +tools.avrdude.config.path={path}/etc/avrdude.conf + +tools.avrdude.upload.params.verbose=-v +tools.avrdude.upload.params.quiet=-q -q +tools.avrdude.upload.params.noverify=-V +tools.avrdude.upload.pattern="{cmd.path}" "-C{config.path}" {upload.verbose} {upload.verify} -p{build.mcu} -c{upload.protocol} -P{serial.port} -b{upload.speed} -D "-Uflash:w:{build.path}/{build.project_name}.hex:i" + +tools.avrdude.program.params.verbose=-v +tools.avrdude.program.params.quiet=-q -q +tools.avrdude.program.params.noverify=-V +tools.avrdude.program.pattern="{cmd.path}" "-C{config.path}" {program.verbose} {program.verify} -p{build.mcu} -c{protocol} {program.extra_params} "-Uflash:w:{build.path}/{build.project_name}.hex:i" + +tools.avrdude.erase.params.verbose=-v +tools.avrdude.erase.params.quiet=-q -q +tools.avrdude.erase.pattern="{cmd.path}" "-C{config.path}" {erase.verbose} -p{build.mcu} -c{protocol} {program.extra_params} -e -Ulock:w:{bootloader.unlock_bits}:m -Uefuse:w:{bootloader.extended_fuses}:m -Uhfuse:w:{bootloader.high_fuses}:m -Ulfuse:w:{bootloader.low_fuses}:m + +tools.avrdude.bootloader.params.verbose=-v +tools.avrdude.bootloader.params.quiet=-q -q +tools.avrdude.bootloader.pattern="{cmd.path}" "-C{config.path}" {bootloader.verbose} -p{build.mcu} -c{protocol} {program.extra_params} "-Uflash:w:{runtime.platform.path}/bootloaders/{bootloader.file}:i" -Ulock:w:{bootloader.lock_bits}:m + +tools.avrdude_remote.upload.pattern=/usr/bin/run-avrdude /tmp/sketch.hex {upload.verbose} -p{build.mcu} + +tools.teensy_loader_cli.cmd.path=teensy_loader_cli +tools.teensy_loader_cli.upload.params.verbose=-v +tools.teensy_loader_cli.upload.params.quiet= +tools.teensy_loader_cli.upload.noverify= +tools.teensy_loader_cli.upload.pattern="{cmd.path}" {upload.verbose} --mcu=atmega32u4 -w -v "{build.path}/{build.project_name}.hex" + +# USB Default Flags +# Default blank usb manufacturer will be filled in at compile time +# - from numeric vendor ID, set to Unknown otherwise +build.usb_manufacturer="Unknown" +build.usb_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}'