Przeglądaj źródła

File and macro modifications for supporting Teensy 3.1

simple
Jacob Alexander 10 lat temu
rodzic
commit
3fa9c16c04

+ 4
- 4
Lib/Interrupts.h Wyświetl plik

/* Copyright (C) 2013 by Jacob Alexander
/* Copyright (C) 2013-2014 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
#define __INTERRUPTS_H #define __INTERRUPTS_H


// ARM // ARM
#if defined(_mk20dx128_)
#if defined(_mk20dx128_) || defined(_mk20dx256_)


#include <Lib/mk20dx128.h>
#include <Lib/mk20dx.h>


// AVR // AVR
#elif defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_) #elif defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_)
// ----- Defines ----- // ----- Defines -----


// ARM // ARM
#if defined(_mk20dx128_)
#if defined(_mk20dx128_) || defined(_mk20dx256_)


// Map the Interrupt Enable/Disable to the AVR names // Map the Interrupt Enable/Disable to the AVR names
#define cli() __disable_irq() #define cli() __disable_irq()

+ 3
- 3
Lib/MacroLib.h Wyświetl plik

/* Copyright (C) 2013 by Jacob Alexander
/* Copyright (C) 2013-2014 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




// ARM // ARM
#if defined(_mk20dx128_)
#if defined(_mk20dx128_) || defined(_mk20dx256_)


#include <Lib/mk20dx128.h>
#include <Lib/mk20dx.h>
#include <Lib/aliased_bitband.h> #include <Lib/aliased_bitband.h>
#include <Lib/delay.h> #include <Lib/delay.h>



+ 3
- 3
Lib/MainLib.h Wyświetl plik

/* Copyright (C) 2013 by Jacob Alexander
/* Copyright (C) 2013-2014 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




// ARM // ARM
#if defined(_mk20dx128_)
#if defined(_mk20dx128_) || defined(_mk20dx256_)


#include <Lib/mk20dx128.h>
#include <Lib/mk20dx.h>
#include <Lib/aliased_bitband.h> #include <Lib/aliased_bitband.h>


#endif #endif

Lib/USBLib.h → Lib/OutputLib.h Wyświetl plik

/* Copyright (C) 2013 by Jacob Alexander
/* Copyright (C) 2013-2014 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
// Additional includes should only be added to this file if they should be added to *all* Scan modules. // Additional includes should only be added to this file if they should be added to *all* Scan modules.




#ifndef __USBLIB_H
#define __USBLIB_H
#ifndef __OUTPUTLIB_H
#define __OUTPUTLIB_H


// ----- Includes ----- // ----- Includes -----


// ARM // ARM
#if defined(_mk20dx128_)
#if defined(_mk20dx128_) || defined(_mk20dx256_)


#include <Lib/mk20dx128.h>
#include <Lib/mk20dx.h>
#include <Lib/delay.h> #include <Lib/delay.h>


#endif #endif

+ 3
- 3
Lib/ScanLib.h Wyświetl plik

/* Copyright (C) 2013 by Jacob Alexander
/* Copyright (C) 2013-2014 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




// ARM // ARM
#if defined(_mk20dx128_)
#if defined(_mk20dx128_) || defined(_mk20dx256_)


#include <Lib/mk20dx128.h>
#include <Lib/mk20dx.h>
#include <Lib/aliased_bitband.h> #include <Lib/aliased_bitband.h>
#include <Lib/delay.h> #include <Lib/delay.h>



+ 1
- 1
Lib/delay.c Wyświetl plik



#include "delay.h" #include "delay.h"
#include "mk20dx128.h"
#include "mk20dx.h"


// the systick interrupt is supposed to increment this at 1 kHz rate // the systick interrupt is supposed to increment this at 1 kHz rate
volatile uint32_t systick_millis_count = 0; volatile uint32_t systick_millis_count = 0;

Lib/mk20dx128.c → Lib/mk20dx.c Wyświetl plik

* SOFTWARE. * SOFTWARE.
*/ */


