blob: 1f7e35f424cec9dc6b903544a1b21dcd510d1445 [file] [log] [blame]
Andrew Geissler84ad7c52020-06-27 00:00:16 -05001inherit pkgconfig cmake
2
3LICENSE = "Proprietary"
4LICFILENAME = "license.txt"
5LIC_FILES_CHKSUM = "file://${S}/${LICFILENAME};md5=39ab6ab638f4d1836ba994ec6852de94"
6
7# We should move to an actual SRCREV eventually
8include conf/xilinx/esw-srcrev.inc
9
Andrew Geisslera9ff2b32020-10-16 10:11:54 -050010SRCREV ?= "${AUTOREV}"
Andrew Geissler84ad7c52020-06-27 00:00:16 -050011PV = "${XILINX_RELEASE_VERSION}+git${SRCPV}"
Andrew Geisslera9ff2b32020-10-16 10:11:54 -050012REPO ?= "git://github.com/xilinx/embeddedsw.git;protocol=https"
13BRANCH ?= "master"
14SRC_URI = "${REPO};branch=${BRANCH}"
Andrew Geissler84ad7c52020-06-27 00:00:16 -050015
16SRCREV_FORMAT = "src_decouple"
17
Andrew Geissler10fa1492020-12-11 16:25:29 -060018S = "${WORKDIR}/git"
19B = "${WORKDIR}/build"
Andrew Geissler84ad7c52020-06-27 00:00:16 -050020OECMAKE_SOURCEPATH = "${S}/${ESW_COMPONENT_SRC}"
21
22SPECFILE_PATH_arm = "${S}/scripts/specs/arm/Xilinx.spec"
23SPECFILE_PATH_aarch64 = "${S}/scripts/specs/arm/Xilinx.spec"
24SPECFILE_PATH_microblaze = "${S}/scripts/specs/microblaze/Xilinx.spec"
25
26ESW_CFLAGS += "-specs=${SPECFILE_PATH}"
27
28inherit ccmake
29
30COMPATIBLE_HOST = ".*-elf"
31COMPATIBLE_HOST_arm = "[^-]*-[^-]*-eabi"
32
33DTBFILE ?= "${RECIPE_SYSROOT}/boot/devicetree/system-top.dtb"
34
35def 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
45def 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
64XLNX_CMAKE_MACHINE = "${@get_xlnx_cmake_machine(d.getVar('SOC_FAMILY'), d)}"
65XLNX_CMAKE_PROCESSOR = "${@get_xlnx_cmake_processor(d.getVar('DEFAULTTUNE'), d.getVar('MACHINE'), d)}"
66XLNX_CMAKE_SYSTEM_NAME ?= "Generic"
67
68cmake_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}" )
78EOF
79}
80
81do_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
88CFLAGS_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
93python(){
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}