Archived
1
0

Preparing controller repo for automated travis-ci

- 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 working
This commit is contained in:
Jacob Alexander 2016-07-17 17:23:33 -07:00
parent 43bc97895b
commit c71e67a29a
14 changed files with 520 additions and 30 deletions

View File

@ -0,0 +1,106 @@
#!/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 -

View File

@ -0,0 +1,46 @@
#!/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

View File

@ -0,0 +1,46 @@
#!/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

46
Bootloader/Builds/template.bash Executable file
View File

@ -0,0 +1,46 @@
#!/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

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2011,2012 Simon Schubert <2@0x2c.org>. /* Copyright (c) 2011,2012 Simon Schubert <2@0x2c.org>.
* Modifications by Jacob Alexander 2014-2015 <haata@kiibohd.com> * Modifications by Jacob Alexander 2014-2016 <haata@kiibohd.com>
* *
* 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
@ -21,7 +21,6 @@
#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>

View File

@ -28,9 +28,10 @@ Projects
-------- --------
* infinity.bash (Infinity Keyboard 2014/10/15) * infinity.bash (Infinity Keyboard 2014/10/15)
* infinity_led.bash (Infinity Keyboard with LED backlight support)
* ergodox.bash (Infinity Ergodox 2015/08/15) * ergodox.bash (Infinity Ergodox 2015/08/15)
* template.bash (Example template for new keyboards) * template.bash (Example template for new keyboards)
* whitefox.bash (Soon?) * whitefox.bash (WhiteFox Keyboard)
**Extra files** **Extra files**

76
Keyboards/Testing/template.bash Executable file
View File

@ -0,0 +1,76 @@
#!/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"

76
Keyboards/Testing/uartout.bash Executable file
View File

@ -0,0 +1,76 @@
#!/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"

View File

@ -0,0 +1,76 @@
#!/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"

View File

@ -1,7 +1,13 @@
#!/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
@ -30,7 +36,7 @@ done
# Internal Variables # Internal Variables
CMakeListsPath="../.." CMakeListsPath=${CMakeListsPath:-"../.."}
PROG_NAME=$(basename $0) PROG_NAME=$(basename $0)

View File

@ -11,7 +11,7 @@
# 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 ##

View File

@ -160,10 +160,16 @@ set( WARN "-Wall -ggdb3" )
#| -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" ) 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_" ) #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()

View File

@ -1,14 +1,23 @@
Name = uartOutCapabilities; Name = uartOutCapabilities;
Version = 0.2; Version = 0.3;
Author = "HaaTa (Jacob Alexander) 2014"; Author = "HaaTa (Jacob Alexander) 2014-2016";
KLL = 0.3; 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

View File

@ -1,4 +1,4 @@
/* 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
@ -110,24 +110,21 @@ USBKeyChangeState USBKeys_Changed = USBKeyChangeState_None;
// 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 // Ignored capabilities
// Argument #1: USB Code void Output_kbdProtocolBoot_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_kbdProtocolNKRO_capability( uint8_t state, uint8_t stateType, uint8_t *args ) {}
{ void Output_toggleKbdProtocol_capability( uint8_t state, uint8_t stateType, uint8_t *args ) {}
// Display capability name void Output_consCtrlSend_capability( uint8_t state, uint8_t stateType, uint8_t *args ) {}
if ( stateType == 0xFF && state == 0xFF ) 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 ) {}
print("Output_usbCodeSend(usbCode)"); void Output_usbCodeSend_capability( uint8_t state, uint8_t stateType, uint8_t *args ) {}
print("Not used in uartOut..."); void Output_usbMouse_capability( uint8_t state, uint8_t stateType, uint8_t *args ) {}
return;
}
}
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 )
{ {