zephyr/scripts/Makefile.toolchain.zephyr

68 lines
3.6 KiB
Makefile
Raw Normal View History

ifndef ZEPHYR_SDK_INSTALL_DIR
$(error ZEPHYR_SDK_INSTALL_DIR is not set)
endif
# arm
CROSS_COMPILE_TARGET_arm = arm-poky-eabi
CROSS_COMPILE_arm=${ZEPHYR_SDK_INSTALL_DIR}/sysroots/i686-pokysdk-linux/usr/bin/$(CROSS_COMPILE_TARGET_arm)/$(CROSS_COMPILE_TARGET_arm)-
CROSS_COMPILE_arm_version = $(shell $(CROSS_COMPILE_arm)gcc -dumpversion)
LIB_INCLUDE_DIR_arm += -L ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/armv5-poky-eabi/usr/${CROSS_COMPILE_TARGET_arm}/lib
LIB_INCLUDE_DIR_arm += -L ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/armv5-poky-eabi/usr/lib/$(CROSS_COMPILE_TARGET_arm)/$(CROSS_COMPILE_arm_version)
TOOLCHAIN_CFLAGS_arm = -I${ZEPHYR_SDK_INSTALL_DIR}/sysroots/armv5-poky-eabi/usr/${CROSS_COMPILE_TARGET_arm}/include
# iamcu
CROSS_COMPILE_TARGET_iamcu = i586-poky-elfiamcu
CROSS_COMPILE_iamcu=${ZEPHYR_SDK_INSTALL_DIR}/sysroots/i686-pokysdk-linux/usr/bin/iamcu-poky-elfiamcu/$(CROSS_COMPILE_TARGET_iamcu)-
CROSS_COMPILE_iamcu_version = $(shell $(CROSS_COMPILE_iamcu)gcc -dumpversion)
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
CROSS_COMPILE_x86=${ZEPHYR_SDK_INSTALL_DIR}/sysroots/i686-pokysdk-linux/usr/bin/$(CROSS_COMPILE_TARGET_x86)/$(CROSS_COMPILE_TARGET_x86)-
CROSS_COMPILE_x86_version = $(shell $(CROSS_COMPILE_x86)gcc -dumpversion)
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
CROSS_COMPILE_arc=${ZEPHYR_SDK_INSTALL_DIR}/sysroots/i686-pokysdk-linux/usr/bin/$(CROSS_COMPILE_TARGET_arc)/$(CROSS_COMPILE_TARGET_arc)-
CROSS_COMPILE_arc_version = $(shell $(CROSS_COMPILE_arc)gcc -dumpversion)
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
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
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
ifeq ($(CONFIG_TOOLCHAIN_VARIANT),"iamcu")
LD_TOOLCHAIN ?= -D__GCC_LINKER_CMD__ -D__IAMCU
OUTPUT_FORMAT = elf32-iamcu
OUTPUT_ARCH = iamcu:intel
endif
QEMU_BIN_PATH ?= ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/i686-pokysdk-linux/usr/bin
QEMU = $(QEMU_BIN_PATH)/$(QEMU_$(SRCARCH))
QEMU_BIOS=${ZEPHYR_SDK_INSTALL_DIR}/sysroots/i686-pokysdk-linux/usr/share/qemu
TOOLCHAIN_LIBS = gcc
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
export LIB_INCLUDE_DIR CROSS_COMPILE TOOLCHAIN_LIBS QEMU_BIN_PATH QEMU TOOLCHAIN_CFLAGS OPENOCD OPENOCD_DEFAULT_PATH