Skip to content

Commit

Permalink
Add support for building against ChibiOS svn/trunk.
Browse files Browse the repository at this point in the history
  • Loading branch information
tzarc committed Aug 29, 2021
1 parent 1ac3b3e commit 0689625
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 6 deletions.
23 changes: 18 additions & 5 deletions tmk_core/chibios.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ endif
OPT_OS = chibios
CHIBIOS = $(TOP_DIR)/lib/chibios
CHIBIOS_CONTRIB = $(TOP_DIR)/lib/chibios-contrib

CHIBIOS_PORT ?=
ifeq ("$(CHIBIOS_PORT)","")
CHIBIOS_PORT = ARMv$(ARMV)-M
endif

# Startup files. Try a few different locations, for compability with old versions and
# for things hardware in the contrib repository
STARTUP_MK = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_$(MCU_STARTUP).mk
Expand Down Expand Up @@ -165,18 +171,25 @@ include $(BOARD_MK)
-include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk # ChibiOS >= 20.x
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
# Compability with old version
PORT_V = $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v$(ARMV)m.mk
PORT_V = $(CHIBIOS)/os/common/ports/$(CHIBIOS_PORT)/compilers/GCC/mk/port.mk
ifeq ("$(wildcard $(PORT_V))","")
PORT_V = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v$(ARMV)m.mk
# Compability with =20.x
PORT_V = $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v$(ARMV)m.mk
ifeq ("$(wildcard $(PORT_V))","")
# Compability with <=19.x
PORT_V = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v$(ARMV)m.mk
endif
endif
include $(PORT_V)
# Other files (optional).
include $(CHIBIOS)/os/hal/lib/streams/streams.mk

RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
RULESPATH = $(CHIBIOS)/os/common/ports/$(CHIBIOS_PORT)/compilers/GCC
ifeq ("$(wildcard $(RULESPATH)/rules.mk)","")
RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
ifeq ("$(wildcard $(RULESPATH)/rules.mk)","")
RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
endif
endif

# Define linker script file here
Expand Down
12 changes: 11 additions & 1 deletion tmk_core/protocol/chibios/usb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ uint8_t keyboard_protocol __attribute__((aligned(2))) = 1;
uint8_t keyboard_led_state = 0;
volatile uint16_t keyboard_idle_count = 0;
static virtual_timer_t keyboard_idle_timer;
static void keyboard_idle_timer_cb(void *arg);

#if CH_KERNEL_MAJOR >= 7
static void keyboard_idle_timer_cb(struct ch_virtual_timer *, void *arg);
#elif CH_KERNEL_MAJOR <= 6
static void keyboard_idle_timer_cb(void *arg);
#endif

report_keyboard_t keyboard_report_sent = {{0}};
#ifdef MOUSE_ENABLE
Expand Down Expand Up @@ -761,7 +766,12 @@ void kbd_sof_cb(USBDriver *usbp) { (void)usbp; }

/* Idle requests timer code
* callback (called from ISR, unlocked state) */
#if CH_KERNEL_MAJOR >= 7
static void keyboard_idle_timer_cb(struct ch_virtual_timer *timer, void *arg) {
(void)timer;
#elif CH_KERNEL_MAJOR <= 6
static void keyboard_idle_timer_cb(void *arg) {
#endif
USBDriver *usbp = (USBDriver *)arg;

osalSysLockFromISR();
Expand Down
11 changes: 11 additions & 0 deletions util/chibios_conf_updater.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
set -eEuo pipefail
umask 022

#####################
# You will need to get an older JDK -- JDK 8
#
# !!!!!!!! DO NOT INSTALL THIS IF YOU HAVE AN EXISTING JDK OR JRE INSTALLED !!!!!!!!
#
# For Debian 10-ish distro's:
# wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -
# sudo add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
# sudo apt-get update && sudo apt-get install adoptopenjdk-8-hotspot


sinfo() { echo "$@" >&2 ; }
shead() { sinfo "" ; sinfo "---------------------------------" ; sinfo "-- $@" ; sinfo "---------------------------------" ; }
havecmd() { command command type "${1}" >/dev/null 2>&1 || return 1 ; }
Expand Down

0 comments on commit 0689625

Please sign in to comment.