2018-01-11 22:46:44 +08:00
|
|
|
include(${ZEPHYR_BASE}/cmake/host-tools-zephyr.cmake)
|
2017-10-27 21:43:34 +08:00
|
|
|
|
|
|
|
# Search for the must-have program dtc on PATH and in
|
|
|
|
# TOOLCHAIN_HOME. Usually DTC will be provided by an SDK, but for
|
2018-08-03 23:11:23 +08:00
|
|
|
# SDK-less projects like gnuarmemb, it is up to the user to install
|
2017-10-27 21:43:34 +08:00
|
|
|
# dtc.
|
|
|
|
find_program(
|
|
|
|
DTC
|
|
|
|
dtc
|
|
|
|
)
|
|
|
|
if(${DTC} STREQUAL DTC-NOTFOUND)
|
|
|
|
message(FATAL_ERROR "Unable to find dtc")
|
|
|
|
endif()
|
|
|
|
|
2018-10-18 19:13:03 +08:00
|
|
|
# Parse the 'dtc --version' and make sure it is at least MIN_DTC_VERSION
|
|
|
|
set(MIN_DTC_VERSION 1.4.6)
|
|
|
|
execute_process(
|
|
|
|
COMMAND
|
|
|
|
${DTC} --version
|
|
|
|
OUTPUT_VARIABLE dtc_version_output
|
|
|
|
)
|
|
|
|
string(REGEX MATCH "Version: DTC ([0-9]+\.[0-9]+.[0-9]+).*" out_var ${dtc_version_output})
|
|
|
|
if(${CMAKE_MATCH_1} VERSION_LESS ${MIN_DTC_VERSION})
|
|
|
|
assert(0 "The detected dtc version is unsupported. \n\
|
2018-12-19 17:40:57 +08:00
|
|
|
The version was found to be ${CMAKE_MATCH_1} \n\
|
|
|
|
But the minimum supported version is ${MIN_DTC_VERSION} \n\
|
|
|
|
See https://docs.zephyrproject.org/latest/getting_started/getting_started.html \n\
|
|
|
|
for how to use the SDK's dtc alongside a custom toolchain."
|
|
|
|
)
|
2018-10-18 19:13:03 +08:00
|
|
|
endif()
|
|
|
|
|
2017-10-27 21:43:34 +08:00
|
|
|
find_program(
|
|
|
|
GPERF
|
|
|
|
gperf
|
|
|
|
)
|
|
|
|
if(${GPERF} STREQUAL GPERF-NOTFOUND)
|
|
|
|
message(FATAL_ERROR "Unable to find gperf")
|
|
|
|
endif()
|
|
|
|
|
2017-11-09 02:20:55 +08:00
|
|
|
# openocd is an optional dependency
|
|
|
|
find_program(
|
|
|
|
OPENOCD
|
|
|
|
openocd
|
|
|
|
)
|
|
|
|
|
2018-06-01 14:37:28 +08:00
|
|
|
# bossac is an optional dependency
|
|
|
|
find_program(
|
|
|
|
BOSSAC
|
|
|
|
bossac
|
|
|
|
)
|
|
|
|
|
2017-10-27 21:43:34 +08:00
|
|
|
# TODO: Should we instead find one qemu binary for each ARCH?
|
|
|
|
# TODO: This will probably need to be re-organized when there exists more than one SDK.
|