#include "mk20dx128.h"
#include "mk20dx.h"




extern unsigned long _stext; extern unsigned long _stext;

Lib/mk20dx128.h → Lib/mk20dx.h Wyświetl plik

* SOFTWARE. * SOFTWARE.
*/ */


#ifndef _mk20dx128_h_
#define _mk20dx128_h_
#ifndef _mk20dx_h_
#define _mk20dx_h_


//#define F_CPU 96000000 //#define F_CPU 96000000
//#define F_CPU 48000000 //#define F_CPU 48000000

+ 146
- 0
Lib/mk20dx256.ld Wyświetl plik

/* Teensyduino Core Library
* http://www.pjrc.com/teensy/
* Copyright (c) 2013 PJRC.COM, LLC.
*
* 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:
*
* 1. The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* 2. If the Software is incorporated into a build system that allows
* selection among a list of target devices, then similar target
* devices manufactured by PJRC.COM must be included in the list of
* target devices and selectable in the same manner.
*
* 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.
*/

MEMORY
{
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 256K
RAM (rwx) : ORIGIN = 0x1FFF8000, LENGTH = 64K
}


/* INCLUDE common.ld */


/* Teensyduino Core Library
* http://www.pjrc.com/teensy/
* Copyright (c) 2013 PJRC.COM, LLC.
*
* 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:
*
* 1. The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* 2. If the Software is incorporated into a build system that allows
* selection among a list of target devices, then similar target
* devices manufactured by PJRC.COM must be included in the list of
* target devices and selectable in the same manner.
*
* 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.
*/



SECTIONS
{
.text : {
. = 0;
KEEP(*(.vectors))
*(.startup*)
/* TODO: does linker detect startup overflow onto flashconfig? */
. = 0x400;
KEEP(*(.flashconfig*))
*(.text*)
*(.rodata*)
. = ALIGN(4);
KEEP(*(.init))
. = ALIGN(4);
__preinit_array_start = .;
KEEP (*(.preinit_array))
__preinit_array_end = .;
__init_array_start = .;
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
__init_array_end = .;
} > FLASH = 0xFF

.ARM.exidx : {
__exidx_start = .;
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
__exidx_end = .;
} > FLASH
_etext = .;

.usbdescriptortable (NOLOAD) : {
/* . = ORIGIN(RAM); */
. = ALIGN(512);
*(.usbdescriptortable*)
} > RAM

.dmabuffers (NOLOAD) : {
. = ALIGN(4);
*(.dmabuffers*)
} > RAM

.usbbuffers (NOLOAD) : {
. = ALIGN(4);
*(.usbbuffers*)
} > RAM

.data : AT (_etext) {
. = ALIGN(4);
_sdata = .;
*(.data*)
. = ALIGN(4);
_edata = .;
} > RAM

.noinit (NOLOAD) : {
*(.noinit*)
} > RAM

.bss : {
. = ALIGN(4);
_sbss = .;
*(.bss*)
*(COMMON)
. = ALIGN(4);
_ebss = .;
__bss_end = .;
} > RAM

_estack = ORIGIN(RAM) + LENGTH(RAM);
}





+ 1
- 1
Output/pjrcUSB/arm/usb_dev.c Wyświetl plik

* SOFTWARE. * SOFTWARE.
*/ */


#include <Lib/USBLib.h>
#include <Lib/OutputLib.h>
#include "usb_dev.h" #include "usb_dev.h"
#include "usb_mem.h" #include "usb_mem.h"



+ 1
- 1
Output/pjrcUSB/arm/usb_keyboard.c Wyświetl plik



#include "usb_dev.h" #include "usb_dev.h"
#include "usb_keyboard.h" #include "usb_keyboard.h"
#include <Lib/USBLib.h>
#include <Lib/OutputLib.h>
#include <string.h> // for memcpy() #include <string.h> // for memcpy()





+ 1
- 1
Output/pjrcUSB/arm/usb_mem.c Wyświetl plik

