Use CMake for compilation
authorWendy Liang <jliang@xilinx.com>
Mon, 11 Jan 2016 09:09:35 +0000 (01:09 -0800)
committerWendy Liang <jliang@xilinx.com>
Tue, 9 Feb 2016 19:55:45 +0000 (11:55 -0800)
using cmake is in order to make OpenAMP compilation
easier to cross OSes and compilers

Signed-off-by: Wendy Liang <jliang@xilinx.com>
45 files changed:
CMakeLists.txt [new file with mode: 0644]
apps/CMakeLists.txt [new file with mode: 0644]
apps/echo_test/CMakeLists.txt [new file with mode: 0644]
apps/func_test_suite/CMakeLists.txt [new file with mode: 0644]
apps/linux_firmware_remoteproc_slave/CMakeLists.txt [new file with mode: 0644]
apps/machine/CMakeLists.txt [new file with mode: 0644]
apps/machine/zynq7/CMakeLists.txt [new file with mode: 0644]
apps/machine/zynqmp_r5/CMakeLists.txt [new file with mode: 0644]
apps/matrix_multiply/CMakeLists.txt [new file with mode: 0644]
apps/rpc_demo/CMakeLists.txt [new file with mode: 0644]
apps/system/CMakeLists.txt [new file with mode: 0644]
apps/system/generic/CMakeLists.txt [new file with mode: 0644]
apps/system/generic/machine/CMakeLists.txt [new file with mode: 0644]
apps/system/generic/machine/zynq7/CMakeLists.txt [new file with mode: 0644]
apps/system/generic/machine/zynqmp_r5/CMakeLists.txt [new file with mode: 0644]
cmake/collect.cmake [new file with mode: 0644]
cmake/options.cmake [new file with mode: 0644]
cmake/platforms/cross_generic_gcc.cmake [new file with mode: 0644]
cmake/platforms/cross_linux_gcc.cmake [new file with mode: 0644]
cmake/platforms/zynq7_generic.cmake [new file with mode: 0644]
cmake/platforms/zynq7_linux.cmake [new file with mode: 0644]
cmake/platforms/zynqmp_a53_generic.cmake [new file with mode: 0644]
cmake/platforms/zynqmp_linux.cmake [new file with mode: 0644]
cmake/platforms/zynqmp_r5_generic.cmake [new file with mode: 0644]
lib/CMakeLists.txt [new file with mode: 0644]
lib/common/CMakeLists.txt [new file with mode: 0644]
lib/proxy/CMakeLists.txt [new file with mode: 0644]
lib/remoteproc/CMakeLists.txt [new file with mode: 0644]
lib/remoteproc/drivers/CMakeLists.txt [new file with mode: 0644]
lib/rpmsg/CMakeLists.txt [new file with mode: 0644]
lib/system/CMakeLists.txt [new file with mode: 0644]
lib/system/generic/CMakeLists.txt [new file with mode: 0644]
lib/system/generic/machine/CMakeLists.txt [new file with mode: 0644]
lib/system/generic/machine/zynq7/CMakeLists.txt [new file with mode: 0644]
lib/system/generic/machine/zynqmp_r5/CMakeLists.txt [new file with mode: 0644]
lib/virtio/CMakeLists.txt [new file with mode: 0644]
obsolete/CMakeLists.txt [new file with mode: 0644]
obsolete/system/CMakeLists.txt [new file with mode: 0644]
obsolete/system/generic/CMakeLists.txt [new file with mode: 0644]
obsolete/system/generic/machine/CMakeLists.txt [new file with mode: 0644]
obsolete/system/generic/machine/zynq7/CMakeLists.txt [new file with mode: 0644]
obsolete/system/generic/machine/zynq7/baremetal/CMakeLists.txt [new file with mode: 0644]
obsolete/system/generic/machine/zynq7/linux_firmware/CMakeLists.txt [new file with mode: 0644]
obsolete/system/generic/machine/zynqmp_r5/CMakeLists.txt [new file with mode: 0644]
obsolete/system/generic/machine/zynqmp_r5/xil_standalone_lib/CMakeLists.txt [new file with mode: 0644]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..df4503a
--- /dev/null
@@ -0,0 +1,35 @@
+cmake_minimum_required (VERSION 2.6)
+
+
+# The version number
+set (OPENAMP_VERSION_MAJOR 1)
+set (OPENAMP_VERSION_MINOR 0)
+
+list (APPEND CMAKE_MODULE_PATH
+  "${CMAKE_SOURCE_DIR}/cmake"
+  "${CMAKE_SOURCE_DIR}/cmake/modules"
+  "${CMAKE_SOURCE_DIR}/cmake/platforms")
+
+project (OpenAMP)
+enable_language(C ASM)
+
+include (CheckIncludeFiles)
+include (CheckCSourceCompiles)
+include (collect)
+include (options)
+enable_testing ()
+
+set (OPENAMP_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+set (OPENAMP_BIN_ROOT "${CMAKE_CURRENT_BINARY_DIR}")
+
+if (WITH_OBSOLETE)
+  add_subdirectory (obsolete)
+endif (WITH_OBSOLETE)
+
+add_subdirectory (lib)
+
+if (WITH_APPS)
+  add_subdirectory (apps)
+endif (WITH_APPS)
+
+# vim: expandtab:ts=2:sw=2:smartindent
diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt
new file mode 100644 (file)
index 0000000..73b62e7
--- /dev/null
@@ -0,0 +1,30 @@
+collector_create (APP_COMMON_SOURCES "")
+collector_create (APP_LIB_DIRS "")
+collector_create (APP_INC_DIRS "")
+
+set_property (GLOBAL PROPERTY APP_LIB_DEPS "-lopen_amp")
+set (APPS_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+
+set (APPS_SHARE_DIR "${CMAKE_CURRENT_BINARY_DIR}/share")
+
+option (WITH_FUNCTION_TEST_SUITE "Include function test suite" OFF)
+
+add_subdirectory (machine)
+add_subdirectory (system)
+if (WITH_LINUXREMOTE)
+  add_subdirectory (linux_firmware_remoteproc_slave)
+endif (WITH_LINUXREMOTE)
+
+add_subdirectory (echo_test)
+add_subdirectory (matrix_multiply)
+if (WITH_PROXY)
+if (NOT WITH_REMOTEPROC_MASTER)
+add_subdirectory (rpc_demo)
+endif (NOT WITH_REMOTEPROC_MASTER)
+endif (WITH_PROXY)
+
+if (WITH_FUNCTION_TEST_SUITE)
+  add_subdirectory (func_test_suite)
+endif (WITH_FUNCTION_TEST_SUITE)
+
+
diff --git a/apps/echo_test/CMakeLists.txt b/apps/echo_test/CMakeLists.txt
new file mode 100644 (file)
index 0000000..d58bdbf
--- /dev/null
@@ -0,0 +1,44 @@
+
+set (_app "echo_testd")
+set (_cflags "${CMAKE_C_FLAGS} ${APP_EXTRA_C_FLAGS}")
+set (_fw_dir "${APPS_SHARE_DIR}")
+
+collector_list (_list PROJECT_INC_DIRS)
+collector_list (_app_list APP_INC_DIRS)
+include_directories (${_list} ${_app_list} ${CMAKE_CURRENT_SOURCE_DIR})
+
+collector_list (_list PROJECT_LIB_DIRS)
+collector_list (_app_list APP_LIB_DIRS)
+link_directories (${_list} ${_app_list})
+
+collector_list (_list APP_COMMON_SOURCES)
+if (WITH_REMOTEPROC_MASTER)
+list (APPEND _list "${CMAKE_CURRENT_SOURCE_DIR}/echo_testd_remoteproc_master.c")
+set (_cflags "${_cflags} -DBAREMETAL_MASTER=1")
+else (WITH_REMOTEPROC_MASTER)
+list (APPEND _list "${CMAKE_CURRENT_SOURCE_DIR}/echo_testd.c")
+endif (WITH_REMOTEPROC_MASTER)
+add_executable (${_app}.out ${_list})
+
+set_source_files_properties(${_list} PROPERTIES COMPILE_FLAGS "${_cflags}")
+
+get_property (_linker_script GLOBAL PROPERTY APP_LINKER_SCRIPT)
+get_property (_deps GLOBAL PROPERTY APP_LIB_DEPS)
+set (_deps "${_deps} ${PLATFORM_LIB_DEPS}")
+string (STRIP "${_deps}" _deps)
+
+if (WITH_REMOTEPROC_MASTER)
+target_link_libraries(${_app}.out -Wl,-Map=${_app}.map -Wl,--gc-sections -T\"${_linker_script}\" -Wl,--start-group ${_fw_dir}/firmware1.o ${_fw_dir}/firmware2.o ${_deps} -Wl,--end-group)
+add_custom_target (${_app}.bin ALL
+  ${CROSS_PREFIX}objcopy -O binary ${_app}.out ${_app}.bin
+  DEPENDS ${_app}.out)
+
+add_dependencies (${_app}.out ${_fw_dir}/firmware1.o ${_fw_dir}/firmware2.o)
+
+install (FILES "${CMAKE_CURRENT_BINARY_DIR}/${_app}.bin" DESTINATION bin)
+else (WITH_REMOTEPROC_MASTER)
+target_link_libraries(${_app}.out -Wl,-Map=${_app}.map -Wl,--gc-sections -T\"${_linker_script}\" -Wl,--start-group ${_deps} -Wl,--end-group)
+
+install (TARGETS ${_app}.out RUNTIME DESTINATION bin)
+endif (WITH_REMOTEPROC_MASTER)
+
diff --git a/apps/func_test_suite/CMakeLists.txt b/apps/func_test_suite/CMakeLists.txt
new file mode 100644 (file)
index 0000000..ae5aeb1
--- /dev/null
@@ -0,0 +1,44 @@
+
+set (_app "func_test_suite")
+set (_cflags "${CMAKE_C_FLAGS} ${APP_EXTRA_C_FLAGS}")
+set (_fw_dir "${APPS_SHARE_DIR}")
+
+collector_list (_list PROJECT_INC_DIRS)
+collector_list (_app_list APP_INC_DIRS)
+include_directories (${_list} ${_app_list} ${CMAKE_CURRENT_SOURCE_DIR})
+
+collector_list (_list PROJECT_LIB_DIRS)
+collector_list (_app_list APP_LIB_DIRS)
+link_directories (${_list} ${_app_list})
+
+collector_list (_list APP_COMMON_SOURCES)
+if (WITH_REMOTEPROC_MASTER)
+list (APPEND _list "${CMAKE_CURRENT_SOURCE_DIR}/func_test_suite_remoteproc_master.c")
+set (_cflags "${_cflags} -DBAREMETAL_MASTER=1")
+else (WITH_REMOTEPROC_MASTER)
+list (APPEND _list "${CMAKE_CURRENT_SOURCE_DIR}/func_test_suite.c")
+endif (WITH_REMOTEPROC_MASTER)
+add_executable (${_app}.out ${_list})
+
+set_source_files_properties(${_list} PROPERTIES COMPILE_FLAGS "${_cflags}")
+
+get_property (_linker_script GLOBAL PROPERTY APP_LINKER_SCRIPT)
+get_property (_deps GLOBAL PROPERTY APP_LIB_DEPS)
+set (_deps "${_deps} ${PLATFORM_LIB_DEPS}")
+string (STRIP "${_deps}" _deps)
+
+if (WITH_REMOTEPROC_MASTER)
+target_link_libraries(${_app}.out -Wl,-Map=${_app}.map -Wl,--gc-sections -T\"${_linker_script}\" -Wl,--start-group ${_fw_dir}/firmware1.o ${_fw_dir}/firmware2.o ${_deps} -Wl,--end-group)
+add_custom_target (${_app}.bin ALL
+  ${CROSS_PREFIX}objcopy -O binary ${_app}.out ${_app}.bin
+  DEPENDS ${_app}.out)
+
+add_dependencies (${_app}.out ${_fw_dir}/firmware1.o ${_fw_dir}/firmware2.o)
+
+install (FILES "${CMAKE_CURRENT_BINARY_DIR}/${_app}.bin" DESTINATION bin)
+else (WITH_REMOTEPROC_MASTER)
+target_link_libraries(${_app}.out -Wl,-Map=${_app}.map -Wl,--gc-sections -T\"${_linker_script}\" -Wl,--start-group ${_deps} -Wl,--end-group)
+
+install (TARGETS ${_app}.out RUNTIME DESTINATION bin)
+endif (WITH_REMOTEPROC_MASTER)
+
diff --git a/apps/linux_firmware_remoteproc_slave/CMakeLists.txt b/apps/linux_firmware_remoteproc_slave/CMakeLists.txt
new file mode 100644 (file)
index 0000000..578cb4d
--- /dev/null
@@ -0,0 +1,40 @@
+
+file (GLOB _c_srcs *.c)
+file (GLOB _asm_srcs *.S *.s)
+
+set (_fw_dir "${APPS_SHARE_DIR}")
+
+collector_list (_list PROJECT_INC_DIRS)
+include_directories (${_list} ${CMAKE_CURRENT_SOURCE_DIR})
+
+collector_list (_list PROJECT_LIB_DIRS)
+link_directories (${_list})
+include_directories (${CMAKE_CURRENT_SOURCE_DIR})
+
+add_executable (firmware-lnx ${_c_srcs} ${_asm_srcs})
+set_target_properties (firmware-lnx
+  PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
+
+set (_cflags "${CMAKE_C_FLAGS}")
+set_source_files_properties(${_asm_srcs} PROPERTIES COMPILE_FLAGS "${_cflags}")
+
+target_link_libraries(firmware-lnx -nostartfiles -T\"${CMAKE_CURRENT_SOURCE_DIR}/link_remote.ld\" -Wl,--start-group -lc -lm -lstdc++ -lzlib -lfdt -Wl,--end-group)
+
+add_dependencies (firmware-lnx image.ub)
+
+add_custom_command (OUTPUT image.ub
+  COMMAND cp ${OPENAMP_ROOT_DIR}/obsolete/system/${PROJECT_SYSTEM}/machine/${PROJECT_MACHINE}/image.ub image.ub)
+
+add_custom_command (OUTPUT ${_fw_dir}
+  COMMAND mkdir -p ${_fw_dir})
+
+add_custom_target (lnx-fw-bin-gen ALL
+  DEPENDS firmware-lnx ${_fw_dir}/firmware1.o ${_fw_dir}/firmware2.o)
+
+add_custom_target (firmware1.o ALL cp firmware-lnx firmware1
+  COMMAND ${CROSS_PREFIX}objcopy -I binary -O elf32-littlearm -B arm firmware1 ${_fw_dir}/firmware1.o
+  DEPENDS firmware-lnx ${_fw_dir})
+
+add_custom_target (firmware2.o ALL cp firmware-lnx firmware2
+  COMMAND ${CROSS_PREFIX}objcopy -I binary -O elf32-littlearm -B arm firmware2 ${_fw_dir}/firmware2.o
+  DEPENDS firmware-lnx ${_fw_dir})
diff --git a/apps/machine/CMakeLists.txt b/apps/machine/CMakeLists.txt
new file mode 100644 (file)
index 0000000..9720224
--- /dev/null
@@ -0,0 +1,3 @@
+if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_MACHINE}/CMakeLists.txt")
+  add_subdirectory (${PROJECT_MACHINE})
+endif (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_MACHINE}/CMakeLists.txt")
diff --git a/apps/machine/zynq7/CMakeLists.txt b/apps/machine/zynq7/CMakeLists.txt
new file mode 100644 (file)
index 0000000..69d3fd5
--- /dev/null
@@ -0,0 +1,9 @@
+collect (APP_INC_DIRS "${CMAKE_CURRENT_SOURCE_DIR}")
+
+if (WITH_REMOTEPROC_MASTER)
+  collect (APP_COMMON_SOURCES platform_info_remoteproc_master.c)
+else (WITH_REMOTEPROC_MASTER)
+  collect (APP_COMMON_SOURCES platform_info.c)
+  collect (APP_COMMON_SOURCES rsc_table.c)
+endif (WITH_REMOTEPROC_MASTER)
+
diff --git a/apps/machine/zynqmp_r5/CMakeLists.txt b/apps/machine/zynqmp_r5/CMakeLists.txt
new file mode 100644 (file)
index 0000000..379626b
--- /dev/null
@@ -0,0 +1,4 @@
+collect (APP_COMMON_SOURCES platform_info.c)
+collect (APP_COMMON_SOURCES rsc_table.c)
+collect (APP_INC_DIRS "${CMAKE_CURRENT_SOURCE_DIR}")
+
diff --git a/apps/matrix_multiply/CMakeLists.txt b/apps/matrix_multiply/CMakeLists.txt
new file mode 100644 (file)
index 0000000..adf1684
--- /dev/null
@@ -0,0 +1,44 @@
+
+set (_app "matrix_multiplyd")
+set (_cflags "${CMAKE_C_FLAGS} ${APP_EXTRA_C_FLAGS}")
+set (_fw_dir "${APPS_SHARE_DIR}")
+
+collector_list (_list PROJECT_INC_DIRS)
+collector_list (_app_list APP_INC_DIRS)
+include_directories (${_list} ${_app_list} ${CMAKE_CURRENT_SOURCE_DIR})
+
+collector_list (_list PROJECT_LIB_DIRS)
+collector_list (_app_list APP_LIB_DIRS)
+link_directories (${_list} ${_app_list})
+
+collector_list (_list APP_COMMON_SOURCES)
+if (WITH_REMOTEPROC_MASTER)
+list (APPEND _list "${CMAKE_CURRENT_SOURCE_DIR}/matrix_multiplyd_remoteproc_master.c")
+set (_cflags "${_cflags} -DBAREMETAL_MASTER=1")
+else (WITH_REMOTEPROC_MASTER)
+list (APPEND _list "${CMAKE_CURRENT_SOURCE_DIR}/matrix_multiplyd.c")
+endif (WITH_REMOTEPROC_MASTER)
+add_executable (${_app}.out ${_list})
+
+set_source_files_properties(${_list} PROPERTIES COMPILE_FLAGS "${_cflags}")
+
+get_property (_linker_script GLOBAL PROPERTY APP_LINKER_SCRIPT)
+get_property (_deps GLOBAL PROPERTY APP_LIB_DEPS)
+set (_deps "${_deps} ${PLATFORM_LIB_DEPS}")
+string (STRIP "${_deps}" _deps)
+
+if (WITH_REMOTEPROC_MASTER)
+target_link_libraries(${_app}.out -Wl,-Map=${_app}.map -Wl,--gc-sections -T\"${_linker_script}\" -Wl,--start-group ${_fw_dir}/firmware1.o ${_fw_dir}/firmware2.o ${_deps} -Wl,--end-group)
+add_custom_target (${_app}.bin ALL
+  ${CROSS_PREFIX}objcopy -O binary ${_app}.out ${_app}.bin
+  DEPENDS ${_app}.out)
+
+add_dependencies (${_app}.out ${_fw_dir}/firmware1.o ${_fw_dir}/firmware2.o)
+
+install (FILES "${CMAKE_CURRENT_BINARY_DIR}/${_app}.bin" DESTINATION bin)
+else (WITH_REMOTEPROC_MASTER)
+target_link_libraries(${_app}.out -Wl,-Map=${_app}.map -Wl,--gc-sections -T\"${_linker_script}\" -Wl,--start-group ${_deps} -Wl,--end-group)
+
+install (TARGETS ${_app}.out RUNTIME DESTINATION bin)
+endif (WITH_REMOTEPROC_MASTER)
+
diff --git a/apps/rpc_demo/CMakeLists.txt b/apps/rpc_demo/CMakeLists.txt
new file mode 100644 (file)
index 0000000..ea8f446
--- /dev/null
@@ -0,0 +1,24 @@
+set (_app "rpc_demo")
+set (_cflags "${CMAKE_C_FLAGS} ${APP_EXTRA_C_FLAGS}")
+
+collector_list (_list PROJECT_INC_DIRS)
+collector_list (_app_list APP_INC_DIRS)
+include_directories (${_list} ${_app_list} ${CMAKE_CURRENT_SOURCE_DIR})
+
+collector_list (_list PROJECT_LIB_DIRS)
+collector_list (_app_list APP_LIB_DIRS)
+link_directories (${_list} ${_app_list})
+
+collector_list (_list APP_COMMON_SOURCES)
+list (APPEND _list "${CMAKE_CURRENT_SOURCE_DIR}/rpc_demo.c")
+add_executable (${_app}.out ${_list})
+
+set_source_files_properties(${_list} PROPERTIES COMPILE_FLAGS "${_cflags}")
+
+get_property (_linker_script GLOBAL PROPERTY APP_LINKER_SCRIPT)
+get_property (_deps GLOBAL PROPERTY APP_LIB_DEPS)
+set (_deps "${_deps} ${PLATFORM_LIB_DEPS}")
+string (STRIP "${_deps}" _deps)
+target_link_libraries(${_app}.out -Wl,-Map=echo_test.map -Wl,--gc-sections -T\"${_linker_script}\" -Wl,--start-group ${_deps} -Wl,--end-group)
+
+install (TARGETS ${_app}.out RUNTIME DESTINATION bin)
diff --git a/apps/system/CMakeLists.txt b/apps/system/CMakeLists.txt
new file mode 100644 (file)
index 0000000..7ded68b
--- /dev/null
@@ -0,0 +1,3 @@
+if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_SYSTEM}/CMakeLists.txt")
+  add_subdirectory (${PROJECT_SYSTEM})
+endif (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_SYSTEM}/CMakeLists.txt")
diff --git a/apps/system/generic/CMakeLists.txt b/apps/system/generic/CMakeLists.txt
new file mode 100644 (file)
index 0000000..ea643a4
--- /dev/null
@@ -0,0 +1 @@
+add_subdirectory (machine)
diff --git a/apps/system/generic/machine/CMakeLists.txt b/apps/system/generic/machine/CMakeLists.txt
new file mode 100644 (file)
index 0000000..9720224
--- /dev/null
@@ -0,0 +1,3 @@
+if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_MACHINE}/CMakeLists.txt")
+  add_subdirectory (${PROJECT_MACHINE})
+endif (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_MACHINE}/CMakeLists.txt")
diff --git a/apps/system/generic/machine/zynq7/CMakeLists.txt b/apps/system/generic/machine/zynq7/CMakeLists.txt
new file mode 100644 (file)
index 0000000..ad29ef7
--- /dev/null
@@ -0,0 +1,10 @@
+collect (APP_INC_DIRS "${CMAKE_CURRENT_SOURCE_DIR}")
+collect (APP_COMMON_SOURCES helper.c)
+
+if (WITH_REMOTEPROC_MASTER)
+  set (_linker_script "${CMAKE_CURRENT_SOURCE_DIR}/linker_master.ld")
+else (WITH_REMOTEPROC_MASTER)
+  set (_linker_script "${CMAKE_CURRENT_SOURCE_DIR}/linker_remote.ld")
+endif (WITH_REMOTEPROC_MASTER)
+
+set_property (GLOBAL PROPERTY APP_LINKER_SCRIPT "${_linker_script}")
diff --git a/apps/system/generic/machine/zynqmp_r5/CMakeLists.txt b/apps/system/generic/machine/zynqmp_r5/CMakeLists.txt
new file mode 100644 (file)
index 0000000..bfecb87
--- /dev/null
@@ -0,0 +1,9 @@
+collect (APP_COMMON_SOURCES helper.c)
+
+if (WITH_REMOTEPROC_MASTER)
+  message(FATAL_ERROR "Remoteproc master is not currently supported on ${MACHINE}/${SYSTEM}.")
+else (WITH_REMOTEPROC_MASTER)
+  set (_linker_script "${CMAKE_CURRENT_SOURCE_DIR}/linker_remote.ld")
+endif (WITH_REMOTEPROC_MASTER)
+
+set_property (GLOBAL PROPERTY APP_LINKER_SCRIPT "${_linker_script}")
diff --git a/cmake/collect.cmake b/cmake/collect.cmake
new file mode 100644 (file)
index 0000000..60d12e6
--- /dev/null
@@ -0,0 +1,35 @@
+function (collector_create name base)
+  set_property (GLOBAL PROPERTY "COLLECT_${name}_LIST")
+  set_property (GLOBAL PROPERTY "COLLECT_${name}_BASE" "${base}")
+endfunction (collector_create)
+
+function (collector_list var name)
+  get_property (_list GLOBAL PROPERTY "COLLECT_${name}_LIST")
+  set (${var} "${_list}" PARENT_SCOPE)
+endfunction (collector_list)
+
+function (collector_base var name)
+  get_property (_base GLOBAL PROPERTY "COLLECT_${name}_BASE")
+  set (${var} "${_base}" PARENT_SCOPE)
+endfunction (collector_base)
+
+function (collect name)
+  collector_base (_base ${name})
+  string(COMPARE NOTEQUAL "${_base}" "" _is_rel)
+  set (_list)
+  foreach (s IN LISTS ARGN)
+    get_filename_component (s "${s}" ABSOLUTE)
+    if (_is_rel)
+      file (RELATIVE_PATH s "${_base}" "${s}")
+    endif (_is_rel)
+    list (APPEND _list "${s}")
+  endforeach ()
+  set_property (GLOBAL APPEND PROPERTY "COLLECT_${name}_LIST" "${_list}")
+endfunction (collect)
+
+# Create global collectors
+collector_create (PROJECT_INC_DIRS    "")
+collector_create (PROJECT_LIB_DIRS    "")
+collector_create (PROJECT_LIB_DEPS    "")
+
+# vim: expandtab:ts=2:sw=2:smartindent
diff --git a/cmake/options.cmake b/cmake/options.cmake
new file mode 100644 (file)
index 0000000..1a747fa
--- /dev/null
@@ -0,0 +1,54 @@
+set (PROJECT_VER_MAJOR  0)
+set (PROJECT_VER_MINOR  1)
+set (PROJECT_VER_PATCH  0)
+set (PROJECT_VER        0.1.0)
+
+if (NOT CMAKE_BUILD_TYPE)
+  set (CMAKE_BUILD_TYPE Debug)
+endif (NOT CMAKE_BUILD_TYPE)
+
+set (_host "${CMAKE_HOST_SYSTEM_NAME}/${CMAKE_HOST_SYSTEM_PROCESSOR}")
+message ("-- Host:    ${_host}")
+
+set (_target "${CMAKE_SYSTEM_NAME}/${CMAKE_SYSTEM_PROCESSOR}")
+message ("-- Target:  ${_target}")
+
+if (NOT DEFINED MACHINE)
+  set (MACHINE "Generic")
+endif (NOT DEFINED MACHINE)
+message ("-- Machine: ${MACHINE}")
+
+string (TOLOWER ${CMAKE_SYSTEM_NAME}      PROJECT_SYSTEM)
+string (TOUPPER ${CMAKE_SYSTEM_NAME}      PROJECT_SYSTEM_UPPER)
+string (TOLOWER ${CMAKE_SYSTEM_PROCESSOR} PROJECT_PROCESSOR)
+string (TOUPPER ${CMAKE_SYSTEM_PROCESSOR} PROJECT_PROCESSOR_UPPER)
+string (TOLOWER ${MACHINE}                PROJECT_MACHINE)
+string (TOUPPER ${MACHINE}                PROJECT_MACHINE_UPPER)
+
+# Select to build Remote proc master
+option (WITH_REMOTEPROC_MASTER "Build as remoteproc master" OFF)
+if (WITH_REMOTEPROC_MASTER)
+  option (WITH_LINUXREMOTE  "The remote is Linux" ON)
+endif (WITH_REMOTEPROC_MASTER)
+
+# Select which components are in the openamp lib
+option (WITH_PROXY          "Build with proxy(access device controlled by other processor)" ON)
+option (WITH_APPS           "Build with sample applicaitons" OFF)
+if (WITH_APPS)
+  option (WITH_BENCHMARK    "Build benchmark app" OFF)
+endif (WITH_APPS)
+option (WITH_OBSOLETE       "Build obsolete system libs" OFF)
+
+# Set the complication flags
+set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
+
+if (WITH_LINUXREMOTE)
+  set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOPENAMP_REMOTE_LINUX_ENABLE")
+endif (WITH_LINUXREMOTE)
+
+if (WITH_BENCHMARK)
+  set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOPENAMP_BENCHMARK_ENABLE")
+endif (WITH_BENCHMARK)
+
+message ("-- C_FLAGS : ${CMAKE_C_FLAGS}")
+# vim: expandtab:ts=2:sw=2:smartindent
diff --git a/cmake/platforms/cross_generic_gcc.cmake b/cmake/platforms/cross_generic_gcc.cmake
new file mode 100644 (file)
index 0000000..99a0d71
--- /dev/null
@@ -0,0 +1,12 @@
+set (CMAKE_SYSTEM_NAME      "Generic" CACHE STRING "")
+
+include (CMakeForceCompiler)
+
+CMAKE_FORCE_C_COMPILER   ("${CROSS_PREFIX}gcc" GNU)
+CMAKE_FORCE_CXX_COMPILER ("${CROSS_PREFIX}g++" GNU)
+
+set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER CACHE STRING "")
+set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER CACHE STRING "")
+set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER CACHE STRING "")
+
+# vim: expandtab:ts=2:sw=2:smartindent
diff --git a/cmake/platforms/cross_linux_gcc.cmake b/cmake/platforms/cross_linux_gcc.cmake
new file mode 100644 (file)
index 0000000..a7e2f6f
--- /dev/null
@@ -0,0 +1,9 @@
+set (CMAKE_SYSTEM_NAME      "Linux")
+set (CMAKE_C_COMPILER       "${CROSS_PREFIX}gcc")
+set (CMAKE_CXX_COMPILER     "${CROSS_PREFIX}g++")
+
+set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER)
+set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER)
+
+# vim: expandtab:ts=2:sw=2:smartindent
diff --git a/cmake/platforms/zynq7_generic.cmake b/cmake/platforms/zynq7_generic.cmake
new file mode 100644 (file)
index 0000000..d2f17b6
--- /dev/null
@@ -0,0 +1,11 @@
+set (CMAKE_SYSTEM_PROCESSOR "arm" CACHE STRING "")
+set (MACHINE                "zynq7" CACHE STRING "")
+set (CROSS_PREFIX           "arm-xilinx-eabi-" CACHE STRING "")
+set (CMAKE_C_FLAGS          "-gdwarf-2 -mthumb-interwork -mcpu=cortex-a9 -ffunction-sections -fdata-sections" CACHE STRING "")
+set (CMAKE_ASM_FLAGS        "-gdwarf-2 -mthumb-interwork -mcpu=cortex-a9" CACHE STRING "")
+set (PLATFORM_LIB_DEPS      "-lbaremetal -lc -lm -lcs3 -lcs3arm -lcs3unhosted" CACHE STRING "")
+set (APP_EXTRA_C_FLAGS      "-DZYNQ7_BAREMETAL" CACHE STRING "")
+
+include (cross_generic_gcc)
+
+# vim: expandtab:ts=2:sw=2:smartindent
diff --git a/cmake/platforms/zynq7_linux.cmake b/cmake/platforms/zynq7_linux.cmake
new file mode 100644 (file)
index 0000000..9a69973
--- /dev/null
@@ -0,0 +1,6 @@
+set (CMAKE_SYSTEM_PROCESSOR "arm")
+set (CROSS_PREFIX           "arm-xilinx-linux-gnueabi-")
+
+include (cross-linux-gcc)
+
+# vim: expandtab:ts=2:sw=2:smartindent
diff --git a/cmake/platforms/zynqmp_a53_generic.cmake b/cmake/platforms/zynqmp_a53_generic.cmake
new file mode 100644 (file)
index 0000000..8ece0cc
--- /dev/null
@@ -0,0 +1,6 @@
+set (CMAKE_SYSTEM_PROCESSOR "arm64")
+set (CROSS_PREFIX           "aarch64-none-elf-")
+
+include (cross_generic_gcc)
+
+# vim: expandtab:ts=2:sw=2:smartindent
diff --git a/cmake/platforms/zynqmp_linux.cmake b/cmake/platforms/zynqmp_linux.cmake
new file mode 100644 (file)
index 0000000..9800a6b
--- /dev/null
@@ -0,0 +1,6 @@
+set (CMAKE_SYSTEM_PROCESSOR "arm64")
+set (CROSS_PREFIX           "aarch64-linux-gnu-")
+
+include (cross-linux-gcc)
+
+# vim: expandtab:ts=2:sw=2:smartindent
diff --git a/cmake/platforms/zynqmp_r5_generic.cmake b/cmake/platforms/zynqmp_r5_generic.cmake
new file mode 100644 (file)
index 0000000..b465921
--- /dev/null
@@ -0,0 +1,10 @@
+set (CMAKE_SYSTEM_PROCESSOR "arm" CACHE STRING "")
+set (MACHINE                "zynqmp_r5" CACHE STRING "")
+set (CROSS_PREFIX           "armr5-none-eabi-" CACHE STRING "")
+set (CMAKE_C_FLAGS          "-mfloat-abi=soft -mcpu=cortex-r5 -O2" CACHE STRING "")
+set (CMAKE_ASM_FLAGS        "-mfloat-abi=soft -mcpu=cortex-r5" CACHE STRING "")
+set (PLATFORM_LIB_DEPS      "-lxil -lc -lm" CACHE STRING "")
+
+include (cross_generic_gcc)
+
+# vim: expandtab:ts=2:sw=2:smartindent
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
new file mode 100644 (file)
index 0000000..a805d47
--- /dev/null
@@ -0,0 +1,35 @@
+
+set_property (GLOBAL PROPERTY "PROJECT_LIB_EXTRA_CFLAGS")
+
+collector_create (PROJECT_LIB_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}")
+collect (PROJECT_LIB_DIRS "${CMAKE_CURRENT_BINARY_DIR}")
+collect (PROJECT_INC_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include")
+collect (PROJECT_INC_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include/openamp/machine/${PROJECT_MACHINE}")
+collect (PROJECT_INC_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include/openamp/system/${PROJECT_SYSTEM}/machine/${PROJECT_MACHINE}")
+
+add_subdirectory (common)
+add_subdirectory (virtio)
+add_subdirectory (rpmsg)
+add_subdirectory (remoteproc)
+
+if (WITH_PROXY)
+  add_subdirectory (proxy)
+endif (WITH_PROXY)
+add_subdirectory (system)
+
+set (OPENAMP_LIB open_amp)
+
+collector_list (_list PROJECT_INC_DIRS)
+include_directories (${_list})
+
+get_property (_ecflags GLOBAL PROPERTY "PROJECT_LIB_EXTRA_CFLAGS")
+
+collector_list (_list PROJECT_LIB_SOURCES)
+set_property (SOURCE ${_list}
+  APPEND_STRING PROPERTY COMPILE_FLAGS " ${_ecflags}")
+add_library (${OPENAMP_LIB} STATIC ${_list})
+
+install (TARGETS ${OPENAMP_LIB} ARCHIVE DESTINATION lib)
+install (DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/openamp" DESTINATION include)
+
+# vim: expandtab:ts=2:sw=2:smartindent
diff --git a/lib/common/CMakeLists.txt b/lib/common/CMakeLists.txt
new file mode 100644 (file)
index 0000000..66ee5a7
--- /dev/null
@@ -0,0 +1,4 @@
+collect (PROJECT_LIB_SOURCES hil.c)
+collect (PROJECT_LIB_SOURCES llist.c)
+collect (PROJECT_LIB_SOURCES sh_mem.c)
+collect (PROJECT_LIB_SOURCES firmware.c)
diff --git a/lib/proxy/CMakeLists.txt b/lib/proxy/CMakeLists.txt
new file mode 100644 (file)
index 0000000..4cbc599
--- /dev/null
@@ -0,0 +1 @@
+collect (PROJECT_LIB_SOURCES rpmsg_retarget.c)
diff --git a/lib/remoteproc/CMakeLists.txt b/lib/remoteproc/CMakeLists.txt
new file mode 100644 (file)
index 0000000..acd240a
--- /dev/null
@@ -0,0 +1,5 @@
+collect (PROJECT_LIB_SOURCES elf_loader.c)
+collect (PROJECT_LIB_SOURCES remoteproc.c)
+collect (PROJECT_LIB_SOURCES remoteproc_loader.c)
+collect (PROJECT_LIB_SOURCES rsc_table_parser.c)
+add_subdirectory (drivers)
diff --git a/lib/remoteproc/drivers/CMakeLists.txt b/lib/remoteproc/drivers/CMakeLists.txt
new file mode 100644 (file)
index 0000000..bc568f9
--- /dev/null
@@ -0,0 +1,8 @@
+if ("${MACHINE}" STREQUAL "zynqmp_r5")
+  collect (PROJECT_LIB_SOURCES zynqmp_remoteproc_a53.c)
+endif ("${MACHINE}" STREQUAL "zynqmp_r5")
+
+if ("${MACHINE}" STREQUAL "zynq7")
+  collect (PROJECT_LIB_SOURCES zynq_remoteproc_a9.c)
+  collect (PROJECT_LIB_SOURCES zynq_a9_trampoline.S)
+endif ("${MACHINE}" STREQUAL "zynq7")
diff --git a/lib/rpmsg/CMakeLists.txt b/lib/rpmsg/CMakeLists.txt
new file mode 100644 (file)
index 0000000..64e5961
--- /dev/null
@@ -0,0 +1,3 @@
+collect (PROJECT_LIB_SOURCES remote_device.c)
+collect (PROJECT_LIB_SOURCES rpmsg.c)
+collect (PROJECT_LIB_SOURCES rpmsg_core.c)
diff --git a/lib/system/CMakeLists.txt b/lib/system/CMakeLists.txt
new file mode 100644 (file)
index 0000000..7ded68b
--- /dev/null
@@ -0,0 +1,3 @@
+if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_SYSTEM}/CMakeLists.txt")
+  add_subdirectory (${PROJECT_SYSTEM})
+endif (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_SYSTEM}/CMakeLists.txt")
diff --git a/lib/system/generic/CMakeLists.txt b/lib/system/generic/CMakeLists.txt
new file mode 100644 (file)
index 0000000..46ab454
--- /dev/null
@@ -0,0 +1,2 @@
+collect (PROJECT_LIB_SOURCES bm_env.c)
+add_subdirectory (machine)
diff --git a/lib/system/generic/machine/CMakeLists.txt b/lib/system/generic/machine/CMakeLists.txt
new file mode 100644 (file)
index 0000000..9720224
--- /dev/null
@@ -0,0 +1,3 @@
+if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_MACHINE}/CMakeLists.txt")
+  add_subdirectory (${PROJECT_MACHINE})
+endif (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_MACHINE}/CMakeLists.txt")
diff --git a/lib/system/generic/machine/zynq7/CMakeLists.txt b/lib/system/generic/machine/zynq7/CMakeLists.txt
new file mode 100644 (file)
index 0000000..5558ac4
--- /dev/null
@@ -0,0 +1,2 @@
+
+collect (PROJECT_LIB_SOURCES machine_system.c)
diff --git a/lib/system/generic/machine/zynqmp_r5/CMakeLists.txt b/lib/system/generic/machine/zynqmp_r5/CMakeLists.txt
new file mode 100644 (file)
index 0000000..8e66904
--- /dev/null
@@ -0,0 +1,3 @@
+
+collect (PROJECT_LIB_SOURCES machine_system.c)
+
diff --git a/lib/virtio/CMakeLists.txt b/lib/virtio/CMakeLists.txt
new file mode 100644 (file)
index 0000000..0497514
--- /dev/null
@@ -0,0 +1,2 @@
+collect (PROJECT_LIB_SOURCES virtio.c)
+collect (PROJECT_LIB_SOURCES virtqueue.c)
diff --git a/obsolete/CMakeLists.txt b/obsolete/CMakeLists.txt
new file mode 100644 (file)
index 0000000..dc11277
--- /dev/null
@@ -0,0 +1 @@
+add_subdirectory (system)
diff --git a/obsolete/system/CMakeLists.txt b/obsolete/system/CMakeLists.txt
new file mode 100644 (file)
index 0000000..7ded68b
--- /dev/null
@@ -0,0 +1,3 @@
+if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_SYSTEM}/CMakeLists.txt")
+  add_subdirectory (${PROJECT_SYSTEM})
+endif (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_SYSTEM}/CMakeLists.txt")
diff --git a/obsolete/system/generic/CMakeLists.txt b/obsolete/system/generic/CMakeLists.txt
new file mode 100644 (file)
index 0000000..ea643a4
--- /dev/null
@@ -0,0 +1 @@
+add_subdirectory (machine)
diff --git a/obsolete/system/generic/machine/CMakeLists.txt b/obsolete/system/generic/machine/CMakeLists.txt
new file mode 100644 (file)
index 0000000..9720224
--- /dev/null
@@ -0,0 +1,3 @@
+if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_MACHINE}/CMakeLists.txt")
+  add_subdirectory (${PROJECT_MACHINE})
+endif (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_MACHINE}/CMakeLists.txt")
diff --git a/obsolete/system/generic/machine/zynq7/CMakeLists.txt b/obsolete/system/generic/machine/zynq7/CMakeLists.txt
new file mode 100644 (file)
index 0000000..4214971
--- /dev/null
@@ -0,0 +1,5 @@
+if (WITH_LINUXREMOTE)
+  add_subdirectory (linux_firmware)
+endif (WITH_LINUXREMOTE)
+
+add_subdirectory (baremetal)
diff --git a/obsolete/system/generic/machine/zynq7/baremetal/CMakeLists.txt b/obsolete/system/generic/machine/zynq7/baremetal/CMakeLists.txt
new file mode 100644 (file)
index 0000000..d33e347
--- /dev/null
@@ -0,0 +1,8 @@
+collect (PROJECT_INC_DIRS "${CMAKE_CURRENT_SOURCE_DIR}")
+collect (PROJECT_LIB_DIRS "${CMAKE_CURRENT_BINARY_DIR}")
+include_directories (${CMAKE_CURRENT_SOURCE_DIR})
+file (GLOB C_SRCS *.c)
+
+set (_cflags "${CMAKE_C_FLAGS}")
+set_source_files_properties(${C_SRCS} PROPERTIES COMPILE_FLAGS "${_cflags}")
+add_library (baremetal STATIC ${C_SRCS})
diff --git a/obsolete/system/generic/machine/zynq7/linux_firmware/CMakeLists.txt b/obsolete/system/generic/machine/zynq7/linux_firmware/CMakeLists.txt
new file mode 100644 (file)
index 0000000..c9add19
--- /dev/null
@@ -0,0 +1,2 @@
+collect (PROJECT_LIB_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/lib/${CROSS_PREFIX}")
+collect (PROJECT_INC_DIRS "${CMAKE_CURRENT_SOURCE_DIR}")
diff --git a/obsolete/system/generic/machine/zynqmp_r5/CMakeLists.txt b/obsolete/system/generic/machine/zynqmp_r5/CMakeLists.txt
new file mode 100644 (file)
index 0000000..d02769e
--- /dev/null
@@ -0,0 +1 @@
+add_subdirectory (xil_standalone_lib)
diff --git a/obsolete/system/generic/machine/zynqmp_r5/xil_standalone_lib/CMakeLists.txt b/obsolete/system/generic/machine/zynqmp_r5/xil_standalone_lib/CMakeLists.txt
new file mode 100644 (file)
index 0000000..643a07b
--- /dev/null
@@ -0,0 +1,10 @@
+collect (PROJECT_INC_DIRS "${CMAKE_CURRENT_SOURCE_DIR}")
+collect (PROJECT_LIB_DIRS "${CMAKE_CURRENT_BINARY_DIR}")
+include_directories (${CMAKE_CURRENT_SOURCE_DIR})
+file (GLOB C_SRCS *.c)
+file (GLOB ASM_SRCS *.S *.s)
+
+set (XIL_C_FLAGS "${CMAKE_C_FLAGS} -O2 -c -DUSEAMP=1")
+set_source_files_properties(${ASM_SRCS} PROPERTIES COMPILE_FLAGS "${XIL_C_FLAGS}")
+set_source_files_properties(${C_SRCS} PROPERTIES COMPILE_FLAGS "${XIL_C_FLAGS}")
+add_library (xil STATIC ${C_SRCS} ${ASM_SRCS})