# ############################################################################## # openamp/open-amp.cmake # # SPDX-License-Identifier: Apache-2.0 # # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this # file to you under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy of # the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations under # the License. # # ############################################################################## if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/open-amp) FetchContent_Declare( open-amp DOWNLOAD_NAME "libopen-amp-main.zip" DOWNLOAD_DIR ${CMAKE_CURRENT_LIST_DIR} URL "https://github.com/OpenAMP/open-amp/archive/v${OPENAMP_VERSION}.zip" SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/open-amp BINARY_DIR ${CMAKE_BINARY_DIR}/openamp/open-amp CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" TEST_COMMAND "" PATCH_COMMAND patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < ${CMAKE_CURRENT_LIST_DIR}/0001-ns-acknowledge-the-received-creation-message.patch && patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < ${CMAKE_CURRENT_LIST_DIR}/0002-Negotiate-individual-buffer-size-dynamically.patch && patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < ${CMAKE_CURRENT_LIST_DIR}/0003-rpmsg-notify-the-user-when-the-remote-address-is-rec.patch && patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < ${CMAKE_CURRENT_LIST_DIR}/0004-rpmsg-wait-ept-ready-in-rpmsg_send.patch && patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < ${CMAKE_CURRENT_LIST_DIR}/0005-openamp-add-VIRTIO_RING_F_MUST_NOTIFY-event.patch && patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < ${CMAKE_CURRENT_LIST_DIR}/0006-rpmsg_virtio-don-t-need-check-status-when-get_tx_pay.patch && patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < ${CMAKE_CURRENT_LIST_DIR}/0007-virtqueue-move-virtqueue_nused-and-virtqueue_navail-.patch && patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < ${CMAKE_CURRENT_LIST_DIR}/0008-lib-rpmsg-rpmsg_virtio-add-last-buffer-check-to-fix-.patch && patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < ${CMAKE_CURRENT_LIST_DIR}/0009-virtio-change-feature-to-64-bit-in-all-virtio_dispat.patch && patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < ${CMAKE_CURRENT_LIST_DIR}/0010-openamp-add-assert-when-get-tx-buffer-failed.patch && patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < ${CMAKE_CURRENT_LIST_DIR}/0011-remoteproc_virtio-add-shm_io-for-remoteproc-virtio-a.patch && patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < ${CMAKE_CURRENT_LIST_DIR}/0012-remoteproc-sync-the-virtio-rpmsg-config-with-linux-s.patch && patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < ${CMAKE_CURRENT_LIST_DIR}/0013-virtio.h-add-mm_priv-to-struct-virtio_deivce.patch && patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < ${CMAKE_CURRENT_LIST_DIR}/0014-lib-rpmsg_virtio-use-virtio_alloc_buf-to-alloc-share.patch && patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < ${CMAKE_CURRENT_LIST_DIR}/0015-lib-remoteproc_virtio-optimize-virtqueue_notificatio.patch && patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < ${CMAKE_CURRENT_LIST_DIR}/0016-lib-rpmsg_virtio-support-release-the-name-service-me.patch && patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < ${CMAKE_CURRENT_LIST_DIR}/0017-lib-virtio-virtqueue-change-the-virtqueue-dump-log-l.patch && patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < ${CMAKE_CURRENT_LIST_DIR}/0018-lib-rpmsg-add-priority-support-for-rpmsg-endpoint.patch DOWNLOAD_NO_PROGRESS true TIMEOUT 30) FetchContent_GetProperties(open-amp) if(NOT open-amp_POPULATED) FetchContent_Populate(open-amp) endif() endif() if(CONFIG_OPENAMP_CACHE) set(WITH_DCACHE_VRINGS ON) endif() if(CONFIG_OPENAMP_DEBUG) add_compile_definitions(RPMSG_DEBUG) add_compile_definitions(VQUEUE_DEBUG) endif() add_compile_definitions(elf_load=remoteproc_elf_load) if(CONFIG_OPENAMP_VIRTIO_DEVICE_SUPPORT) add_compile_definitions(VIRTIO_DEVICE_SUPPORT=1) else() add_compile_definitions(VIRTIO_DEVICE_SUPPORT=0) endif() if(CONFIG_OPENAMP_VIRTIO_DRIVER_SUPPORT) add_compile_definitions(VIRTIO_DRIVER_SUPPORT=1) else() add_compile_definitions(VIRTIO_DRIVER_SUPPORT=0) endif() set(WITH_LIBMETAL_FIND OFF) set(WITH_PROXY OFF) if(NOT CMAKE_SYSTEM_PROCESSOR) set(CMAKE_SYSTEM_PROCESSOR ${CONFIG_ARCH}) endif() add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/open-amp ${CMAKE_CURRENT_BINARY_DIR}/open-amp EXCLUDE_FROM_ALL) # install nuttx openamp binary dir headers set(OPENAMP_HEADER_DIR ${CMAKE_BINARY_DIR}/include/openamp) file(GLOB headers open-amp/lib/include/openamp/*.h open-amp/lib/remoteproc/*.h open-amp/lib/rpmsg/*h) file(MAKE_DIRECTORY ${OPENAMP_HEADER_DIR}) foreach(header ${headers}) file(COPY ${header} DESTINATION ${OPENAMP_HEADER_DIR}) endforeach() target_include_directories( open_amp-static PRIVATE $) nuttx_add_external_library(open_amp-static MODE KERNEL)