Preparing for mk20dx256vlh7
- Not ready yet - Will require some more changes to Lib/mk20dx.c
This commit is contained in:
parent
40b5665930
commit
f5a1e1bcf5
18 changed files with 295 additions and 51 deletions
|
@ -25,7 +25,9 @@ set( _CMAKE_TOOLCHAIN_PREFIX arm-none-eabi- )
|
|||
|
||||
#| Chip Name (Linker)
|
||||
#|
|
||||
#| "mk20dx128" # Teensy 3.0 and McHCK mk20dx128
|
||||
#| "mk20dx128vlf5" # McHCK / Kiibohd-dfu
|
||||
#| "mk20dx256vlh7" # Kiibohd-dfu
|
||||
#| "mk20dx128" # Teensy 3.0
|
||||
#| "mk20dx256" # Teensy 3.1
|
||||
|
||||
message( STATUS "Chip Selected:" )
|
||||
|
@ -34,11 +36,16 @@ set( MCU "${CHIP}" ) # For loading script compatibility
|
|||
|
||||
|
||||
#| Chip Size Database
|
||||
#| MCHCK Based
|
||||
#| MCHCK Based / Kiibohd-dfu
|
||||
if ( "${CHIP}" MATCHES "mk20dx128vlf5" )
|
||||
set( SIZE_RAM 16384 )
|
||||
set( SIZE_FLASH 126976 )
|
||||
|
||||
#| Kiibohd-dfu
|
||||
elseif ( "${CHIP}" MATCHES "mk20dx256vlh7" )
|
||||
set( SIZE_RAM 65536 )
|
||||
set( SIZE_FLASH 253952 )
|
||||
|
||||
#| Teensy 3.0
|
||||
elseif ( "${CHIP}" MATCHES "mk20dx128" )
|
||||
set( SIZE_RAM 16384 )
|
||||
|
@ -90,7 +97,7 @@ message( "${COMPILER_SRCS}" )
|
|||
|
||||
#| USB Defines, this is how the loader programs detect which type of chip base is used
|
||||
message( STATUS "Bootloader Type:" )
|
||||
if ( "${CHIP}" MATCHES "mk20dx128vlf5" )
|
||||
if ( "${CHIP}" MATCHES "mk20dx128vlf5" OR "${CHIP}" MATCHES "mk20dx256vlh7" )
|
||||
set( VENDOR_ID "0x1C11" )
|
||||
set( PRODUCT_ID "0xB04D" )
|
||||
set( BOOT_VENDOR_ID "0x1C11" )
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#define __INTERRUPTS_H
|
||||
|
||||
// ARM
|
||||
#if defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_)
|
||||
#if defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_) || defined(_mk20dx256vlh7_)
|
||||
|
||||
#include <Lib/mk20dx.h>
|
||||
|
||||
|
@ -45,7 +45,7 @@
|
|||
// ----- Defines -----
|
||||
|
||||
// ARM
|
||||
#if defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_)
|
||||
#if defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_) || defined(_mk20dx256vlh7_)
|
||||
|
||||
// Map the Interrupt Enable/Disable to the AVR names
|
||||
#define cli() __disable_irq()
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
|
||||
// ARM
|
||||
#if defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_)
|
||||
#if defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_) || defined(_mk20dx256vlh7_)
|
||||
|
||||
#include <Lib/mk20dx.h>
|
||||
#include <Lib/delay.h>
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
|
||||
// ARM
|
||||
#if defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_)
|
||||
#if defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_) || defined(_mk20dx256vlh7_)
|
||||
|
||||
#include <Lib/mk20dx.h>
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
// ----- Includes -----
|
||||
|
||||
// ARM
|
||||
#if defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_)
|
||||
#if defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_) || defined(_mk20dx256vlh7_)
|
||||
|
||||
#include <Lib/mk20dx.h>
|
||||
#include <Lib/delay.h>
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
|
||||
// ARM
|
||||
#if defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_)
|
||||
#if defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_) || defined(_mk20dx256vlh7_)
|
||||
|
||||
#include <Lib/mk20dx.h>
|
||||
#include <Lib/delay.h>
|
||||
|
|
21
Lib/mk20dx.c
21
Lib/mk20dx.c
|
@ -377,6 +377,27 @@ const uint8_t flashconfigbytes[16] = {
|
|||
0xFF, // EEPROM Protection Byte FEPROT
|
||||
0xFF, // Data Flash Protection Byte FDPROT
|
||||
};
|
||||
#elif defined(_mk20dx256vlh7_) && defined(_bootloader_)
|
||||
// XXX Byte labels may be in incorrect positions, double check before modifying
|
||||
// FSEC is in correct location -Jacob
|
||||
__attribute__ ((section(".flashconfig"), used))
|
||||
const uint8_t flashconfigbytes[16] = {
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // Backdoor Verif Key 28.3.1
|
||||
|
||||
//
|
||||
// Protecting the first 8k of Flash memory from being over-written while running (bootloader protection)
|
||||
// Still possible to overwrite the bootloader using an external flashing device
|
||||
// For more details see:
|
||||
// http://cache.freescale.com/files/training/doc/dwf/AMF_ENT_T1031_Boston.pdf (page 8)
|
||||
// http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4507.pdf
|
||||
// http://cache.freescale.com/files/32bit/doc/ref_manual/K20P64M72SF1RM.pdf (28.34.6)
|
||||
//
|
||||
0xFF, 0xFF, 0xFF, 0xFE, // Program Flash Protection Bytes FPROT0-3
|
||||
|
||||
0xBE, // Flash security byte FSEC
|
||||
0x03, // Flash nonvolatile option byte FOPT
|
||||
0xFF, // EEPROM Protection Byte FEPROT
|
||||
0xFF, // Data Flash Protection Byte FDPROT
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -1847,7 +1847,7 @@ typedef struct {
|
|||
#define IRQ_SOFTWARE 45
|
||||
#define NVIC_NUM_INTERRUPTS 46
|
||||
|
||||
#elif defined(_mk20dx256_)
|
||||
#elif defined(_mk20dx256_) || defined(_mk20dx256vlh7_)
|
||||
#define IRQ_DMA_CH0 0
|
||||
#define IRQ_DMA_CH1 1
|
||||
#define IRQ_DMA_CH2 2
|
||||
|
|
114
Lib/mk20dx256vlh7.bootloader.ld
Normal file
114
Lib/mk20dx256vlh7.bootloader.ld
Normal file
|
@ -0,0 +1,114 @@
|
|||
/* Teensyduino Core Library
|
||||
* http://www.pjrc.com/teensy/
|
||||
* Copyright (c) 2013 PJRC.COM, LLC.
|
||||
* Modifications by Jacob Alexander 2014 for use with McHCK and Kiibohd-dfu
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* XXX Not tested yet -HaaTa */
|
||||
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x0, LENGTH = 256K
|
||||
FLASH_APP (rx) : ORIGIN = 8K, LENGTH = 256K-8K
|
||||
RAM (rwx) : ORIGIN = 0x20000000 - 64K / 2, LENGTH = 64K
|
||||
}
|
||||
|
||||
/* Starting Address of the application ROM */
|
||||
_app_rom = ORIGIN( FLASH_APP );
|
||||
|
||||
FlexRAM = 0x14000000;
|
||||
FTFL = 0x40020000;
|
||||
SCB = 0xe000ed00;
|
||||
USB0 = 0x40072000;
|
||||
SIM = 0x40047000;
|
||||
|
||||
/* Section Definitions */
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
. = 0;
|
||||
KEEP(* (.vectors))
|
||||
*(.startup*)
|
||||
*(.rodata*)
|
||||
. = 0x400;
|
||||
KEEP(* (.flashconfig))
|
||||
*(.text*)
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.init))
|
||||
} > FLASH
|
||||
|
||||
.ARM.exidx :
|
||||
{
|
||||
__exidx_start = .;
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
__exidx_end = .;
|
||||
} > FLASH
|
||||
_etext = .;
|
||||
|
||||
.usbdescriptortable (NOLOAD) : {
|
||||
. = ALIGN(512);
|
||||
*(.usbdescriptortable*)
|
||||
} > RAM
|
||||
|
||||
.dmabuffers (NOLOAD) : {
|
||||
. = ALIGN(4);
|
||||
*(.dmabuffers*)
|
||||
} > RAM
|
||||
|
||||
.usbbuffers (NOLOAD) : {
|
||||
. = ALIGN(4);
|
||||
*(.usbbuffers*)
|
||||
} > RAM
|
||||
|
||||
.data : AT (_etext) {
|
||||
. = ALIGN(4);
|
||||
_sdata = .;
|
||||
*(SORT_BY_ALIGNMENT(.ramtext.*) SORT_BY_ALIGNMENT(.data*))
|
||||
*(.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);
|
||||
}
|
||||
|
101
Lib/mk20dx256vlh7.ld
Normal file
101
Lib/mk20dx256vlh7.ld
Normal file
|
@ -0,0 +1,101 @@
|
|||
/* Teensyduino Core Library
|
||||
* http://www.pjrc.com/teensy/
|
||||
* Copyright (c) 2013 PJRC.COM, LLC.
|
||||
* Modifications by Jacob Alexander 2014 for use with McHCK and Kiibohd-dfu
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* XXX Not tested yet -HaaTa */
|
||||
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 8K, LENGTH = 256K-8K
|
||||
RAM (rwx) : ORIGIN = 0x20000000 - 64K / 2, LENGTH = 64K
|
||||
}
|
||||
|
||||
/* Section Definitions */
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
. = 0;
|
||||
KEEP(* (.vectors))
|
||||
*(.startup*)
|
||||
*(.text*)
|
||||
*(.rodata*)
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.init))
|
||||
} > FLASH
|
||||
|
||||
.ARM.exidx :
|
||||
{
|
||||
__exidx_start = .;
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
__exidx_end = .;
|
||||
} > FLASH
|
||||
_etext = .;
|
||||
|
||||
.usbdescriptortable (NOLOAD) : {
|
||||
. = 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);
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue