From b4b17507b6d1a3675dc7fbfd885dd31fcc351efa Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Fri, 12 Dec 2014 14:05:05 +0900 Subject: [PATCH 1/7] Ad hoc fix of print and debug for mbed --- common/print.c | 12 ++++++++++-- tool/mbed/common.mk | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/common/print.c b/common/print.c index c13a29f3..ca94e1e5 100644 --- a/common/print.c +++ b/common/print.c @@ -22,13 +22,14 @@ * THE SOFTWARE. */ -#include -#include +#include #include "print.h" #ifndef NO_PRINT +#if defined(__AVR__) + #define sendchar(c) xputc(c) @@ -37,4 +38,11 @@ void print_set_sendchar(int8_t (*sendchar_func)(uint8_t)) xdev_out(sendchar_func); } +#elif defined(__arm__) + +// TODO +//void print_set_sendchar(int8_t (*sendchar_func)(uint8_t)) { } + +#endif + #endif diff --git a/tool/mbed/common.mk b/tool/mbed/common.mk index 93a927a3..403da9ac 100644 --- a/tool/mbed/common.mk +++ b/tool/mbed/common.mk @@ -7,6 +7,8 @@ OBJECTS += \ $(OBJDIR)/common/host.o \ $(OBJDIR)/common/keymap.o \ $(OBJDIR)/common/keyboard.o \ + $(OBJDIR)/common/print.o \ + $(OBJDIR)/common/debug.o \ $(OBJDIR)/common/util.o \ $(OBJDIR)/common/mbed/suspend.o \ $(OBJDIR)/common/mbed/timer.o \ From 1f33eecf84d4fd10771a18f95c8890f47e4bad78 Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Sun, 14 Dec 2014 13:59:22 +0900 Subject: [PATCH 2/7] Update makefiles to mbed-sdk 14666bb --- tool/mbed/gcc.mk | 37 +++++++---- tool/mbed/lpc11u35_501.mk | 49 ++++++++++++++ tool/mbed/mbed.mk | 132 ++++++++++++++++---------------------- 3 files changed, 128 insertions(+), 90 deletions(-) create mode 100644 tool/mbed/lpc11u35_501.mk diff --git a/tool/mbed/gcc.mk b/tool/mbed/gcc.mk index 032f7c6c..b8c7336b 100644 --- a/tool/mbed/gcc.mk +++ b/tool/mbed/gcc.mk @@ -1,4 +1,6 @@ -############################################################################### +# based on Makefile exported form mbed.org +# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded + GCC_BIN = AS = $(GCC_BIN)arm-none-eabi-as CC = $(GCC_BIN)arm-none-eabi-gcc @@ -9,13 +11,21 @@ OBJDUMP = $(GCC_BIN)arm-none-eabi-objdump SIZE = $(GCC_BIN)arm-none-eabi-size CHKSUM = $(TMK_DIR)/tool/mbed/lpc-vector-checksum -CPU = -mcpu=cortex-m0 -mthumb - -CC_FLAGS += $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections +CC_FLAGS += \ + $(CPU) \ + -c \ + -g \ + -fno-common \ + -fmessage-length=0 \ + -Wall \ + -fno-exceptions \ + -ffunction-sections \ + -fdata-sections \ + -fomit-frame-pointer CC_FLAGS += -MMD -MP -CC_SYMBOLS = -DTARGET_LPC11U35_401 -DTARGET_M0 -DTARGET_NXP -DTARGET_LPC11UXX -DTOOLCHAIN_GCC_ARM -DTOOLCHAIN_GCC -D__CORTEX_M0 -DARM_MATH_CM0 -DMBED_BUILD_TIMESTAMP=1399108688.49 -D__MBED__=1 -LD_FLAGS = -mcpu=cortex-m0 -mthumb -Wl,--gc-sections --specs=nano.specs +LD_FLAGS = $(CPU) -Wl,--gc-sections --specs=nano.specs +#LD_FLAGS += -u _printf_float -u _scanf_float LD_FLAGS += -Wl,-Map=$(OBJDIR)/$(PROJECT).map,--cref LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys @@ -25,7 +35,7 @@ else CC_FLAGS += -DNDEBUG -Os endif -all: $(OBJDIR)/$(PROJECT).bin $(OBJDIR)/$(PROJECT).hex size +all: $(OBJDIR)/$(PROJECT).bin $(OBJDIR)/$(PROJECT).hex clean: rm -f $(OBJDIR)/$(PROJECT).bin $(OBJDIR)/$(PROJECT).elf $(OBJDIR)/$(PROJECT).hex $(OBJDIR)/$(PROJECT).map $(OBJDIR)/$(PROJECT).lst $(OBJECTS) $(DEPS) @@ -41,22 +51,21 @@ $(OBJDIR)/%.o: %.c $(OBJDIR)/%.o: %.cpp mkdir -p $(@D) - $(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 $(INCLUDE_PATHS) -o $@ $< + $(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 -fno-rtti $(INCLUDE_PATHS) -o $@ $< $(OBJDIR)/$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS) $(LD) $(LD_FLAGS) -T$(LINKER_SCRIPT) $(LIBRARY_PATHS) -o $@ $^ $(LIBRARIES) $(LD_SYS_LIBS) $(LIBRARIES) $(LD_SYS_LIBS) - @echo "" - @echo "*****" - @echo "***** You must modify vector checksum value in *.bin and *.hex files." - @echo "*****" - @echo "" + $(SIZE) $@ $(OBJDIR)/$(PROJECT).bin: $(OBJDIR)/$(PROJECT).elf @$(OBJCOPY) -O binary $< $@ - @echo "Writing vector checksum value into $@ ..." +ifneq (,$(findstring TARGET_NXP,$(CC_SYMBOLS))) + @echo + @echo "For NXP writing vector checksum value into $@ ..." @$(CHKSUM) $@ @echo +endif $(OBJDIR)/$(PROJECT).hex: $(OBJDIR)/$(PROJECT).elf @$(OBJCOPY) -O ihex $< $@ diff --git a/tool/mbed/lpc11u35_501.mk b/tool/mbed/lpc11u35_501.mk new file mode 100644 index 00000000..af1aad79 --- /dev/null +++ b/tool/mbed/lpc11u35_501.mk @@ -0,0 +1,49 @@ +# based on Makefile exported form mbed.org +# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded + +CPU = -mcpu=cortex-m0 -mthumb + +CC_SYMBOLS = \ + -DTARGET_LPC11U35_501 \ + -DTARGET_M0 \ + -DTARGET_CORTEX_M \ + -DTARGET_NXP \ + -DTARGET_LPC11UXX \ + -DTARGET_MCU_LPC11U35_501 \ + -DTOOLCHAIN_GCC_ARM \ + -DTOOLCHAIN_GCC \ + -D__CORTEX_M0 \ + -DARM_MATH_CM0 \ + -D__MBED__=1 + +OBJECTS += \ + $(OBJDIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM/startup_LPC11xx.o \ + $(OBJDIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/cmsis_nvic.o \ + $(OBJDIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/system_LPC11Uxx.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/TARGET_MCU_LPC11U35_501/PeripheralPins.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/analogin_api.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/gpio_api.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/gpio_irq_api.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/i2c_api.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/pinmap.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/port_api.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/pwmout_api.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/serial_api.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/sleep.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/spi_api.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/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_NXP \ + -I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX \ + -I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM \ + -I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM/TARGET_LPC11U35_501 \ + -I$(MBED_DIR)/libraries/mbed/targets/hal \ + -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_NXP \ + -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX \ + -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/TARGET_MCU_LPC11U35_501 \ + -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/TARGET_MCU_LPC11U35_501/TARGET_LPC11U35_501 \ + +LINKER_SCRIPT = $(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM/TARGET_LPC11U35_501/LPC11U35.ld diff --git a/tool/mbed/mbed.mk b/tool/mbed/mbed.mk index 0f12ee2a..242d7879 100644 --- a/tool/mbed/mbed.mk +++ b/tool/mbed/mbed.mk @@ -1,99 +1,79 @@ +# based on Makefile exported form mbed.org +# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded + OBJECTS += \ - $(OBJDIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM/startup_LPC11xx.o \ - $(OBJDIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/cmsis_nvic.o \ - $(OBJDIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/system_LPC11Uxx.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/port_api.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/spi_api.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/analogin_api.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/gpio_api.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/gpio_irq_api.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/serial_api.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/i2c_api.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/pwmout_api.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/sleep.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/pinmap.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/us_ticker.o \ - $(OBJDIR)/libraries/mbed/common/board.o \ - $(OBJDIR)/libraries/mbed/common/mbed_interface.o \ - $(OBJDIR)/libraries/mbed/common/exit.o \ - $(OBJDIR)/libraries/mbed/common/rtc_time.o \ - $(OBJDIR)/libraries/mbed/common/us_ticker_api.o \ - $(OBJDIR)/libraries/mbed/common/pinmap_common.o \ - $(OBJDIR)/libraries/mbed/common/error.o \ - $(OBJDIR)/libraries/mbed/common/gpio.o \ - $(OBJDIR)/libraries/mbed/common/semihost_api.o \ - $(OBJDIR)/libraries/mbed/common/wait_api.o \ - $(OBJDIR)/libraries/mbed/common/RawSerial.o \ - $(OBJDIR)/libraries/mbed/common/Ticker.o \ - $(OBJDIR)/libraries/mbed/common/FilePath.o \ - $(OBJDIR)/libraries/mbed/common/I2C.o \ - $(OBJDIR)/libraries/mbed/common/FileBase.o \ - $(OBJDIR)/libraries/mbed/common/retarget.o \ - $(OBJDIR)/libraries/mbed/common/Serial.o \ - $(OBJDIR)/libraries/mbed/common/Stream.o \ - $(OBJDIR)/libraries/mbed/common/FileSystemLike.o \ - $(OBJDIR)/libraries/mbed/common/CallChain.o \ - $(OBJDIR)/libraries/mbed/common/InterruptManager.o \ - $(OBJDIR)/libraries/mbed/common/SerialBase.o \ - $(OBJDIR)/libraries/mbed/common/BusInOut.o \ - $(OBJDIR)/libraries/mbed/common/SPISlave.o \ - $(OBJDIR)/libraries/mbed/common/I2CSlave.o \ - $(OBJDIR)/libraries/mbed/common/FunctionPointer.o \ - $(OBJDIR)/libraries/mbed/common/Timer.o \ - $(OBJDIR)/libraries/mbed/common/SPI.o \ - $(OBJDIR)/libraries/mbed/common/Timeout.o \ - $(OBJDIR)/libraries/mbed/common/Ethernet.o \ - $(OBJDIR)/libraries/mbed/common/TimerEvent.o \ - $(OBJDIR)/libraries/mbed/common/CAN.o \ - $(OBJDIR)/libraries/mbed/common/BusOut.o \ - $(OBJDIR)/libraries/mbed/common/FileLike.o \ $(OBJDIR)/libraries/mbed/common/BusIn.o \ + $(OBJDIR)/libraries/mbed/common/BusInOut.o \ + $(OBJDIR)/libraries/mbed/common/BusOut.o \ + $(OBJDIR)/libraries/mbed/common/CAN.o \ + $(OBJDIR)/libraries/mbed/common/CallChain.o \ + $(OBJDIR)/libraries/mbed/common/Ethernet.o \ + $(OBJDIR)/libraries/mbed/common/FileBase.o \ + $(OBJDIR)/libraries/mbed/common/FileLike.o \ + $(OBJDIR)/libraries/mbed/common/FilePath.o \ + $(OBJDIR)/libraries/mbed/common/FileSystemLike.o \ + $(OBJDIR)/libraries/mbed/common/FunctionPointer.o \ + $(OBJDIR)/libraries/mbed/common/I2C.o \ + $(OBJDIR)/libraries/mbed/common/I2CSlave.o \ $(OBJDIR)/libraries/mbed/common/InterruptIn.o \ + $(OBJDIR)/libraries/mbed/common/InterruptManager.o \ $(OBJDIR)/libraries/mbed/common/LocalFileSystem.o \ - $(OBJDIR)/libraries/USBDevice/USBHID/USBMouse.o \ - $(OBJDIR)/libraries/USBDevice/USBHID/USBHID.o \ - $(OBJDIR)/libraries/USBDevice/USBHID/USBMouseKeyboard.o \ - $(OBJDIR)/libraries/USBDevice/USBHID/USBKeyboard.o \ - $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_KL25Z.o \ + $(OBJDIR)/libraries/mbed/common/RawSerial.o \ + $(OBJDIR)/libraries/mbed/common/SPI.o \ + $(OBJDIR)/libraries/mbed/common/SPISlave.o \ + $(OBJDIR)/libraries/mbed/common/Serial.o \ + $(OBJDIR)/libraries/mbed/common/SerialBase.o \ + $(OBJDIR)/libraries/mbed/common/Stream.o \ + $(OBJDIR)/libraries/mbed/common/Ticker.o \ + $(OBJDIR)/libraries/mbed/common/Timeout.o \ + $(OBJDIR)/libraries/mbed/common/Timer.o \ + $(OBJDIR)/libraries/mbed/common/TimerEvent.o \ + $(OBJDIR)/libraries/mbed/common/assert.o \ + $(OBJDIR)/libraries/mbed/common/board.o \ + $(OBJDIR)/libraries/mbed/common/error.o \ + $(OBJDIR)/libraries/mbed/common/exit.o \ + $(OBJDIR)/libraries/mbed/common/gpio.o \ + $(OBJDIR)/libraries/mbed/common/mbed_interface.o \ + $(OBJDIR)/libraries/mbed/common/pinmap_common.o \ + $(OBJDIR)/libraries/mbed/common/retarget.o \ + $(OBJDIR)/libraries/mbed/common/rtc_time.o \ + $(OBJDIR)/libraries/mbed/common/semihost_api.o \ + $(OBJDIR)/libraries/mbed/common/us_ticker_api.o \ + $(OBJDIR)/libraries/mbed/common/wait_api.o \ + $(OBJDIR)/libraries/USBDevice/USBAudio/USBAudio.o \ $(OBJDIR)/libraries/USBDevice/USBDevice/USBDevice.o \ + $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_KL25Z.o \ + $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_LPC11U.o \ $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_LPC17.o \ $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_LPC40.o \ - $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_LPC11U.o \ + $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_RZ_A1H.o \ $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_STM32F4.o \ - $(OBJDIR)/libraries/USBDevice/USBAudio/USBAudio.o \ - $(OBJDIR)/libraries/USBDevice/USBSerial/USBSerial.o \ - $(OBJDIR)/libraries/USBDevice/USBSerial/USBCDC.o \ + $(OBJDIR)/libraries/USBDevice/USBHID/USBHID.o \ + $(OBJDIR)/libraries/USBDevice/USBHID/USBKeyboard.o \ + $(OBJDIR)/libraries/USBDevice/USBHID/USBMouse.o \ + $(OBJDIR)/libraries/USBDevice/USBHID/USBMouseKeyboard.o \ + $(OBJDIR)/libraries/USBDevice/USBMIDI/USBMIDI.o \ $(OBJDIR)/libraries/USBDevice/USBMSD/USBMSD.o \ - $(OBJDIR)/libraries/USBDevice/USBMIDI/USBMIDI.o + $(OBJDIR)/libraries/USBDevice/USBSerial/USBCDC.o \ + $(OBJDIR)/libraries/USBDevice/USBSerial/USBSerial.o INCLUDE_PATHS += \ - -I$(MBED_DIR)/libraries/mbed/targets \ - -I$(MBED_DIR)/libraries/mbed/targets/hal \ - -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_NXP \ - -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX \ - -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/TARGET_LPC11U35_401 \ - -I$(MBED_DIR)/libraries/mbed/targets/cmsis \ - -I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_NXP \ - -I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX \ - -I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM \ - -I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM/TARGET_LPC11U35_401 \ -I$(MBED_DIR)/libraries/mbed \ - -I$(MBED_DIR)/libraries/mbed/hal \ -I$(MBED_DIR)/libraries/mbed/api \ -I$(MBED_DIR)/libraries/mbed/common \ + -I$(MBED_DIR)/libraries/mbed/hal \ -I$(MBED_DIR)/libraries/USBDevice \ - -I$(MBED_DIR)/libraries/USBDevice/USBHID \ - -I$(MBED_DIR)/libraries/USBDevice/USBDevice \ -I$(MBED_DIR)/libraries/USBDevice/USBAudio \ - -I$(MBED_DIR)/libraries/USBDevice/USBSerial \ + -I$(MBED_DIR)/libraries/USBDevice/USBDevice \ + -I$(MBED_DIR)/libraries/USBDevice/USBHID \ + -I$(MBED_DIR)/libraries/USBDevice/USBMIDI \ -I$(MBED_DIR)/libraries/USBDevice/USBMSD \ - -I$(MBED_DIR)/libraries/USBDevice/USBMIDI + -I$(MBED_DIR)/libraries/USBDevice/USBSerial +# TMK mbed protocol OBJECTS += \ $(OBJDIR)/protocol/mbed/mbed_driver.o \ - $(OBJDIR)/protocol/mbed/HIDKeyboard.o \ + $(OBJDIR)/protocol/mbed/HIDKeyboard.o INCLUDE_PATHS += \ -I$(TMK_DIR)/protocol/mbed - -LINKER_SCRIPT = $(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM/TARGET_LPC11U35_401/LPC11U35.ld From 37319210633c0972f969b41924a0f4f6f4e353e8 Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Sun, 14 Dec 2014 15:52:33 +0900 Subject: [PATCH 3/7] Fix ps2 protocol build using ps2_io.h --- protocol/ps2_interrupt.c | 1 + protocol/ps2_usart.c | 1 + 2 files changed, 2 insertions(+) diff --git a/protocol/ps2_interrupt.c b/protocol/ps2_interrupt.c index 259d2540..8114442b 100644 --- a/protocol/ps2_interrupt.c +++ b/protocol/ps2_interrupt.c @@ -43,6 +43,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #include "ps2.h" +#include "ps2_io.h" #include "print.h" diff --git a/protocol/ps2_usart.c b/protocol/ps2_usart.c index c2d9d0a2..6936ca7b 100644 --- a/protocol/ps2_usart.c +++ b/protocol/ps2_usart.c @@ -43,6 +43,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #include "ps2.h" +#include "ps2_io.h" #include "print.h" From d239315cf13c2ad08e3836d25a7ca54721554a9f Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Fri, 2 Jan 2015 21:16:40 +0900 Subject: [PATCH 4/7] Add keyboard/infinity --- tool/mbed/lpc11u35_501.mk | 2 +- tool/mbed/mbed.mk | 114 ++++++++++++++++++++------------------ tool/mbed/mk20d50m.mk | 45 +++++++++++++++ 3 files changed, 105 insertions(+), 56 deletions(-) create mode 100644 tool/mbed/mk20d50m.mk diff --git a/tool/mbed/lpc11u35_501.mk b/tool/mbed/lpc11u35_501.mk index af1aad79..15e14910 100644 --- a/tool/mbed/lpc11u35_501.mk +++ b/tool/mbed/lpc11u35_501.mk @@ -44,6 +44,6 @@ INCLUDE_PATHS += \ -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_NXP \ -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX \ -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/TARGET_MCU_LPC11U35_501 \ - -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/TARGET_MCU_LPC11U35_501/TARGET_LPC11U35_501 \ + -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/TARGET_MCU_LPC11U35_501/TARGET_LPC11U35_501 LINKER_SCRIPT = $(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM/TARGET_LPC11U35_501/LPC11U35.ld diff --git a/tool/mbed/mbed.mk b/tool/mbed/mbed.mk index 242d7879..db322b26 100644 --- a/tool/mbed/mbed.mk +++ b/tool/mbed/mbed.mk @@ -2,60 +2,64 @@ # see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded OBJECTS += \ - $(OBJDIR)/libraries/mbed/common/BusIn.o \ - $(OBJDIR)/libraries/mbed/common/BusInOut.o \ - $(OBJDIR)/libraries/mbed/common/BusOut.o \ - $(OBJDIR)/libraries/mbed/common/CAN.o \ - $(OBJDIR)/libraries/mbed/common/CallChain.o \ - $(OBJDIR)/libraries/mbed/common/Ethernet.o \ - $(OBJDIR)/libraries/mbed/common/FileBase.o \ - $(OBJDIR)/libraries/mbed/common/FileLike.o \ - $(OBJDIR)/libraries/mbed/common/FilePath.o \ - $(OBJDIR)/libraries/mbed/common/FileSystemLike.o \ - $(OBJDIR)/libraries/mbed/common/FunctionPointer.o \ - $(OBJDIR)/libraries/mbed/common/I2C.o \ - $(OBJDIR)/libraries/mbed/common/I2CSlave.o \ - $(OBJDIR)/libraries/mbed/common/InterruptIn.o \ - $(OBJDIR)/libraries/mbed/common/InterruptManager.o \ - $(OBJDIR)/libraries/mbed/common/LocalFileSystem.o \ - $(OBJDIR)/libraries/mbed/common/RawSerial.o \ - $(OBJDIR)/libraries/mbed/common/SPI.o \ - $(OBJDIR)/libraries/mbed/common/SPISlave.o \ - $(OBJDIR)/libraries/mbed/common/Serial.o \ - $(OBJDIR)/libraries/mbed/common/SerialBase.o \ - $(OBJDIR)/libraries/mbed/common/Stream.o \ - $(OBJDIR)/libraries/mbed/common/Ticker.o \ - $(OBJDIR)/libraries/mbed/common/Timeout.o \ - $(OBJDIR)/libraries/mbed/common/Timer.o \ - $(OBJDIR)/libraries/mbed/common/TimerEvent.o \ - $(OBJDIR)/libraries/mbed/common/assert.o \ - $(OBJDIR)/libraries/mbed/common/board.o \ - $(OBJDIR)/libraries/mbed/common/error.o \ - $(OBJDIR)/libraries/mbed/common/exit.o \ $(OBJDIR)/libraries/mbed/common/gpio.o \ - $(OBJDIR)/libraries/mbed/common/mbed_interface.o \ - $(OBJDIR)/libraries/mbed/common/pinmap_common.o \ - $(OBJDIR)/libraries/mbed/common/retarget.o \ - $(OBJDIR)/libraries/mbed/common/rtc_time.o \ - $(OBJDIR)/libraries/mbed/common/semihost_api.o \ $(OBJDIR)/libraries/mbed/common/us_ticker_api.o \ - $(OBJDIR)/libraries/mbed/common/wait_api.o \ - $(OBJDIR)/libraries/USBDevice/USBAudio/USBAudio.o \ - $(OBJDIR)/libraries/USBDevice/USBDevice/USBDevice.o \ - $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_KL25Z.o \ - $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_LPC11U.o \ - $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_LPC17.o \ - $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_LPC40.o \ - $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_RZ_A1H.o \ - $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_STM32F4.o \ - $(OBJDIR)/libraries/USBDevice/USBHID/USBHID.o \ - $(OBJDIR)/libraries/USBDevice/USBHID/USBKeyboard.o \ - $(OBJDIR)/libraries/USBDevice/USBHID/USBMouse.o \ - $(OBJDIR)/libraries/USBDevice/USBHID/USBMouseKeyboard.o \ - $(OBJDIR)/libraries/USBDevice/USBMIDI/USBMIDI.o \ - $(OBJDIR)/libraries/USBDevice/USBMSD/USBMSD.o \ - $(OBJDIR)/libraries/USBDevice/USBSerial/USBCDC.o \ - $(OBJDIR)/libraries/USBDevice/USBSerial/USBSerial.o + $(OBJDIR)/libraries/mbed/common/wait_api.o + +# $(OBJDIR)/libraries/mbed/common/assert.o \ +# $(OBJDIR)/libraries/mbed/common/board.o \ +# $(OBJDIR)/libraries/mbed/common/BusIn.o \ +# $(OBJDIR)/libraries/mbed/common/BusInOut.o \ +# $(OBJDIR)/libraries/mbed/common/BusOut.o \ +# $(OBJDIR)/libraries/mbed/common/CallChain.o \ +# $(OBJDIR)/libraries/mbed/common/CAN.o \ +# $(OBJDIR)/libraries/mbed/common/error.o \ +# $(OBJDIR)/libraries/mbed/common/Ethernet.o \ +# $(OBJDIR)/libraries/mbed/common/exit.o \ +# $(OBJDIR)/libraries/mbed/common/FileBase.o \ +# $(OBJDIR)/libraries/mbed/common/FileLike.o \ +# $(OBJDIR)/libraries/mbed/common/FilePath.o \ +# $(OBJDIR)/libraries/mbed/common/FileSystemLike.o \ +# $(OBJDIR)/libraries/mbed/common/FunctionPointer.o \ +# $(OBJDIR)/libraries/mbed/common/gpio.o \ +# $(OBJDIR)/libraries/mbed/common/I2C.o \ +# $(OBJDIR)/libraries/mbed/common/I2CSlave.o \ +# $(OBJDIR)/libraries/mbed/common/InterruptIn.o \ +# $(OBJDIR)/libraries/mbed/common/InterruptManager.o \ +# $(OBJDIR)/libraries/mbed/common/LocalFileSystem.o \ +# $(OBJDIR)/libraries/mbed/common/mbed_interface.o \ +# $(OBJDIR)/libraries/mbed/common/pinmap_common.o \ +# $(OBJDIR)/libraries/mbed/common/RawSerial.o \ +# $(OBJDIR)/libraries/mbed/common/retarget.o \ +# $(OBJDIR)/libraries/mbed/common/rtc_time.o \ +# $(OBJDIR)/libraries/mbed/common/semihost_api.o \ +# $(OBJDIR)/libraries/mbed/common/SerialBase.o \ +# $(OBJDIR)/libraries/mbed/common/Serial.o \ +# $(OBJDIR)/libraries/mbed/common/SPI.o \ +# $(OBJDIR)/libraries/mbed/common/SPISlave.o \ +# $(OBJDIR)/libraries/mbed/common/Stream.o \ +# $(OBJDIR)/libraries/mbed/common/Ticker.o \ +# $(OBJDIR)/libraries/mbed/common/Timeout.o \ +# $(OBJDIR)/libraries/mbed/common/TimerEvent.o \ +# $(OBJDIR)/libraries/mbed/common/Timer.o \ +# $(OBJDIR)/libraries/mbed/common/us_ticker_api.o \ +# $(OBJDIR)/libraries/mbed/common/wait_api.o \ +# $(OBJDIR)/libraries/USBDevice/USBAudio/USBAudio.o \ +# $(OBJDIR)/libraries/USBDevice/USBDevice/USBDevice.o \ +# $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_KL25Z.o \ +# $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_LPC11U.o \ +# $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_LPC17.o \ +# $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_LPC40.o \ +# $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_RZ_A1H.o \ +# $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_STM32F4.o \ +# $(OBJDIR)/libraries/USBDevice/USBHID/USBHID.o \ +# $(OBJDIR)/libraries/USBDevice/USBHID/USBKeyboard.o \ +# $(OBJDIR)/libraries/USBDevice/USBHID/USBMouseKeyboard.o \ +# $(OBJDIR)/libraries/USBDevice/USBHID/USBMouse.o \ +# $(OBJDIR)/libraries/USBDevice/USBMIDI/USBMIDI.o \ +# $(OBJDIR)/libraries/USBDevice/USBMSD/USBMSD.o \ +# $(OBJDIR)/libraries/USBDevice/USBSerial/USBCDC.o \ +# $(OBJDIR)/libraries/USBDevice/USBSerial/USBSerial.o INCLUDE_PATHS += \ -I$(MBED_DIR)/libraries/mbed \ @@ -71,9 +75,9 @@ INCLUDE_PATHS += \ -I$(MBED_DIR)/libraries/USBDevice/USBSerial # TMK mbed protocol -OBJECTS += \ - $(OBJDIR)/protocol/mbed/mbed_driver.o \ - $(OBJDIR)/protocol/mbed/HIDKeyboard.o +#OBJECTS += \ +# $(OBJDIR)/protocol/mbed/mbed_driver.o \ +# $(OBJDIR)/protocol/mbed/HIDKeyboard.o INCLUDE_PATHS += \ -I$(TMK_DIR)/protocol/mbed diff --git a/tool/mbed/mk20d50m.mk b/tool/mbed/mk20d50m.mk new file mode 100644 index 00000000..eb7bde64 --- /dev/null +++ b/tool/mbed/mk20d50m.mk @@ -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 From 629e3e17be543e55c5ff8f0096987c89ef4e78bb Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Sat, 3 Jan 2015 20:21:23 +0900 Subject: [PATCH 5/7] Fix linker script for NVIC vector on RAM --- tool/mbed/mk20d50m.mk | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tool/mbed/mk20d50m.mk b/tool/mbed/mk20d50m.mk index eb7bde64..e62e39d2 100644 --- a/tool/mbed/mk20d50m.mk +++ b/tool/mbed/mk20d50m.mk @@ -41,5 +41,4 @@ INCLUDE_PATHS += \ -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 +LINKER_SCRIPT = infinity.ld From 58284dd19b9dcce72966622fedec75cdd70092ec Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Sun, 4 Jan 2015 03:27:24 +0900 Subject: [PATCH 6/7] infinity: Move project specific files to local --- tool/mbed/mk20d50m.mk | 44 ------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 tool/mbed/mk20d50m.mk diff --git a/tool/mbed/mk20d50m.mk b/tool/mbed/mk20d50m.mk deleted file mode 100644 index e62e39d2..00000000 --- a/tool/mbed/mk20d50m.mk +++ /dev/null @@ -1,44 +0,0 @@ -# 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 = infinity.ld From 9218133d0bbd35f6178fee717c87ebb927a86769 Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Sun, 4 Jan 2015 17:03:47 +0900 Subject: [PATCH 7/7] infinity: Add initial files for keyboard support --- README.md | 2 ++ common/matrix.h | 9 ++++++++- common/mbed/xprintf.cpp | 5 +++++ tool/mbed/lpc11u35_501.mk | 1 + tool/mbed/mbed.mk | 10 ++++++---- 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a01de8c6..e077fc92 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ You can find some keyboard specific projects under `converter` and `keyboard` di * [macway](keyboard/macway/) - [Compact keyboard mod][GH_macway] [retired] * [KMAC](keyboard/kmac/) - Korean custom keyboard * [Lightsaber](keyboard/lightsaber/) - Korean custom keyboard +* [Infinity](keyboard/infinity/) - Massdrop [Infinity keyboard][Infinity] [GH_macway]: http://geekhack.org/showwiki.php?title=Island:11930 [GH_hhkb]: http://geekhack.org/showwiki.php?title=Island:12047 @@ -72,6 +73,7 @@ You can find some keyboard specific projects under `converter` and `keyboard` di [PC98]: http://en.wikipedia.org/wiki/NEC_PC-9801 [Sun]: http://en.wikipedia.org/wiki/Sun-3 [IIGS]: http://en.wikipedia.org/wiki/Apple_IIGS +[Infinity]: https://www.massdrop.com/buy/infinity-keyboard-kit diff --git a/common/matrix.h b/common/matrix.h index 23fef78f..107ee726 100644 --- a/common/matrix.h +++ b/common/matrix.h @@ -35,6 +35,10 @@ typedef uint32_t matrix_row_t; #define MATRIX_IS_ON(row, col) (matrix_get_row(row) && (1<