summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2016-07-16 07:57:28 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2016-07-16 10:37:06 +0200
commitffa14762a506c39d897fd63f028b39904cf22a5f (patch)
tree361c863c7851f4c41797b5ec4fa8aa9c9213c4aa /cmake
parent8fdcf6b00313829230a61da4dfe210e5f82b371e (diff)
downloadintel-quark-d2000-playground-ffa14762a506c39d897fd63f028b39904cf22a5f.tar.gz
intel-quark-d2000-playground-ffa14762a506c39d897fd63f028b39904cf22a5f.tar.bz2
intel-quark-d2000-playground-ffa14762a506c39d897fd63f028b39904cf22a5f.tar.xz
intel-quark-d2000-playground-ffa14762a506c39d897fd63f028b39904cf22a5f.zip
o Changing how the toolchain create the qmsi libraries etc. Replace the hardcoded library with a function that the user can use to create its own special target. This target can be further customized by normal CMake methods by setting properties.HEADmaster
o Adding start of a app for playing with MOD-LCD3310 which is a PCD8544 connected through SPI.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/intel-quark-d2000.toolchain.cmake63
-rw-r--r--cmake/intel/qmsi.cmake27
2 files changed, 41 insertions, 49 deletions
diff --git a/cmake/intel-quark-d2000.toolchain.cmake b/cmake/intel-quark-d2000.toolchain.cmake
index 3537551..03925a7 100644
--- a/cmake/intel-quark-d2000.toolchain.cmake
+++ b/cmake/intel-quark-d2000.toolchain.cmake
@@ -32,28 +32,9 @@ set(BASE_FLAGS "-std=c90 -Wall -Wextra -Werror -Wno-unused-parameter")
set(INCLUDES "")
-if (IS_DIRECTORY "${QMSI_DIR}")
- message("Using QMSI_DIR: ${QMSI_DIR}")
-else ()
- message("Detecting QMSI_DIR..")
-
- find_path(QMSI_DIR qm_common.h
- HINTS "${ISSM_DIR}/firmware/bsp/1.0/include"
- NO_DEFAULT_PATH)
-
- if (IS_DIRECTORY "${QMSI_DIR}")
- message("Found QMSI_DIR: ${QMSI_DIR}")
- else ()
- message(FATAL_ERROR "Could not find QMSI directory")
- endif ()
-
-endif ()
-
# TODO: these directories should be validated
-list(APPEND includes "${ISSM_DIR}/firmware/bsp/1.0/include")
-list(APPEND includes "${ISSM_DIR}/firmware/bsp/1.0/board/drivers")
-#list(APPEND includes "${ISSM_DIR}/firmware/bsp/1.0/drivers/include")
-list(APPEND includes "${ISSM_DIR}/firmware/bsp/1.0/drivers/bmc150")
+#list(APPEND includes "${ISSM_DIR}/firmware/bsp/1.0/include")
+#list(APPEND includes "${ISSM_DIR}/firmware/bsp/1.0/board/drivers")
if (INTEL_QUARK_CHIP STREQUAL D2000)
include("${toolchain_dir}/intel/d2000.cmake")
@@ -64,27 +45,13 @@ if (INTEL_QUARK_CHIP STREQUAL D2000)
include("${toolchain_dir}/intel/gdb.cmake")
gdb_init()
+
+ include("${toolchain_dir}/intel/qmsi.cmake")
+ qmsi_init()
elseif (INTEL_QUARK_CHIP STREQUAL SE)
- list(APPEND includes "${ISSM_DIR}/firmware/bsp/1.0/soc/quark_se/include")
+# list(APPEND includes "${ISSM_DIR}/firmware/bsp/1.0/soc/quark_se/include")
endif ()
-# QMSI Library
-file(GLOB_RECURSE qmsi_sources ${ISSM_DIR}/firmware/bsp/1.0/drivers/*.c)
-add_library(qmsi STATIC ${qmsi_sources})
-target_include_directories(qmsi PUBLIC "${ISSM_DIR}/firmware/bsp/1.0/drivers/include")
-
-# SYS Library - dunno if this really is the best name
-file(GLOB_RECURSE intel_sys ${ISSM_DIR}/firmware/bsp/1.0/sys/*.c)
-add_library(intel_sys STATIC ${intel_sys})
-#target_include_directories(intel_sys PUBLIC "${ISSM_DIR}/firmware/bsp/1.0/drivers/include")
-target_link_libraries(intel_sys PRIVATE qmsi)
-
-# BMC Library
-file(GLOB_RECURSE bmc_sources ${ISSM_DIR}/firmware/bsp/1.0/board/drivers/bmc150/*.c)
-add_library(bmc STATIC ${bmc_sources})
-target_link_libraries(bmc PRIVATE qmsi)
-target_include_directories(bmc PUBLIC "${ISSM_DIR}/firmware/bsp/1.0/board/drivers/bmc150")
-
# IPP Library
#file(GLOB_RECURSE ipp_sources ${ISSM_DIR}/firmware/lib/ipp/1.0.0/*.c)
add_library(ipp STATIC IMPORTED)
@@ -136,7 +103,7 @@ set(o_level "$<TARGET_PROPERTY:O_LEVEL>")
add_compile_options("$<$<BOOL:${o_level}>:-O${o_level}>$<$<NOT:$<BOOL:${o_level}>>:-O3>")
unset(o_level)
-include_directories("${includes}")
+#include_directories("${includes}")
set(CMAKE_C_FLAGS "${BASE_FLAGS} ${TARGET_FLAGS} " CACHE STRING "c flags")
set(CMAKE_CXX_FLAGS "${BASE_FLAGS} ${TARGET_FLAGS} -fno-exceptions -fno-rtti -felide-constructors -std=c++14" CACHE STRING "c++ flags")
@@ -154,6 +121,7 @@ set(CMAKE_EXE_LINKER_FLAGS "${linker_flags}" CACHE STRING "linker flags" FORCE)
#unset(linker_flags)
set(GCC "${ISSM_DIR}/tools/compiler/bin/${TRIPLE}-gcc")
+#set(GCC "/usr/bin/clang++-3.9")
if (NOT EXISTS "${GCC}")
message(FATAL_ERROR "Could not find ${TRIPLE}-gcc. Is $ISSM_DIR set correctly?")
@@ -167,6 +135,7 @@ endif ()
# cmake_force_cxx_compiler("${GXX}" GNU)
cmake_force_c_compiler("${GCC}" GNU)
+#cmake_force_c_compiler("${GCC}" LLVM)
# search for programs in the build elfinfo directories
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
@@ -176,16 +145,12 @@ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
function(toolchain_target TARGET)
add_dependencies("${TARGET}" elfinfo)
- target_link_libraries("${TARGET}" intel_sys)
- target_link_libraries("${TARGET}" qmsi)
- target_link_libraries("${TARGET}" ipp)
- target_link_libraries("${TARGET}" bmc)
- target_link_libraries("${TARGET}" softfp)
- target_link_libraries("${TARGET}" c)
- target_link_libraries("${TARGET}" g)
- # target_link_libraries("${TARGET}" gcc)
+ target_link_libraries("${TARGET}" PUBLIC ipp)
+ target_link_libraries("${TARGET}" PUBLIC softfp)
+ target_link_libraries("${TARGET}" PUBLIC c)
+ target_link_libraries("${TARGET}" PUBLIC g)
target_compile_definitions("${TARGET}" PUBLIC -D__IPP_ENABLED__)
- target_link_libraries("${TARGET}" "-Xlinker" "-T${ld_file}")
+ target_link_libraries("${TARGET}" PUBLIC "-Xlinker" "-T${ld_file}")
endfunction()
# elfinfo tools
diff --git a/cmake/intel/qmsi.cmake b/cmake/intel/qmsi.cmake
new file mode 100644
index 0000000..0cffa5e
--- /dev/null
+++ b/cmake/intel/qmsi.cmake
@@ -0,0 +1,27 @@
+function(qmsi_init)
+endfunction()
+
+function(qmsi_create TARGET_SUFFIX)
+ set(qmsi qmsi_${TARGET_SUFFIX})
+ set(bmc qmsi_bmc_${TARGET_SUFFIX})
+ message("Creating QMSI targets ${qmsi} and ${bmc}")
+
+ file(GLOB_RECURSE qmsi_sources
+ ${ISSM_DIR}/firmware/bsp/1.0/drivers/*.c
+ ${ISSM_DIR}/firmware/bsp/1.0/sys/*.c)
+ add_library(${qmsi} STATIC ${qmsi_sources})
+ target_include_directories(${qmsi} PUBLIC "${ISSM_DIR}/firmware/bsp/1.0/include")
+ target_include_directories(${qmsi} PUBLIC "${ISSM_DIR}/firmware/bsp/1.0/drivers/include")
+
+ message("INTEL_QUARK_CHIP=${INTEL_QUARK_CHIP}")
+ if (INTEL_QUARK_CHIP STREQUAL D2000)
+ target_include_directories(${qmsi} PUBLIC "${ISSM_DIR}/firmware/bsp/1.0/soc/quark_d2000/include")
+ elseif (INTEL_QUARK_CHIP STREQUAL SE)
+ target_include_directories(${qmsi} PUBLIC "${ISSM_DIR}/firmware/bsp/1.0/soc/quark_se/include")
+ endif ()
+
+ file(GLOB_RECURSE bmc_sources ${ISSM_DIR}/firmware/bsp/1.0/board/drivers/bmc150/*.c)
+ add_library(${bmc} STATIC ${bmc_sources})
+ target_link_libraries(${bmc} PUBLIC ${qmsi})
+ target_include_directories(${bmc} PUBLIC "${ISSM_DIR}/firmware/bsp/1.0/board/drivers")
+endfunction()