Skip to content

Commit

Permalink
Allow for ChibiOS 20.x (master), as well as enabling ChibiOS-Contrib …
Browse files Browse the repository at this point in the history
…HAL. (qmk#8272)
  • Loading branch information
tzarc committed Mar 1, 2020
1 parent c775104 commit d0c3acb
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 210 deletions.
101 changes: 0 additions & 101 deletions drivers/boards/ld/MK20DX256.ld

This file was deleted.

105 changes: 0 additions & 105 deletions keyboards/handwired/bluepill/ld/MKL26Z64.ld

This file was deleted.

1 change: 1 addition & 0 deletions keyboards/handwired/onekey/teensy_lc/rules.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# MCU name
MCU = MKL26Z64
USE_CHIBIOS_CONTRIB = yes

# Enter lower-power sleep mode when on the ChibiOS idle thread
OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE
30 changes: 27 additions & 3 deletions tmk_core/chibios.mk
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ ifeq ("$(wildcard $(BOARD_MK))","")
endif

include $(BOARD_MK)
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
-include $(CHIBIOS)/os/hal/osal/rt/osal.mk # ChibiOS <= 19.x
-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
Expand Down Expand Up @@ -112,6 +113,7 @@ else ifneq ("$(wildcard $(TOP_DIR)/drivers/boards/ld/$(MCU_LDSCRIPT).ld)","")
LDSCRIPT = $(TOP_DIR)/drivers/boards/ld/$(MCU_LDSCRIPT).ld
else ifneq ("$(wildcard $(STARTUPLD_CONTRIB)/$(MCU_LDSCRIPT).ld)","")
LDSCRIPT = $(STARTUPLD_CONTRIB)/$(MCU_LDSCRIPT).ld
USE_CHIBIOS_CONTRIB = yes
else
LDSCRIPT = $(STARTUPLD)/$(MCU_LDSCRIPT).ld
endif
Expand All @@ -122,7 +124,6 @@ CHIBISRC = $(STARTUPSRC) \
$(OSALSRC) \
$(HALSRC) \
$(PLATFORMSRC) \
$(PLATFORMSRC_CONTRIB) \
$(BOARDSRC) \
$(STREAMSSRC) \
$(CHIBIOS)/os/various/syscalls.c
Expand All @@ -134,9 +135,32 @@ CHIBISRC := $(patsubst $(TOP_DIR)/%,%,$(CHIBISRC))

EXTRAINCDIRS += $(CHIBIOS)/os/license $(CHIBIOS)/os/oslib/include \
$(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \
$(HALINC) $(PLATFORMINC) $(PLATFORMINC_CONTRIB) $(BOARDINC) $(TESTINC) \
$(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \
$(STREAMSINC) $(CHIBIOS)/os/various $(COMMON_VPATH)

#
# ChibiOS-Contrib
##############################################################################

# Work out if we're using ChibiOS-Contrib by checking if halconf_community.h exists
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/halconf_community.h)","")
USE_CHIBIOS_CONTRIB = yes
else ifneq ("$(wildcard $(KEYBOARD_PATH_4)/halconf_community.h)","")
USE_CHIBIOS_CONTRIB = yes
else ifneq ("$(wildcard $(KEYBOARD_PATH_3)/halconf_community.h)","")
USE_CHIBIOS_CONTRIB = yes
else ifneq ("$(wildcard $(KEYBOARD_PATH_2)/halconf_community.h)","")
USE_CHIBIOS_CONTRIB = yes
else ifneq ("$(wildcard $(KEYBOARD_PATH_1)/halconf_community.h)","")
USE_CHIBIOS_CONTRIB = yes
endif

ifeq ($(strip $(USE_CHIBIOS_CONTRIB)),yes)
include $(CHIBIOS_CONTRIB)/os/hal/hal.mk
CHIBISRC += $(PLATFORMSRC_CONTRIB) $(HALSRC_CONTRIB)
EXTRAINCDIRS += $(PLATFORMINC_CONTRIB) $(HALINC_CONTRIB) $(CHIBIOS_CONTRIB)/os/various
endif

#
# Project, sources and paths
##############################################################################
Expand Down
2 changes: 1 addition & 1 deletion util/chibios-upgrader.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ find_chibi_files() {
local search_path="$1"
shift
local conditions=( "$@" )
find "$search_path" -not -path '*/lib/chibios*' -and -not -path '*/lib/ugfx*' -and -not -path '*/util/*' -and \( "${conditions[@]}" \) | sort
find -L "$search_path" -not -path '*/lib/chibios*' -and -not -path '*/lib/ugfx*' -and -not -path '*/util/*' -and \( "${conditions[@]}" \) | sort
}

revert_chibi_files() {
Expand Down

0 comments on commit d0c3acb

Please sign in to comment.