parent
5419130291
commit
e259a722e7
@ -0,0 +1,30 @@
|
||||
PROJECT = infinity
|
||||
|
||||
TMK_DIR = ../..
|
||||
MBED_DIR = $(TMK_DIR)/mbed-sdk
|
||||
|
||||
#VPATH += $(MBED_DIR):$(TMK_DIR)
|
||||
vpath %.s .:$(MBED_DIR):$(TMK_DIR)
|
||||
vpath %.c .:$(MBED_DIR):$(TMK_DIR)
|
||||
vpath %.cpp .:$(MBED_DIR):$(TMK_DIR)
|
||||
|
||||
OBJDIR = ./build
|
||||
|
||||
OBJECTS = \
|
||||
$(OBJDIR)/main.o
|
||||
|
||||
CONFIG_H = config.h
|
||||
|
||||
INCLUDE_PATHS = -I.
|
||||
|
||||
|
||||
# Build Options
|
||||
# Comment out to disable
|
||||
#BOOTMAGIC_ENABLE = yes
|
||||
#MOUSEKEY_ENABLE = yes
|
||||
|
||||
|
||||
include $(TMK_DIR)/tool/mbed/mk20d50m.mk
|
||||
include $(TMK_DIR)/tool/mbed/mbed.mk
|
||||
include $(TMK_DIR)/tool/mbed/common.mk
|
||||
include $(TMK_DIR)/tool/mbed/gcc.mk
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
Copyright 2014 Jun Wako <wakojun@gmail.com>
|
||||
|
||||
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
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#if 0
|
||||
// duplicated name against mbed USBDeivce
|
||||
#define VENDOR_ID 0xFEED
|
||||
#define PRODUCT_ID 0x3BED
|
||||
#endif
|
||||
#define DEVICE_VER 0x0001
|
||||
#define MANUFACTURER tmk.
|
||||
#define PRODUCT Infinitiy
|
||||
#define DESCRIPTION Massdrop Infinity keyboard firmware by tmk
|
||||
|
||||
|
||||
/* matrix size */
|
||||
#define MATRIX_ROWS 9 // Strobe
|
||||
#define MATRIX_COLS 7 // Sense
|
||||
|
||||
/* key combination for command */
|
||||
#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
|
||||
|
||||
#endif
|
@ -0,0 +1,156 @@
|
||||
/*
|
||||
* Linker script for Massdrop Infinity
|
||||
* Infinity has bootloader in top 4KB sector of flash and app should be placed after the area.
|
||||
*
|
||||
* based on mbed.org K20 ARM GCC linker script file: MK20D5.ld
|
||||
*/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
/* Infinity blootloader uses 4KB */
|
||||
FLASH (rx) : ORIGIN = 4K, LENGTH = 128K - 4K
|
||||
RAM (rwx) : ORIGIN = 0x1FFFE000, LENGTH = 16K
|
||||
}
|
||||
|
||||
/* Linker script to place sections and symbol values. Should be used together
|
||||
* with other linker script that defines memory regions FLASH and RAM.
|
||||
* It references following symbols, which must be defined in code:
|
||||
* _reset_init : Entry of reset handler
|
||||
*
|
||||
* It defines following symbols, which code can use without definition:
|
||||
* __exidx_start
|
||||
* __exidx_end
|
||||
* __etext
|
||||
* __data_start__
|
||||
* __preinit_array_start
|
||||
* __preinit_array_end
|
||||
* __init_array_start
|
||||
* __init_array_end
|
||||
* __fini_array_start
|
||||
* __fini_array_end
|
||||
* __data_end__
|
||||
* __bss_start__
|
||||
* __bss_end__
|
||||
* __end__
|
||||
* end
|
||||
* __HeapLimit
|
||||
* __StackLimit
|
||||
* __StackTop
|
||||
* __stack
|
||||
*/
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
__vector_table = .;
|
||||
KEEP(*(.isr_vector))
|
||||
*(.text.Reset_Handler)
|
||||
*(.text.System_Init)
|
||||
. = ALIGN(4);
|
||||
|
||||
*(.text*)
|
||||
|
||||
KEEP(*(.init))
|
||||
KEEP(*(.fini))
|
||||
|
||||
/* .ctors */
|
||||
*crtbegin.o(.ctors)
|
||||
*crtbegin?.o(.ctors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
|
||||
*(SORT(.ctors.*))
|
||||
*(.ctors)
|
||||
|
||||
/* .dtors */
|
||||
*crtbegin.o(.dtors)
|
||||
*crtbegin?.o(.dtors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
|
||||
*(SORT(.dtors.*))
|
||||
*(.dtors)
|
||||
|
||||
*(.rodata*)
|
||||
|
||||
KEEP(*(.eh_frame*))
|
||||
} > FLASH
|
||||
|
||||
.ARM.extab :
|
||||
{
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
} > FLASH
|
||||
|
||||
__exidx_start = .;
|
||||
.ARM.exidx :
|
||||
{
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
} > FLASH
|
||||
__exidx_end = .;
|
||||
|
||||
__etext = .;
|
||||
|
||||
.data : AT (__etext)
|
||||
{
|
||||
__data_start__ = .;
|
||||
*(vtable)
|
||||
*(.data*)
|
||||
|
||||
. = ALIGN(4);
|
||||
/* preinit data */
|
||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||
KEEP(*(.preinit_array))
|
||||
PROVIDE_HIDDEN (__preinit_array_end = .);
|
||||
|
||||
. = ALIGN(4);
|
||||
/* init data */
|
||||
PROVIDE_HIDDEN (__init_array_start = .);
|
||||
KEEP(*(SORT(.init_array.*)))
|
||||
KEEP(*(.init_array))
|
||||
PROVIDE_HIDDEN (__init_array_end = .);
|
||||
|
||||
|
||||
. = ALIGN(4);
|
||||
/* finit data */
|
||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||
KEEP(*(SORT(.fini_array.*)))
|
||||
KEEP(*(.fini_array))
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
|
||||
. = ALIGN(4);
|
||||
/* All data end */
|
||||
__data_end__ = .;
|
||||
|
||||
} > RAM
|
||||
|
||||
.bss :
|
||||
{
|
||||
__bss_start__ = .;
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
__bss_end__ = .;
|
||||
} > RAM
|
||||
|
||||
.heap :
|
||||
{
|
||||
__end__ = .;
|
||||
end = __end__;
|
||||
*(.heap*)
|
||||
__HeapLimit = .;
|
||||
} > RAM
|
||||
|
||||
/* .stack_dummy section doesn't contains any symbols. It is only
|
||||
* used for linker to calculate size of stack sections, and assign
|
||||
* values to stack symbols later */
|
||||
.stack_dummy :
|
||||
{
|
||||
*(.stack)
|
||||
} > RAM
|
||||
|
||||
/* Set stack top to end of RAM, and stack limit move down by
|
||||
* size of stack_dummy section */
|
||||
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
|
||||
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
|
||||
PROVIDE(__stack = __StackTop);
|
||||
|
||||
/* Check if data + heap + stack exceeds RAM limit */
|
||||
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
//#include "mbed.h"
|
||||
#include "MK20D5.h"
|
||||
#include "wait.h"
|
||||
#include "gpio_api.h"
|
||||
#include "PinNames.h"
|
||||
|
||||
|
||||
//DigitalOut led(PTA19);
|
||||
|
||||
int main() {
|
||||
gpio_t led;
|
||||
gpio_init_out(&led, PTA19);
|
||||
while(1) {
|
||||
gpio_write(&led, 1);
|
||||
wait_ms(500);
|
||||
gpio_write(&led, 0);
|
||||
wait_ms(500);
|
||||
}
|
||||
/*
|
||||
SIM->SCGC6 |= SIM_SCGC5_PORTA_MASK;
|
||||
PORTA->PCR[19] = PORT_PCR_SRE_MASK | PORT_PCR_DSE_MASK | PORT_PCR_MUX(1);
|
||||
PTA->PDDR |= (1<<19);
|
||||
PTA->PSOR |= (1<<19);
|
||||
while(1) {
|
||||
PTA->PTOR |= (1<<19);
|
||||
wait_ms(500);
|
||||
}
|
||||
*/
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
# based on Makefile exported form mbed.org
|
||||
# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded
|
||||
|
||||
CPU = -mcpu=cortex-m4 -mthumb
|
||||
|
||||
CC_SYMBOLS += \
|
||||
-DTARGET_K20D50M \
|
||||
-DTARGET_M4 \
|
||||
-DTARGET_CORTEX_M \
|
||||
-DTARGET_Freescale \
|
||||
-DTOOLCHAIN_GCC_ARM \
|
||||
-DTOOLCHAIN_GCC \
|
||||
-D__CORTEX_M4 \
|
||||
-DARM_MATH_CM4 \
|
||||
-D__MBED__=1
|
||||
|
||||
OBJECTS += \
|
||||
$(OBJDIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM/startup_MK20D5.o \
|
||||
$(OBJDIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/cmsis_nvic.o \
|
||||
$(OBJDIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/system_MK20D5.o \
|
||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/analogin_api.o \
|
||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/gpio_api.o \
|
||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/gpio_irq_api.o \
|
||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/i2c_api.o \
|
||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/pinmap.o \
|
||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/port_api.o \
|
||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/pwmout_api.o \
|
||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/rtc_api.o \
|
||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/serial_api.o \
|
||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/sleep.o \
|
||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/spi_api.o \
|
||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/us_ticker.o
|
||||
|
||||
INCLUDE_PATHS += \
|
||||
-I$(MBED_DIR)/libraries/mbed/targets \
|
||||
-I$(MBED_DIR)/libraries/mbed/targets/cmsis \
|
||||
-I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale \
|
||||
-I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M \
|
||||
-I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM \
|
||||
-I$(MBED_DIR)/libraries/mbed/targets/hal \
|
||||
-I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_Freescale \
|
||||
-I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M
|
||||
|
||||
LINKER_SCRIPT = $(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM/MK20D5.ld
|
||||
#LINKER_SCRIPT = infinity.ld
|
Loading…
Reference in new issue