fail: add support for pandaboard

Change-Id: I1525c9b36d58bf53ad238a553d914f183f983bba
This commit is contained in:
Lars Rademacher
2013-10-21 02:14:33 +02:00
parent 2f6111b2f4
commit 749631e21c
14 changed files with 736 additions and 0 deletions

22
cmake/FindFTDI.cmake Normal file
View File

@ -0,0 +1,22 @@
# Find FTDI library
# Defines:
# FTDI_FOUND
# FTDI_INCLUDE_DIR
# FTDI_LIBRARY
#
FIND_PATH(FTDI_INCLUDE_DIR ftdi.h)
FIND_LIBRARY(FTDI_LIBRARY NAMES ftdi
PATHS /usr/lib /usr/local/lib
ENV LIBRARY_PATH # PATH and LIB will also work
ENV LD_LIBRARY_PATH
)
# handle the QUIETLY and REQUIRED arguments and set FTDI_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FTDI DEFAULT_MSG FTDI_LIBRARY FTDI_INCLUDE_DIR)
MARK_AS_ADVANCED(FTDI_INCLUDE_DIR FTDI_LIBRARY)
unset(FTDI_DIR CACHE)

49
cmake/panda.cmake Normal file
View File

@ -0,0 +1,49 @@
if(BUILD_PANDA)
message(STATUS "[${PROJECT_NAME}] Building Pandaboard variant ...")
SET(VARIANT panda)
find_package(FTDI REQUIRED)
set(openocd_library_dependencies ${openocd_library_dependencies} ${FTDI_LIBRARY})
# FIXME: some libraries still need to be located the "cmake way"
set(openocd_library_dependencies ${openocd_library_dependencies} -ldl)
set(openocd_src_dir ${PROJECT_SOURCE_DIR}/debuggers/openocd)
set(openocd_configure_params --enable-ft2232_libftdi --disable-werror CACHE STRING "OpenOCD default configure parameters")
# Use cmake's external project feature to build openocd library
include(ExternalProject)
ExternalProject_Add(
libfailopenocd_external
SOURCE_DIR ${openocd_src_dir}
CONFIGURE_COMMAND ${openocd_src_dir}/configure ${openocd_configure_params}
BUILD_COMMAND $(MAKE) -C ${openocd_src_dir}
## Put install command here, to prevent cmake calling make install
INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "[${PROJECT_NAME}] Built openocd library"
BUILD_IN_SOURCE 1
)
# make sure aspects don't fail to match in entry.cc
#include_directories(${PROJECT_SOURCE_DIR}/src/core ${CMAKE_BINARY_DIR}/src/core)
# an executable needs at least one source file, so we hand over an empty .cc file to make cmake happy.
add_executable(fail-client ${openocd_src_dir}/openocd_wrapper.cc)
target_link_libraries(fail-client ${openocd_src_dir}/src/.libs/libopenocd.a ${openocd_src_dir}/jimtcl/libjim.a fail ${openocd_library_dependencies})
add_dependencies(fail-client libfailopenocd_external)
#copy the conf-files to build directory
file(COPY ${openocd_src_dir}/tcl/ DESTINATION oocd_conf/ PATTERN openocd EXCLUDE)
get_filename_component(OOCD_CONF_FILES_PATH ${CMAKE_BINARY_DIR}/oocd_conf/ REALPATH)
configure_file(${openocd_src_dir}/openocd.cfg openocd.cfg COPYONLY)
get_filename_component(OOCD_CONF_FILE_PATH ${CMAKE_BINARY_DIR}/openocd.cfg REALPATH)
configure_file(${openocd_src_dir}/openocd_wrapper.hpp.in
${openocd_src_dir}/openocd_wrapper.hpp)
include_directories(${openocd_src_dir})
# /FIXME
install(TARGETS fail-client RUNTIME DESTINATION bin)
endif(BUILD_PANDA)