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