- Added clang (i.e. multi-compiler) support to convenience build scripts - Updated README - Added Bootloader build scripts for the two main versions currently used - Added uartOut and usbMuxUart build scripts (these tend to suffer from build rot the most as they're only used in debugging) - Attempt to get clang support for the Bootloader * clang is missing compiler extensions, so this may require a large re-write to get workingblockKey
#!/usr/bin/env bash | |||||
# This is bash lib file for the convenience build scripts | |||||
# Don't call this script directly | |||||
# Jacob Alexander 2015-2016 | |||||
# Check if compiler has been overridden by the environment | |||||
Compiler=${COMPILER:-${Compiler}} | |||||
# Append to BuildPath, depending on which compiler this is | |||||
BuildPath=${BuildPath}.${Compiler} | |||||
# Make sure all of the relevant variables have been set | |||||
# NOTE: PartialMaps and DefaultMap do not have to be set | |||||
VariablesList=(BuildPath Chip Compiler) | |||||
ExitEarly=false | |||||
for var in ${VariablesList[@]}; do | |||||
if [ -z ${!var+x} ]; then | |||||
echo "ERROR: Unset variable => '${var}'" | |||||
ExitEarly=true | |||||
fi | |||||
done | |||||
# Error was detected, exit immediately | |||||
if $ExitEarly; then | |||||
exit 1 | |||||
fi | |||||
# Prepare PartialMaps | |||||
PartialMapsExpanded="${PartialMaps[1]}" | |||||
count=2 # Start the loop at index 2 | |||||
while [ "$count" -le "${#PartialMaps[@]}" ]; do | |||||
PartialMapsExpanded="${PartialMapsExpanded};${PartialMaps[count]}" | |||||
count=$(($count+1)) | |||||
done | |||||
# Internal Variables | |||||
CMakeListsPath="../.." | |||||
PROG_NAME=$(basename $0) | |||||
# Process the command line arguments (if any) | |||||
while (( "$#" >= "1" )); do | |||||
# Scan each argument | |||||
key="$1" | |||||
case $key in | |||||
-c|--cmakelists-path) | |||||
CMakeListsPath="$2" | |||||
shift | |||||
;; | |||||
-f|--force-rebuild) | |||||
# Remove the old directory first | |||||
rm -rf "${BuildPath}" | |||||
;; | |||||
-o|--output-path) | |||||
BuildPath="$2" | |||||
shift | |||||
;; | |||||
-h|--help) | |||||
echo "Usage: $PROG_NAME [options...]" | |||||
echo "" | |||||
echo "Convenience script to build the source of a given keyboard." | |||||
echo "Edit '$PROG_NAME' to configure the keyboard options such as KLL layouts." | |||||
echo "" | |||||
echo "Arguments:" | |||||
echo " -c, --cmakelists-path PATH Set the path of CMakeLists.txt" | |||||
echo " Default: ${CMakeListsPath}" | |||||
echo " -f, --force-rebuild Deletes the old build directory and rebuilds from scratch." | |||||
echo " -o, --output-path PATH Set the path of the build files." | |||||
echo " Default: ${BuildPath}" | |||||
echo " -h, --help This message." | |||||
exit 1 | |||||
;; | |||||
*) | |||||
echo "INVALID ARG: '$1'" | |||||
exit 2 | |||||
;; | |||||
esac | |||||
# Shift to the next argument | |||||
shift | |||||
done | |||||
# Run CMake commands | |||||
## TODO Check for windows and do windows specific things ## | |||||
mkdir -p "${BuildPath}" | |||||
cd "${BuildPath}" | |||||
cmake -DCHIP="${Chip}" -DCOMPILER="${Compiler}" "${CMakeListsPath}" | |||||
return_code=$? | |||||
if [ $return_code != 0 ] ; then | |||||
echo "Error in cmake. Exiting..." | |||||
exit $return_code | |||||
fi | |||||
make | |||||
return_code=$? | |||||
if [ $return_code != 0 ] ; then | |||||
echo "Error in make. Exiting..." | |||||
exit $return_code | |||||
fi | |||||
echo "Firmware has been compiled into: '${BuildPath}'" | |||||
cd - | |||||
#!/usr/bin/env bash | |||||
# This is a build script template | |||||
# These build scripts are just a convenience for configuring your keyboard (less daunting than CMake) | |||||
# Jacob Alexander 2015-2016 | |||||
################# | |||||
# Configuration # | |||||
################# | |||||
BuildPath="mk20dx128vlf5" | |||||
########################## | |||||
# Advanced Configuration # | |||||
########################## | |||||
# Don't change the variables in this section unless you know what you're doing | |||||
# These are useful for completely custom keyboards | |||||
# NOTE: Changing any of these variables will require a force build to compile correctly | |||||
# Microcontroller | |||||
Chip="mk20dx128vlf5" | |||||
# Compiler Selection | |||||
Compiler="gcc" | |||||
######################## | |||||
# Bash Library Include # | |||||
######################## | |||||
# Shouldn't need to touch this section | |||||
# Check if the library can be found | |||||
if [ ! -f cmake.bash ]; then | |||||
echo "ERROR: Cannot find 'cmake.bash'" | |||||
exit 1 | |||||
fi | |||||
# Load the library | |||||
source cmake.bash | |||||
#!/usr/bin/env bash | |||||
# This is a build script template | |||||
# These build scripts are just a convenience for configuring your keyboard (less daunting than CMake) | |||||
# Jacob Alexander 2015-2016 | |||||
################# | |||||
# Configuration # | |||||
################# | |||||
BuildPath="mk20dx256vlh7" | |||||
########################## | |||||
# Advanced Configuration # | |||||
########################## | |||||
# Don't change the variables in this section unless you know what you're doing | |||||
# These are useful for completely custom keyboards | |||||
# NOTE: Changing any of these variables will require a force build to compile correctly | |||||
# Microcontroller | |||||
Chip="mk20dx256vlh7" | |||||
# Compiler Selection | |||||
Compiler="gcc" | |||||
######################## | |||||
# Bash Library Include # | |||||
######################## | |||||
# Shouldn't need to touch this section | |||||
# Check if the library can be found | |||||
if [ ! -f cmake.bash ]; then | |||||
echo "ERROR: Cannot find 'cmake.bash'" | |||||
exit 1 | |||||
fi | |||||
# Load the library | |||||
source cmake.bash | |||||
#!/usr/bin/env bash | |||||
# This is a build script template | |||||
# These build scripts are just a convenience for configuring your keyboard (less daunting than CMake) | |||||
# Jacob Alexander 2015-2016 | |||||
################# | |||||
# Configuration # | |||||
################# | |||||
BuildPath="template" | |||||
########################## | |||||
# Advanced Configuration # | |||||
########################## | |||||
# Don't change the variables in this section unless you know what you're doing | |||||
# These are useful for completely custom keyboards | |||||
# NOTE: Changing any of these variables will require a force build to compile correctly | |||||
# Microcontroller | |||||
Chip="mk20dx128vlf5" | |||||
# Compiler Selection | |||||
Compiler="gcc" | |||||
######################## | |||||
# Bash Library Include # | |||||
######################## | |||||
# Shouldn't need to touch this section | |||||
# Check if the library can be found | |||||
if [ ! -f cmake.bash ]; then | |||||
echo "ERROR: Cannot find 'cmake.bash'" | |||||
exit 1 | |||||
fi | |||||
# Load the library | |||||
source cmake.bash | |||||
/* Copyright (c) 2011,2012 Simon Schubert <[email protected]>. | /* Copyright (c) 2011,2012 Simon Schubert <[email protected]>. | ||||
* Modifications by Jacob Alexander 2014-2015 <[email protected]> | |||||
* Modifications by Jacob Alexander 2014-2016 <[email protected]> | |||||
* | * | ||||
* This program is free software: you can redistribute it and/or modify | * This program is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
#include <sys/types.h> | #include <sys/types.h> | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
#include <stdfix.h> | |||||
#include <stdarg.h> | #include <stdarg.h> | ||||
Projects | Projects | ||||
-------- | -------- | ||||
* infinity.bash (Infinity Keyboard 2014/10/15) | |||||
* ergodox.bash (Infinity Ergodox 2015/08/15) | |||||
* template.bash (Example template for new keyboards) | |||||
* whitefox.bash (Soon?) | |||||
* infinity.bash (Infinity Keyboard 2014/10/15) | |||||
* infinity_led.bash (Infinity Keyboard with LED backlight support) | |||||
* ergodox.bash (Infinity Ergodox 2015/08/15) | |||||
* template.bash (Example template for new keyboards) | |||||
* whitefox.bash (WhiteFox Keyboard) | |||||
**Extra files** | **Extra files** |
#!/usr/bin/env bash | |||||
# This is a build script template for testing builds | |||||
# These build scripts are just a convenience for configuring your keyboard (less daunting than CMake) | |||||
# Jacob Alexander 2015-2016 | |||||
################# | |||||
# Configuration # | |||||
################# | |||||
# Feel free to change the variables in this section to configure your keyboard | |||||
BuildPath="template" | |||||
## KLL Configuration ## | |||||
# Generally shouldn't be changed, this will affect every layer | |||||
BaseMap="scancode_map" | |||||
# This is the default layer of the keyboard | |||||
# NOTE: To combine kll files into a single layout, separate them by spaces | |||||
# e.g. DefaultMap="mylayout mylayoutmod" | |||||
DefaultMap="md1Overlay stdFuncMap" | |||||
# This is where you set the additional layers | |||||
# NOTE: Indexing starts at 1 | |||||
# NOTE: Each new layer is another array entry | |||||
# e.g. PartialMaps[1]="layer1 layer1mod" | |||||
# PartialMaps[2]="layer2" | |||||
# PartialMaps[3]="layer3" | |||||
PartialMaps[1]="hhkbpro2" | |||||
PartialMaps[2]="colemak" | |||||
########################## | |||||
# Advanced Configuration # | |||||
########################## | |||||
# Don't change the variables in this section unless you know what you're doing | |||||
# These are useful for completely custom keyboards | |||||
# NOTE: Changing any of these variables will require a force build to compile correctly | |||||
# Keyboard Module Configuration | |||||
ScanModule="Infinity_60%" | |||||
MacroModule="PartialMap" | |||||
OutputModule="pjrcUSB" | |||||
DebugModule="full" | |||||
# Microcontroller | |||||
Chip="mk20dx128vlf5" | |||||
# Compiler Selection | |||||
Compiler="gcc" | |||||
######################## | |||||
# Bash Library Include # | |||||
######################## | |||||
# Shouldn't need to touch this section | |||||
# Check if the library can be found | |||||
if [ ! -f ../cmake.bash ]; then | |||||
echo "ERROR: Cannot find 'cmake.bash'" | |||||
exit 1 | |||||
fi | |||||
# Override CMakeLists path | |||||
CMakeListsPath="../../.." | |||||
# Load the library | |||||
source "../cmake.bash" | |||||
#!/usr/bin/env bash | |||||
# This is a build script template for testing builds | |||||
# These build scripts are just a convenience for configuring your keyboard (less daunting than CMake) | |||||
# Jacob Alexander 2015-2016 | |||||
################# | |||||
# Configuration # | |||||
################# | |||||
# Feel free to change the variables in this section to configure your keyboard | |||||
BuildPath="UART" | |||||
## KLL Configuration ## | |||||
# Generally shouldn't be changed, this will affect every layer | |||||
BaseMap="scancode_map" | |||||
# This is the default layer of the keyboard | |||||
# NOTE: To combine kll files into a single layout, separate them by spaces | |||||
# e.g. DefaultMap="mylayout mylayoutmod" | |||||
DefaultMap="md1Overlay stdFuncMap" | |||||
# This is where you set the additional layers | |||||
# NOTE: Indexing starts at 1 | |||||
# NOTE: Each new layer is another array entry | |||||
# e.g. PartialMaps[1]="layer1 layer1mod" | |||||
# PartialMaps[2]="layer2" | |||||
# PartialMaps[3]="layer3" | |||||
PartialMaps[1]="hhkbpro2" | |||||
PartialMaps[2]="colemak" | |||||
########################## | |||||
# Advanced Configuration # | |||||
########################## | |||||
# Don't change the variables in this section unless you know what you're doing | |||||
# These are useful for completely custom keyboards | |||||
# NOTE: Changing any of these variables will require a force build to compile correctly | |||||
# Keyboard Module Configuration | |||||
ScanModule="Infinity_60%" | |||||
MacroModule="PartialMap" | |||||
OutputModule="uartOut" | |||||
DebugModule="full" | |||||
# Microcontroller | |||||
Chip="mk20dx128vlf5" | |||||
# Compiler Selection | |||||
Compiler="gcc" | |||||
######################## | |||||
# Bash Library Include # | |||||
######################## | |||||
# Shouldn't need to touch this section | |||||
# Check if the library can be found | |||||
if [ ! -f ../cmake.bash ]; then | |||||
echo "ERROR: Cannot find 'cmake.bash'" | |||||
exit 1 | |||||
fi | |||||
# Override CMakeLists path | |||||
CMakeListsPath="../../.." | |||||
# Load the library | |||||
source "../cmake.bash" | |||||
#!/usr/bin/env bash | |||||
# This is a build script template for testing builds | |||||
# These build scripts are just a convenience for configuring your keyboard (less daunting than CMake) | |||||
# Jacob Alexander 2015-2016 | |||||
################# | |||||
# Configuration # | |||||
################# | |||||
# Feel free to change the variables in this section to configure your keyboard | |||||
BuildPath="USBxUART" | |||||
## KLL Configuration ## | |||||
# Generally shouldn't be changed, this will affect every layer | |||||
BaseMap="scancode_map" | |||||
# This is the default layer of the keyboard | |||||
# NOTE: To combine kll files into a single layout, separate them by spaces | |||||
# e.g. DefaultMap="mylayout mylayoutmod" | |||||
DefaultMap="md1Overlay stdFuncMap" | |||||
# This is where you set the additional layers | |||||
# NOTE: Indexing starts at 1 | |||||
# NOTE: Each new layer is another array entry | |||||
# e.g. PartialMaps[1]="layer1 layer1mod" | |||||
# PartialMaps[2]="layer2" | |||||
# PartialMaps[3]="layer3" | |||||
PartialMaps[1]="hhkbpro2" | |||||
PartialMaps[2]="colemak" | |||||
########################## | |||||
# Advanced Configuration # | |||||
########################## | |||||
# Don't change the variables in this section unless you know what you're doing | |||||
# These are useful for completely custom keyboards | |||||
# NOTE: Changing any of these variables will require a force build to compile correctly | |||||
# Keyboard Module Configuration | |||||
ScanModule="Infinity_60%" | |||||
MacroModule="PartialMap" | |||||
OutputModule="usbMuxUart" | |||||
DebugModule="full" | |||||
# Microcontroller | |||||
Chip="mk20dx128vlf5" | |||||
# Compiler Selection | |||||
Compiler="gcc" | |||||
######################## | |||||
# Bash Library Include # | |||||
######################## | |||||
# Shouldn't need to touch this section | |||||
# Check if the library can be found | |||||
if [ ! -f ../cmake.bash ]; then | |||||
echo "ERROR: Cannot find 'cmake.bash'" | |||||
exit 1 | |||||
fi | |||||
# Override CMakeLists path | |||||
CMakeListsPath="../../.." | |||||
# Load the library | |||||
source "../cmake.bash" | |||||
#!/usr/bin/env bash | #!/usr/bin/env bash | ||||
# This is bash lib file for the convenience build scripts | # This is bash lib file for the convenience build scripts | ||||
# Don't call this script directly | # Don't call this script directly | ||||
# Jacob Alexander 2015 | |||||
# Jacob Alexander 2015-2016 | |||||
# Check if compiler has been overridden by the environment | |||||
Compiler=${COMPILER:-${Compiler}} | |||||
# Append to BuildPath, depending on which compiler this is | |||||
BuildPath=${BuildPath}.${Compiler} | |||||
# Make sure all of the relevant variables have been set | # Make sure all of the relevant variables have been set | ||||
# NOTE: PartialMaps and DefaultMap do not have to be set | # NOTE: PartialMaps and DefaultMap do not have to be set | ||||
# Internal Variables | # Internal Variables | ||||
CMakeListsPath="../.." | |||||
CMakeListsPath=${CMakeListsPath:-"../.."} | |||||
PROG_NAME=$(basename $0) | PROG_NAME=$(basename $0) | ||||
# Feel free to change the variables in this section to configure your keyboard | # Feel free to change the variables in this section to configure your keyboard | ||||
BuildPath="IC60" | |||||
BuildPath="IC60_LED" | |||||
## KLL Configuration ## | ## KLL Configuration ## | ||||
#| -f...: tuning, see GCC manual | #| -f...: tuning, see GCC manual | ||||
#| NOTE: -fshort-wchar is specified to allow USB strings be passed conveniently | #| NOTE: -fshort-wchar is specified to allow USB strings be passed conveniently | ||||
if( BOOTLOADER ) | if( BOOTLOADER ) | ||||
set( TUNING "-D_bootloader_ -Wno-main -msoft-float -mthumb -fplan9-extensions -ffunction-sections -fdata-sections -fno-builtin -fstrict-volatile-bitfields -flto -fno-use-linker-plugin -nostdlib" ) | |||||
#set( TUNING "-mthumb -fdata-sections -ffunction-sections -fno-builtin -msoft-float -fstrict-volatile-bitfields -flto -fno-use-linker-plugin -fwhole-program -Wno-main -nostartfiles -fplan9-extensions -D_bootloader_" ) | |||||
if ( "${COMPILER}" MATCHES "clang" ) | |||||
# TODO Not currently working, clang doesn't support all the neccessary extensions | |||||
message ( AUTHOR_WARNING "clang doesn't support all the needed extensions, code may need rework to use clang" ) | |||||
set ( TUNING "-D_bootloader_ -Wno-main -msoft-float -target arm-none-eabi -mthumb -nostdlib -fdata-sections -ffunction-sections -fshort-wchar -fno-builtin -fplan9-extensions -fstrict-volatile-bitfields -flto -fno-use-linker-plugin" ) | |||||
else () | |||||
set ( TUNING "-D_bootloader_ -Wno-main -msoft-float -mthumb -fplan9-extensions -ffunction-sections -fdata-sections -fno-builtin -fstrict-volatile-bitfields -flto -fno-use-linker-plugin -nostdlib" ) | |||||
#set( TUNING "-mthumb -fdata-sections -ffunction-sections -fno-builtin -msoft-float -fstrict-volatile-bitfields -flto -fno-use-linker-plugin -fwhole-program -Wno-main -nostartfiles -fplan9-extensions -D_bootloader_" ) | |||||
endif () | |||||
elseif ( "${COMPILER}" MATCHES "clang" ) | elseif ( "${COMPILER}" MATCHES "clang" ) | ||||
set( TUNING "-target arm-none-eabi -mthumb -nostdlib -fdata-sections -ffunction-sections -fshort-wchar -fno-builtin" ) | |||||
set ( TUNING "-target arm-none-eabi -mthumb -nostdlib -fdata-sections -ffunction-sections -fshort-wchar -fno-builtin" ) | |||||
else() | else() | ||||
set( TUNING "-mthumb -nostdlib -fdata-sections -ffunction-sections -fshort-wchar -fno-builtin -nostartfiles" ) | set( TUNING "-mthumb -nostdlib -fdata-sections -ffunction-sections -fshort-wchar -fno-builtin -nostartfiles" ) | ||||
endif() | endif() |
Name = uartOutCapabilities; | Name = uartOutCapabilities; | ||||
Version = 0.2; | |||||
Author = "HaaTa (Jacob Alexander) 2014"; | |||||
KLL = 0.3; | |||||
Version = 0.3; | |||||
Author = "HaaTa (Jacob Alexander) 2014-2016"; | |||||
KLL = 0.3d; | |||||
# Modified Date | # Modified Date | ||||
Date = 2014-08-21; | |||||
Date = 2016-07-17; | |||||
# Capabilties available to the uartOut output module | # Capabilties available to the uartOut output module | ||||
consCtrlOut => Output_consCtrlSend_capability( consCode : 2 ); | |||||
noneOut => Output_noneSend_capability(); | |||||
sysCtrlOut => Output_sysCtrlSend_capability( sysCode : 1 ); | |||||
usbKeyOut => Output_usbCodeSend_capability( usbCode : 1 ); | usbKeyOut => Output_usbCodeSend_capability( usbCode : 1 ); | ||||
mouseOut => Output_usbMouse_capability( mouseCode : 2, relative_x : 2, relative_y : 2 ); | |||||
# Configuration capabilities | |||||
kbdProtocolBoot => Output_kbdProtocolBoot_capability(); | |||||
kbdProtocolNKRO => Output_kbdProtocolNKRO_capability(); | |||||
toggleKbdProtocol => Output_toggleKbdProtocol_capability(); | |||||
# Bootloader Mode capability | # Bootloader Mode capability | ||||
# XXX | # XXX |
/* Copyright (C) 2014-2015 by Jacob Alexander | |||||
/* Copyright (C) 2014-2016 by Jacob Alexander | |||||
* | * | ||||
* Permission is hereby granted, free of charge, to any person obtaining a copy | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||||
* of this software and associated documentation files (the "Software"), to deal | * of this software and associated documentation files (the "Software"), to deal | ||||
// Indicates whether the Output module is fully functional | // Indicates whether the Output module is fully functional | ||||
// 0 - Not fully functional, 1 - Fully functional | // 0 - Not fully functional, 1 - Fully functional | ||||
// 0 is often used to show that a USB cable is not plugged in (but has power) | // 0 is often used to show that a USB cable is not plugged in (but has power) | ||||
uint8_t Output_Available = 0; | |||||
volatile uint8_t Output_Available = 0; | |||||
// ----- Capabilities ----- | // ----- Capabilities ----- | ||||
// Adds a single USB Code to the USB Output buffer | |||||
// Argument #1: USB Code | |||||
void Output_usbCodeSend_capability( uint8_t state, uint8_t stateType, uint8_t *args ) | |||||
{ | |||||
// Display capability name | |||||
if ( stateType == 0xFF && state == 0xFF ) | |||||
{ | |||||
print("Output_usbCodeSend(usbCode)"); | |||||
print("Not used in uartOut..."); | |||||
return; | |||||
} | |||||
} | |||||
// Ignored capabilities | |||||
void Output_kbdProtocolBoot_capability( uint8_t state, uint8_t stateType, uint8_t *args ) {} | |||||
void Output_kbdProtocolNKRO_capability( uint8_t state, uint8_t stateType, uint8_t *args ) {} | |||||
void Output_toggleKbdProtocol_capability( uint8_t state, uint8_t stateType, uint8_t *args ) {} | |||||
void Output_consCtrlSend_capability( uint8_t state, uint8_t stateType, uint8_t *args ) {} | |||||
void Output_noneSend_capability( uint8_t state, uint8_t stateType, uint8_t *args ) {} | |||||
void Output_sysCtrlSend_capability( uint8_t state, uint8_t stateType, uint8_t *args ) {} | |||||
void Output_usbCodeSend_capability( uint8_t state, uint8_t stateType, uint8_t *args ) {} | |||||
void Output_usbMouse_capability( uint8_t state, uint8_t stateType, uint8_t *args ) {} | |||||
void Output_flashMode_capability( uint8_t state, uint8_t stateType, uint8_t *args ) | void Output_flashMode_capability( uint8_t state, uint8_t stateType, uint8_t *args ) | ||||
{ | { |