2015-10-05 22:34:50 +08:00
|
|
|
|
|
|
|
ifndef ZEPHYR_SDK_INSTALL_DIR
|
|
|
|
$(error ZEPHYR_SDK_INSTALL_DIR is not set)
|
|
|
|
endif
|
|
|
|
|
2015-12-16 06:30:35 +08:00
|
|
|
ifeq ($(HOST_OS),MINGW)
|
|
|
|
TOOLCHAIN_HOME = ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/i686-pokysdk-mingw32
|
|
|
|
else
|
|
|
|
TOOLCHAIN_HOME = ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/i686-pokysdk-linux
|
|
|
|
endif
|
|
|
|
|
2015-10-05 22:34:50 +08:00
|
|
|
# arm
|
|
|
|
CROSS_COMPILE_TARGET_arm = arm-poky-eabi
|
2015-12-16 06:30:35 +08:00
|
|
|
CROSS_COMPILE_arm=$(TOOLCHAIN_HOME)/usr/bin/$(CROSS_COMPILE_TARGET_arm)/$(CROSS_COMPILE_TARGET_arm)-
|
2016-01-07 00:48:30 +08:00
|
|
|
CROSS_COMPILE_arm_version = $(shell $(CROSS_COMPILE_arm)gcc -dumpversion)
|
2016-02-11 05:18:36 +08:00
|
|
|
|
|
|
|
CROSS_COMPILE_arm_isa_thumb2-y = "thumb/thumb2"
|
|
|
|
CROSS_COMPILE_arm_isa = $(CROSS_COMPILE_arm_isa_thumb2-$(CONFIG_ISA_THUMB2))
|
|
|
|
|
|
|
|
LIB_INCLUDE_DIR_arm += -L ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/armv5-poky-eabi/usr/${CROSS_COMPILE_TARGET_arm}/lib/$(CROSS_COMPILE_arm_isa)
|
|
|
|
LIB_INCLUDE_DIR_arm += -L ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/armv5-poky-eabi/usr/lib/$(CROSS_COMPILE_TARGET_arm)/$(CROSS_COMPILE_arm_version)/$(CROSS_COMPILE_arm_isa)
|
2016-01-26 05:33:40 +08:00
|
|
|
TOOLCHAIN_CFLAGS_arm = -I${ZEPHYR_SDK_INSTALL_DIR}/sysroots/armv5-poky-eabi/usr/${CROSS_COMPILE_TARGET_arm}/include
|
2015-10-05 22:34:50 +08:00
|
|
|
|
|
|
|
# iamcu
|
|
|
|
CROSS_COMPILE_TARGET_iamcu = i586-poky-elfiamcu
|
2015-12-16 06:30:35 +08:00
|
|
|
CROSS_COMPILE_iamcu=$(TOOLCHAIN_HOME)/usr/bin/iamcu-poky-elfiamcu/$(CROSS_COMPILE_TARGET_iamcu)-
|
2016-01-07 00:48:30 +08:00
|
|
|
CROSS_COMPILE_iamcu_version = $(shell $(CROSS_COMPILE_iamcu)gcc -dumpversion)
|
2015-10-05 22:34:50 +08:00
|
|
|
|
|
|
|
LIB_INCLUDE_DIR_iamcu = -L ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/iamcu-poky-elfiamcu/usr/lib/i586-poky-elfiamcu/$(CROSS_COMPILE_iamcu_version)
|
|
|
|
LIB_INCLUDE_DIR_iamcu += -L ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/iamcu-poky-elfiamcu/usr/i586-default-elfiamcu/lib/
|
|
|
|
TOOLCHAIN_CFLAGS_iamcu = -I${ZEPHYR_SDK_INSTALL_DIR}/sysroots/iamcu-poky-elfiamcu/usr/i586-default-elfiamcu/include
|
|
|
|
|
|
|
|
# x86
|
|
|
|
CROSS_COMPILE_TARGET_x86 = i586-poky-elf
|
2015-12-16 06:30:35 +08:00
|
|
|
CROSS_COMPILE_x86=$(TOOLCHAIN_HOME)/usr/bin/$(CROSS_COMPILE_TARGET_x86)/$(CROSS_COMPILE_TARGET_x86)-
|
2016-01-07 00:48:30 +08:00
|
|
|
CROSS_COMPILE_x86_version = $(shell $(CROSS_COMPILE_x86)gcc -dumpversion)
|
2015-10-05 22:34:50 +08:00
|
|
|
|
|
|
|
LIB_INCLUDE_DIR_x86 = -L ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/i586-poky-elf/usr/lib/i586-poky-elf/$(CROSS_COMPILE_x86_version)
|
|
|
|
LIB_INCLUDE_DIR_x86 += -L ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/i586-poky-elf/usr/${CROSS_COMPILE_TARGET_x86}/lib
|
|
|
|
TOOLCHAIN_CFLAGS_x86 = -I${ZEPHYR_SDK_INSTALL_DIR}/sysroots/i586-poky-elf/usr/${CROSS_COMPILE_TARGET_x86}/include
|
|
|
|
|
|
|
|
# arc
|
|
|
|
CROSS_COMPILE_TARGET_arc = arc-poky-elf
|
2015-12-16 06:30:35 +08:00
|
|
|
CROSS_COMPILE_arc=$(TOOLCHAIN_HOME)/usr/bin/$(CROSS_COMPILE_TARGET_arc)/$(CROSS_COMPILE_TARGET_arc)-
|
2016-01-07 00:48:30 +08:00
|
|
|
CROSS_COMPILE_arc_version = $(shell $(CROSS_COMPILE_arc)gcc -dumpversion)
|
2015-10-05 22:34:50 +08:00
|
|
|
|
|
|
|
LIB_INCLUDE_DIR_arc = -L ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/$(CROSS_COMPILE_TARGET_arc)/usr/lib/$(CROSS_COMPILE_TARGET_arc)/$(CROSS_COMPILE_arc_version)/em
|
2016-01-26 05:33:40 +08:00
|
|
|
LIB_INCLUDE_DIR_arc += -L ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/$(CROSS_COMPILE_TARGET_arc)/usr/${CROSS_COMPILE_TARGET_arc}/lib/em
|
|
|
|
TOOLCHAIN_CFLAGS_arc = -I${ZEPHYR_SDK_INSTALL_DIR}/sysroots/$(CROSS_COMPILE_TARGET_arc)/usr/${CROSS_COMPILE_TARGET_arc}/include
|
2015-10-05 22:34:50 +08:00
|
|
|
|
2016-04-22 01:10:47 +08:00
|
|
|
# nios2
|
|
|
|
CROSS_COMPILE_TARGET_nios2 = nios2-poky-elf
|
|
|
|
CROSS_COMPILE_nios2 = $(TOOLCHAIN_HOME)/usr/bin/$(CROSS_COMPILE_TARGET_nios2)/$(CROSS_COMPILE_TARGET_nios2)-
|
|
|
|
CROSS_COMPILE_nios2_version = $(shell $(CROSS_COMPILE_nios2)gcc -dumpversion)
|
|
|
|
|
|
|
|
LIB_INCLUDE_DIR_nios2 = -L ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/$(CROSS_COMPILE_TARGET_nios2)/usr/lib/$(CROSS_COMPILE_TARGET_nios2)/$(CROSS_COMPILE_nios2_version)
|
|
|
|
LIB_INCLUDE_DIR_nios2 += -L ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/$(CROSS_COMPILE_TARGET_nios2)/usr/lib
|
|
|
|
TOOLCHAIN_CFLAGS_nios2 = -I${ZEPHYR_SDK_INSTALL_DIR}/sysroots/$(CROSS_COMPILE_TARGET_nios2)/usr/include
|
|
|
|
|
2015-10-05 22:34:50 +08:00
|
|
|
ifneq ($(CONFIG_TOOLCHAIN_VARIANT),"")
|
|
|
|
CROSS_COMPILE = $(CROSS_COMPILE_$(subst $\",,$(CONFIG_TOOLCHAIN_VARIANT)))
|
|
|
|
LIB_INCLUDE_DIR = $(LIB_INCLUDE_DIR_$(subst $\",,$(CONFIG_TOOLCHAIN_VARIANT)))
|
|
|
|
TOOLCHAIN_CFLAGS = $(TOOLCHAIN_CFLAGS_$(subst $\",,$(CONFIG_TOOLCHAIN_VARIANT)))
|
|
|
|
else
|
|
|
|
CROSS_COMPILE = $(CROSS_COMPILE_$(ARCH))
|
|
|
|
LIB_INCLUDE_DIR = $(LIB_INCLUDE_DIR_$(ARCH))
|
|
|
|
TOOLCHAIN_CFLAGS = $(TOOLCHAIN_CFLAGS_$(ARCH))
|
|
|
|
endif
|
|
|
|
|
2015-12-16 06:30:35 +08:00
|
|
|
QEMU_BIN_PATH ?= $(TOOLCHAIN_HOME)/usr/bin
|
2015-10-05 22:34:50 +08:00
|
|
|
QEMU = $(QEMU_BIN_PATH)/$(QEMU_$(SRCARCH))
|
2015-12-16 06:30:35 +08:00
|
|
|
QEMU_BIOS=$(TOOLCHAIN_HOME)/usr/share/qemu
|
2015-10-05 22:34:50 +08:00
|
|
|
|
|
|
|
TOOLCHAIN_LIBS = gcc
|
|
|
|
|
2016-04-09 10:14:56 +08:00
|
|
|
OPENOCD ?= ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/i686-pokysdk-linux/usr/bin/openocd
|
|
|
|
OPENOCD_DEFAULT_PATH ?= ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/i686-pokysdk-linux/usr/share/openocd/scripts
|
2016-01-16 01:18:53 +08:00
|
|
|
|
|
|
|
export LIB_INCLUDE_DIR CROSS_COMPILE TOOLCHAIN_LIBS QEMU_BIN_PATH QEMU TOOLCHAIN_CFLAGS OPENOCD OPENOCD_DEFAULT_PATH
|