Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame^] | 1 | inherit pkgconfig cmake |
| 2 | |
| 3 | LICENSE = "Proprietary" |
| 4 | LICFILENAME = "license.txt" |
| 5 | LIC_FILES_CHKSUM = "file://${S}/${LICFILENAME};md5=39ab6ab638f4d1836ba994ec6852de94" |
| 6 | |
| 7 | # We should move to an actual SRCREV eventually |
| 8 | include conf/xilinx/esw-srcrev.inc |
| 9 | |
| 10 | EMBEDDEDSW_SRCREV ?= "${AUTOREV}" |
| 11 | SRCREV = "${EMBEDDEDSW_SRCREV}" |
| 12 | PV = "${XILINX_RELEASE_VERSION}+git${SRCPV}" |
| 13 | EMBEDDEDSW_REPO ?= "git://github.com/xilinx/embeddedsw.git;protocol=https" |
| 14 | EMBEDDEDSW_BRANCH ?= "master" |
| 15 | SRC_URI = "${EMBEDDEDSW_REPO};branch=${EMBEDDEDSW_BRANCH}" |
| 16 | |
| 17 | SRCREV_FORMAT = "src_decouple" |
| 18 | |
| 19 | S = "${WORKDIR}/git/" |
| 20 | B = "${WORKDIR}/build/" |
| 21 | OECMAKE_SOURCEPATH = "${S}/${ESW_COMPONENT_SRC}" |
| 22 | |
| 23 | SPECFILE_PATH_arm = "${S}/scripts/specs/arm/Xilinx.spec" |
| 24 | SPECFILE_PATH_aarch64 = "${S}/scripts/specs/arm/Xilinx.spec" |
| 25 | SPECFILE_PATH_microblaze = "${S}/scripts/specs/microblaze/Xilinx.spec" |
| 26 | |
| 27 | ESW_CFLAGS += "-specs=${SPECFILE_PATH}" |
| 28 | |
| 29 | inherit ccmake |
| 30 | |
| 31 | COMPATIBLE_HOST = ".*-elf" |
| 32 | COMPATIBLE_HOST_arm = "[^-]*-[^-]*-eabi" |
| 33 | |
| 34 | DTBFILE ?= "${RECIPE_SYSROOT}/boot/devicetree/system-top.dtb" |
| 35 | |
| 36 | def get_xlnx_cmake_machine(fam, d): |
| 37 | cmake_machine = fam |
| 38 | if (fam == 'zynqmp'): |
| 39 | cmake_machine = 'ZynqMP' |
| 40 | elif (fam == 'versal'): |
| 41 | cmake_machine = 'Versal' |
| 42 | elif (fam == 'zynq'): |
| 43 | cmake_machine = 'Zynq' |
| 44 | return cmake_machine |
| 45 | |
| 46 | def get_xlnx_cmake_processor(tune, machine, d): |
| 47 | cmake_processor = tune |
| 48 | if tune.startswith('microblaze'): |
| 49 | if (machine == 'microblaze-pmu'): |
| 50 | cmake_processor = 'pmu_microblaze' |
| 51 | elif (machine == 'microblaze-plm'): |
| 52 | cmake_processor = 'plm_microblaze' |
| 53 | else: |
| 54 | cmake_processor = 'microblaze' |
| 55 | elif (tune in [ 'cortexr5', 'cortexr5f' ]): |
| 56 | cmake_processor = 'cortexr5' |
| 57 | elif tune.startswith('cortexa9'): |
| 58 | cmake_processor = 'cortexa9' |
| 59 | elif (tune in [ 'cortexa53', 'cortexa72-cortexa53' ]): |
| 60 | cmake_processor = 'cortexa53' |
| 61 | elif tune == 'cortexa72': |
| 62 | cmake_processor = 'cortexa72' |
| 63 | return cmake_processor |
| 64 | |
| 65 | XLNX_CMAKE_MACHINE = "${@get_xlnx_cmake_machine(d.getVar('SOC_FAMILY'), d)}" |
| 66 | XLNX_CMAKE_PROCESSOR = "${@get_xlnx_cmake_processor(d.getVar('DEFAULTTUNE'), d.getVar('MACHINE'), d)}" |
| 67 | XLNX_CMAKE_SYSTEM_NAME ?= "Generic" |
| 68 | |
| 69 | cmake_do_generate_toolchain_file_append() { |
| 70 | cat >> ${WORKDIR}/toolchain.cmake <<EOF |
| 71 | include(CMakeForceCompiler) |
| 72 | CMAKE_FORCE_C_COMPILER("${OECMAKE_C_COMPILER}" GNU) |
| 73 | CMAKE_FORCE_CXX_COMPILER("${OECMAKE_CXX_COMPILER}" GNU) |
| 74 | set( CMAKE_SYSTEM_PROCESSOR "${XLNX_CMAKE_PROCESSOR}" ) |
| 75 | set( CMAKE_MACHINE "${XLNX_CMAKE_MACHINE}" ) |
| 76 | # Will need this in the future to make cmake understand esw variables |
| 77 | # set( CMAKE_SYSTEM_NAME `echo elf | sed -e 's/^./\u&/' -e 's/^\(Linux\).*/\1/'` ) |
| 78 | set( CMAKE_SYSTEM_NAME "${XLNX_CMAKE_SYSTEM_NAME}" ) |
| 79 | EOF |
| 80 | } |
| 81 | |
| 82 | do_install() { |
| 83 | install -d ${D}${libdir} |
| 84 | install -d ${D}${includedir} |
| 85 | install -m 0755 ${B}/${ESW_COMPONENT_NAME} ${D}${libdir} |
| 86 | install -m 0644 ${B}/include/*.h ${D}${includedir} |
| 87 | } |
| 88 | |
| 89 | CFLAGS_append = " ${ESW_CFLAGS}" |
| 90 | |
| 91 | # We need to find the license file, which vaires depending on the component |
| 92 | # recurse a maximum of x times, could be fancier but it gets complicated since |
| 93 | # we dont know for certain we are running devtool or just externalsrc |
| 94 | python(){ |
| 95 | import os.path |
| 96 | if bb.data.inherits_class('externalsrc', d) and d.getVar('EXTERNALSRC'): |
| 97 | externalsrc = d.getVar('EXTERNALSRC') |
| 98 | lic_file = d.getVar('LIC_FILES_CHKSUM', False) |
| 99 | licpath=externalsrc |
| 100 | for i in range(5): |
| 101 | if os.path.isfile(licpath + '/' + d.getVar('LICFILENAME',True)): |
| 102 | lic_file = lic_file.replace('${S}',licpath) |
| 103 | d.setVar('LIC_FILES_CHKSUM', lic_file) |
| 104 | return |
| 105 | licpath=os.path.dirname(licpath) |
| 106 | bb.error("Couldn't find license file: %s, within directory %s or his parent directories" % (d.getVar('LICFILENAME',True), externalsrc)) |
| 107 | } |