blob: c50014917680882cdf25f6bf3023d8b3d8c57f76 [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
10EMBEDDEDSW_SRCREV ?= "${AUTOREV}"
11SRCREV = "${EMBEDDEDSW_SRCREV}"
12PV = "${XILINX_RELEASE_VERSION}+git${SRCPV}"
13EMBEDDEDSW_REPO ?= "git://github.com/xilinx/embeddedsw.git;protocol=https"
14EMBEDDEDSW_BRANCH ?= "master"
15SRC_URI = "${EMBEDDEDSW_REPO};branch=${EMBEDDEDSW_BRANCH}"
16
17SRCREV_FORMAT = "src_decouple"
18
19S = "${WORKDIR}/git/"
20B = "${WORKDIR}/build/"
21OECMAKE_SOURCEPATH = "${S}/${ESW_COMPONENT_SRC}"
22
23SPECFILE_PATH_arm = "${S}/scripts/specs/arm/Xilinx.spec"
24SPECFILE_PATH_aarch64 = "${S}/scripts/specs/arm/Xilinx.spec"
25SPECFILE_PATH_microblaze = "${S}/scripts/specs/microblaze/Xilinx.spec"
26
27ESW_CFLAGS += "-specs=${SPECFILE_PATH}"
28
29inherit ccmake
30
31COMPATIBLE_HOST = ".*-elf"
32COMPATIBLE_HOST_arm = "[^-]*-[^-]*-eabi"
33
34DTBFILE ?= "${RECIPE_SYSROOT}/boot/devicetree/system-top.dtb"
35
36def 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
46def 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
65XLNX_CMAKE_MACHINE = "${@get_xlnx_cmake_machine(d.getVar('SOC_FAMILY'), d)}"
66XLNX_CMAKE_PROCESSOR = "${@get_xlnx_cmake_processor(d.getVar('DEFAULTTUNE'), d.getVar('MACHINE'), d)}"
67XLNX_CMAKE_SYSTEM_NAME ?= "Generic"
68
69cmake_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}" )
79EOF
80}
81
82do_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
89CFLAGS_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
94python(){
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}