Browse Source

File and macro modifications for supporting Teensy 3.1

simple
Jacob Alexander 10 years ago
parent
commit
3fa9c16c04

+ 4
- 4
Lib/Interrupts.h View File

@@ -1,4 +1,4 @@
/* 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
* of this software and associated documentation files (the "Software"), to deal
@@ -29,9 +29,9 @@
#define __INTERRUPTS_H

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

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

// AVR
#elif defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_)
@@ -45,7 +45,7 @@
// ----- Defines -----

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

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

+ 3
- 3
Lib/MacroLib.h View File

@@ -1,4 +1,4 @@
/* 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
* of this software and associated documentation files (the "Software"), to deal
@@ -34,9 +34,9 @@


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

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


+ 3
- 3
Lib/MainLib.h View File

@@ -1,4 +1,4 @@
/* 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
* of this software and associated documentation files (the "Software"), to deal
@@ -34,9 +34,9 @@


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

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

#endif

Lib/USBLib.h → Lib/OutputLib.h View File

@@ -1,4 +1,4 @@
/* 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
* of this software and associated documentation files (the "Software"), to deal
@@ -24,15 +24,15 @@
// 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 -----

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

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

#endif

+ 3
- 3
Lib/ScanLib.h View File

@@ -1,4 +1,4 @@
/* 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
* of this software and associated documentation files (the "Software"), to deal
@@ -34,9 +34,9 @@


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

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


+ 1
- 1
Lib/delay.c View File

@@ -1,6 +1,6 @@

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

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

Lib/mk20dx128.c → Lib/mk20dx.c View File

@@ -28,7 +28,7 @@
* SOFTWARE.
*/

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


extern unsigned long _stext;

Lib/mk20dx128.h → Lib/mk20dx.h View File

@@ -28,8 +28,8 @@
* SOFTWARE.
*/

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

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

+ 146
- 0
Lib/mk20dx256.ld View File

@@ -0,0 +1,146 @@
/* 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 View File

@@ -28,7 +28,7 @@
* SOFTWARE.
*/

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


+ 1
- 1
Output/pjrcUSB/arm/usb_keyboard.c View File

@@ -30,7 +30,7 @@

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



+ 1
- 1
Output/pjrcUSB/arm/usb_mem.c View File

@@ -28,7 +28,7 @@
* SOFTWARE.
*/

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


+ 1
- 1
Output/pjrcUSB/arm/usb_serial.c View File

@@ -30,7 +30,7 @@

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

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

+ 1
- 1
Output/pjrcUSB/output_com.c View File

@@ -22,7 +22,7 @@
// ----- Includes -----

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

// Project Includes
#include <scan_loop.h>

+ 17
- 4
arm.cmake View File

@@ -1,6 +1,6 @@
###| CMAKE Kiibohd Controller |###
#
# Jacob Alexander 2011-2013
# Jacob Alexander 2011-2014
# Due to this file's usefulness:
#
# Released into the Public Domain
@@ -34,18 +34,31 @@ set( SIZE "arm-none-eabi-size" )
#| type "make clean" after changing this, so all files will be rebuilt
#|
#| "mk20dx128" # Teensy 3.0
#| "mk20dx256" # Teensy 3.1
set( CHIP "mk20dx128" )
#set( CHIP "mk20dx256" )

message( STATUS "Chip Selected:" )
message( "${CHIP}" )
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
#| You _MUST_ set this to match the board you are using
#| 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" )

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

@@ -87,7 +100,7 @@ set( WARN "-Wall -g" )
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.
#| (Note: 3 is not always the best optimization level.)
set( OPT "s" )