1# MIPS Architecture definition 2# 12 defined ABIs, all combinations of: 3# *) Big/Little Endian 4# *) Hardware/Software Floating Point 5# *) o32, n32, n64 ABI 6 7DEFAULTTUNE ?= "mips" 8 9# Endianess 10TUNEVALID[bigendian] = "Enable big-endian mode" 11TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'bigendian', ' -meb', ' -mel', d)}" 12 13# ABI flags 14TUNEVALID[o32] = "MIPS o32 ABI" 15TUNECONFLICTS[o32] = "n32 n64" 16TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'o32', ' -mabi=32', '', d)}" 17 18TUNEVALID[n32] = "MIPS64 n32 ABI" 19TUNECONFLICTS[n32] = "o32 n64" 20ABIEXTENSION .= "${@bb.utils.filter('TUNE_FEATURES', 'n32', d)}" 21TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'n32', ' -mabi=n32', '', d)}" 22 23# user mode qemu doesn't support mips64 n32: "Invalid ELF image for this architecture" 24MACHINE_FEATURES_BACKFILL_CONSIDERED:append = " ${@bb.utils.contains('TUNE_FEATURES', 'n32', 'qemu-usermode', '', d)}" 25 26TUNEVALID[n64] = "MIPS64 n64 ABI" 27TUNECONFLICTS[n64] = "o32 n32" 28TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'n64', ' -mabi=64', '', d)}" 29LD64ARG = "${@bb.utils.contains('TUNE_FEATURES', 'bigendian', '-m elf64btsmip', '-m elf64ltsmip', d)}" 30TUNE_LDARGS += "${@bb.utils.contains('TUNE_FEATURES', 'n64', '${LD64ARG}', '', d)}" 31 32# Floating point 33TUNEVALID[fpu-hard] = "Use hardware FPU" 34TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'fpu-hard', ' -mhard-float', ' -msoft-float', d)}" 35TARGET_FPU = "${@bb.utils.contains('TUNE_FEATURES', 'fpu-hard', '', 'soft', d)}" 36 37# MIPS r6 ABI 38TUNEVALID[r6] = "Use r6" 39TUNEVALID[mipsisa64r6] = "Use 64r6" 40TUNEVALID[mipsisa32r6] = "Use 32r6" 41 42# Package naming 43MIPSPKGSFX_ENDIAN = "${@bb.utils.contains('TUNE_FEATURES', 'bigendian', '', 'el', d)}" 44MIPSPKGSFX_ENDIAN2 = "${@bb.utils.contains('TUNE_FEATURES', 'bigendian', 'eb', 'el', d)}" 45MIPSPKGSFX_BYTE = "${@bb.utils.contains('TUNE_FEATURES', 'n64' , '64', '', d)}" 46MIPSPKGSFX_BYTE .= "${@bb.utils.contains('TUNE_FEATURES', 'n32' , '64', '', d)}" 47MIPSPKGSFX_FPU = "${@bb.utils.contains('TUNE_FEATURES', 'fpu-hard' , '', '-nf', d)}" 48MIPSPKGSFX_ABI = "${@bb.utils.contains('TUNE_FEATURES', 'n32', '-n32', '', d)}" 49MIPSPKGSFX_R6 = "${@bb.utils.filter('TUNE_FEATURES', 'r6', d)}" 50MIPSPKGSFX_64R6 = "${@bb.utils.contains('TUNE_FEATURES', 'mipsisa64r6', 'isa', '', d)}" 51MIPSPKGSFX_32R6 = "${@bb.utils.contains('TUNE_FEATURES', 'mipsisa32r6', 'isa32', '', d)}" 52 53TUNE_ARCH = "mips${MIPSPKGSFX_32R6}${MIPSPKGSFX_64R6}${MIPSPKGSFX_BYTE}${MIPSPKGSFX_R6}${MIPSPKGSFX_ENDIAN}" 54TUNE_PKGARCH = "${MIPSPKGSFX_VARIANT:tune-${DEFAULTTUNE}}${MIPSPKGSFX_FPU}${MIPSPKGSFX_ABI}" 55 56# Various Global Machine Overrides 57MACHINEOVERRIDES =. "${@bb.utils.contains('TUNE_FEATURES', 'n64', 'mipsarchn64${MIPSPKGSFX_ENDIAN2}:', '', d)}" 58MACHINEOVERRIDES =. "${@bb.utils.contains('TUNE_FEATURES', 'o32', 'mipsarcho32${MIPSPKGSFX_ENDIAN2}:', '', d)}" 59MACHINEOVERRIDES =. "${@bb.utils.contains('TUNE_FEATURES', 'n32', 'mipsarchn32${MIPSPKGSFX_ENDIAN2}:', '', d)}" 60MACHINEOVERRIDES =. "${@bb.utils.contains('TUNE_FEATURES', 'n64', 'mipsarchn64:', '', d)}" 61MACHINEOVERRIDES =. "${@bb.utils.contains('TUNE_FEATURES', 'o32', 'mipsarcho32:', '', d)}" 62MACHINEOVERRIDES =. "${@bb.utils.contains('TUNE_FEATURES', 'n32', 'mipsarchn32:', '', d)}" 63MACHINEOVERRIDES =. "${@bb.utils.contains('TUNE_FEATURES', 'r6', 'mipsarchr6:', '', d)}" 64MACHINEOVERRIDES =. "mipsarch${MIPSPKGSFX_ENDIAN2}:" 65MACHINEOVERRIDES =. "mipsarch:" 66 67# Base tunes 68AVAILTUNES += "mips mips64-n32 mips64 mipsel mips64el-n32 mips64el mips-nf mips64-nf-n32 mips64-nf mipsel-nf mips64el-nf-n32 mips64el-nf" 69TUNE_FEATURES:tune-mips = "o32 bigendian fpu-hard" 70BASE_LIB:tune-mips = "lib" 71MIPSPKGSFX_VARIANT:tune-mips = "${TUNE_ARCH}" 72PACKAGE_EXTRA_ARCHS:tune-mips = "mips" 73 74TUNE_FEATURES:tune-mips64-n32 = "n32 bigendian fpu-hard" 75BASE_LIB:tune-mips64-n32 = "lib32" 76MIPSPKGSFX_VARIANT:tune-mips64-n32 = "${TUNE_ARCH}" 77PACKAGE_EXTRA_ARCHS:tune-mips64-n32 = "mips64-n32" 78 79TUNE_FEATURES:tune-mips64 = "n64 bigendian fpu-hard" 80BASE_LIB:tune-mips64 = "lib64" 81MIPSPKGSFX_VARIANT:tune-mips64 = "${TUNE_ARCH}" 82PACKAGE_EXTRA_ARCHS:tune-mips64 = "mips64" 83 84TUNE_FEATURES:tune-mipsel = "o32 fpu-hard" 85BASE_LIB:tune-mipsel = "lib" 86MIPSPKGSFX_VARIANT:tune-mipsel = "${TUNE_ARCH}" 87PACKAGE_EXTRA_ARCHS:tune-mipsel = "mipsel" 88 89TUNE_FEATURES:tune-mips64el-n32 = "n32 fpu-hard" 90BASE_LIB:tune-mips64el-n32 = "lib32" 91MIPSPKGSFX_VARIANT:tune-mips64el-n32 = "${TUNE_ARCH}" 92PACKAGE_EXTRA_ARCHS:tune-mips64el-n32 = "mips64el-n32" 93 94TUNE_FEATURES:tune-mips64el = "n64 fpu-hard" 95BASE_LIB:tune-mips64el = "lib64" 96MIPSPKGSFX_VARIANT:tune-mips64el = "${TUNE_ARCH}" 97PACKAGE_EXTRA_ARCHS:tune-mips64el = "mips64el" 98 99TUNE_FEATURES:tune-mips-nf = "o32 bigendian" 100BASE_LIB:tune-mips-nf = "lib" 101MIPSPKGSFX_VARIANT:tune-mips-nf = "${TUNE_ARCH}" 102PACKAGE_EXTRA_ARCHS:tune-mips-nf = "mips-nf" 103 104TUNE_FEATURES:tune-mips64-nf-n32 = "n32 bigendian" 105BASE_LIB:tune-mips64-nf-n32 = "lib32" 106MIPSPKGSFX_VARIANT:tune-mips64-nf-n32 = "${TUNE_ARCH}" 107PACKAGE_EXTRA_ARCHS:tune-mips64-nf-n32 = "mips64-nf-n32" 108 109TUNE_FEATURES:tune-mips64-nf = "n64 bigendian" 110BASE_LIB:tune-mips64-nf = "lib64" 111MIPSPKGSFX_VARIANT:tune-mips64-nf = "${TUNE_ARCH}" 112PACKAGE_EXTRA_ARCHS:tune-mips64-nf = "mips64-nf" 113 114TUNE_FEATURES:tune-mipsel-nf = "o32" 115BASE_LIB:tune-mipsel-nf = "lib" 116MIPSPKGSFX_VARIANT:tune-mipsel-nf = "${TUNE_ARCH}" 117PACKAGE_EXTRA_ARCHS:tune-mipsel-nf = "mipsel-nf" 118 119TUNE_FEATURES:tune-mips64el-nf-n32 = "n32" 120BASE_LIB:tune-mips64el-nf-n32 = "lib32" 121MIPSPKGSFX_VARIANT:tune-mips64el-nf-n32 = "${TUNE_ARCH}" 122PACKAGE_EXTRA_ARCHS:tune-mips64el-nf-n32 = "mips64el-nf-n32" 123 124TUNE_FEATURES:tune-mips64el-nf = "n64" 125BASE_LIB:tune-mips64el-nf = "lib64" 126MIPSPKGSFX_VARIANT:tune-mips64el-nf = "${TUNE_ARCH}" 127PACKAGE_EXTRA_ARCHS:tune-mips64el-nf = "mips64el-nf" 128 129# MIPS 64 + o32 130AVAILTUNES += "mips64-o32 mips64el-o32" 131 132TUNE_FEATURES:tune-mips64-o32 = "o32 bigendian fpu-hard" 133BASE_LIB:tune-mips64-o32 = "lib" 134MIPSPKGSFX_VARIANT:tune-mips64-o32 = "${TUNE_ARCH}" 135PACKAGE_EXTRA_ARCHS:tune-mips64-o32 = "mips mips64-o32" 136 137TUNE_FEATURES:tune-mips64el-o32 = "o32 fpu-hard" 138BASE_LIB:tune-mips64el-o32 = "lib" 139MIPSPKGSFX_VARIANT:tune-mips64el-o32 = "${TUNE_ARCH}" 140PACKAGE_EXTRA_ARCHS:tune-mips64el-o32 = "mipsel mips64el-o32" 141 142# MIPS 64 o32 and Soft Float 143AVAILTUNES += "mips64-nf-o32 mips64el-nf-o32" 144 145TUNE_FEATURES:tune-mips64-nf-o32 = "o32 bigendian" 146BASE_LIB:tune-mips64-nf-o32 = "lib" 147MIPSPKGSFX_VARIANT:tune-mips64-nf-o32 = "${TUNE_ARCH}" 148PACKAGE_EXTRA_ARCHS:tune-mips64-nf-o32 = "mips-nf mips64-nf-o32" 149 150TUNE_FEATURES:tune-mips64el-nf-o32 = "o32" 151BASE_LIB:tune-mips64el-nf-o32 = "lib" 152MIPSPKGSFX_VARIANT:tune-mips64el-nf-o32 = "${TUNE_ARCH}" 153PACKAGE_EXTRA_ARCHS:tune-mips64el-nf-o32 = "mipsel-nf mips64el-nf-o32" 154