* SOFTWARE. * SOFTWARE.
*/ */


#include <Lib/USBLib.h>
#include <Lib/OutputLib.h>
#include "usb_dev.h" #include "usb_dev.h"
#include "usb_mem.h" #include "usb_mem.h"



+ 1
- 1
Output/pjrcUSB/arm/usb_serial.c Wyświetl plik



#include "usb_dev.h" #include "usb_dev.h"
#include "usb_serial.h" #include "usb_serial.h"
#include <Lib/USBLib.h>
#include <Lib/OutputLib.h>
#include <string.h> // For memcpy #include <string.h> // For memcpy


// defined by usb_dev.h -> usb_desc.h // defined by usb_dev.h -> usb_desc.h

+ 1
- 1
Output/pjrcUSB/output_com.c Wyświetl plik

// ----- Includes ----- // ----- Includes -----


// Compiler Includes // Compiler Includes
#include <Lib/USBLib.h>
#include <Lib/OutputLib.h>


// Project Includes // Project Includes
#include <scan_loop.h> #include <scan_loop.h>

+ 17
- 4
arm.cmake Wyświetl plik

###| CMAKE Kiibohd Controller |### ###| CMAKE Kiibohd Controller |###
# #
# Jacob Alexander 2011-2013
# Jacob Alexander 2011-2014
# Due to this file's usefulness: # Due to this file's usefulness:
# #
# Released into the Public Domain # Released into the Public Domain
#| type "make clean" after changing this, so all files will be rebuilt #| type "make clean" after changing this, so all files will be rebuilt
#| #|
#| "mk20dx128" # Teensy 3.0 #| "mk20dx128" # Teensy 3.0
#| "mk20dx256" # Teensy 3.1
set( CHIP "mk20dx128" ) set( CHIP "mk20dx128" )
#set( CHIP "mk20dx256" )


message( STATUS "Chip Selected:" ) message( STATUS "Chip Selected:" )
message( "${CHIP}" ) message( "${CHIP}" )
set( MCU "${CHIP}" ) # For loading script compatibility set( MCU "${CHIP}" ) # For loading script compatibility




#| Chip Base Type
#| Automatically chosed based on the chip name.
if ( "${CHIP}" MATCHES "^mk20dx.*$" )
set( CHIP_FAMILY "mk20dx" )
message( STATUS "Chip Family:" )
message( "${CHIP_FAMILY}" )
else ()
message( FATAL_ERROR "Unknown chip family: ${CHIP}" )
endif ()


#| CPU Type #| CPU Type
#| You _MUST_ set this to match the board you are using #| You _MUST_ set this to match the board you are using
#| type "make clean" after changing this, so all files will be rebuilt #| type "make clean" after changing this, so all files will be rebuilt
#| #|
#| "cortex-m4" # Teensy 3.0
#| "cortex-m4" # Teensy 3.0, 3.1
set( CPU "cortex-m4" ) set( CPU "cortex-m4" )


message( STATUS "CPU Selected:" ) message( STATUS "CPU Selected:" )
#| Extra Compiler Sources #| Extra Compiler Sources
#| Mostly for convenience functions like interrupt handlers #| Mostly for convenience functions like interrupt handlers
set( COMPILER_SRCS set( COMPILER_SRCS
Lib/${CHIP}.c
Lib/${CHIP_FAMILY}.c
Lib/delay.c Lib/delay.c
) )


set( TUNING "-mthumb -nostdlib -fdata-sections -ffunction-sections -fshort-wchar" ) set( TUNING "-mthumb -nostdlib -fdata-sections -ffunction-sections -fshort-wchar" )




#| Optimization level, can be [0, 1, 2, 3, s].
#| Optimization level, can be [0, 1, 2, 3, s].
#| 0 = turn off optimization. s = optimize for size. #| 0 = turn off optimization. s = optimize for size.
#| (Note: 3 is not always the best optimization level.) #| (Note: 3 is not always the best optimization level.)
set( OPT "s" ) set( OPT "s" )