From b8691c820e96be78433b77bcfe381517164cea2e Mon Sep 17 00:00:00 2001 From: Arnaud Pouliquen Date: Fri, 4 Dec 2020 17:45:13 +0100 Subject: [PATCH] apps: move nocopy ping test to example Move the test to exemple folder to prepare an exemple that involves the TX and RX nocopy API. Signed-off-by: Arnaud Pouliquen --- apps/examples/CMakeLists.txt | 1 + apps/examples/nocopy_echo/CMakeLists.txt | 42 +++++++++++++++++++ apps/examples/nocopy_echo/rpmsg-echo.h | 10 +++++ .../nocopy_echo}/rpmsg-nocopy-ping.c | 6 +-- apps/tests/msg/CMakeLists.txt | 4 +- 5 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 apps/examples/nocopy_echo/CMakeLists.txt create mode 100644 apps/examples/nocopy_echo/rpmsg-echo.h rename apps/{tests/msg => examples/nocopy_echo}/rpmsg-nocopy-ping.c (97%) diff --git a/apps/examples/CMakeLists.txt b/apps/examples/CMakeLists.txt index 0b89a17..fa72d9e 100644 --- a/apps/examples/CMakeLists.txt +++ b/apps/examples/CMakeLists.txt @@ -5,6 +5,7 @@ if (MACHINE MATCHES ".*microblaze.*") add_subdirectory (echo) else () add_subdirectory (echo) +add_subdirectory (nocopy_echo) add_subdirectory (rpmsg_sample_echo) add_subdirectory (matrix_multiply) if (WITH_LOAD_FW) diff --git a/apps/examples/nocopy_echo/CMakeLists.txt b/apps/examples/nocopy_echo/CMakeLists.txt new file mode 100644 index 0000000..4ba873a --- /dev/null +++ b/apps/examples/nocopy_echo/CMakeLists.txt @@ -0,0 +1,42 @@ + +set (_cflags "${CMAKE_C_FLAGS} ${APP_EXTRA_C_FLAGS} -fdata-sections -ffunction-sections") +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}) + +get_property (_linker_opt GLOBAL PROPERTY APP_LINKER_OPT) +collector_list (_deps PROJECT_LIB_DEPS) + +set (OPENAMP_LIB open_amp) + +foreach (_app pmsg-nocopy-ping) + collector_list (_sources APP_COMMON_SOURCES) + list (APPEND _sources "${CMAKE_CURRENT_SOURCE_DIR}/rpmsg-nocopy-ping.c") + + if (WITH_SHARED_LIB) + add_executable (${_app}-shared ${_sources}) + target_link_libraries (${_app}-shared ${OPENAMP_LIB}-shared ${_deps}) + install (TARGETS ${_app}-shared RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + endif (WITH_SHARED_LIB) + + if (WITH_STATIC_LIB) + if (${PROJECT_SYSTEM} STREQUAL "linux") + add_executable (${_app}-static ${_sources}) + target_link_libraries (${_app}-static ${OPENAMP_LIB}-static ${_deps}) + install (TARGETS ${_app}-static RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + else (${PROJECT_SYSTEM}) + add_executable (${_app}.out ${_sources}) + set_source_files_properties(${_sources} PROPERTIES COMPILE_FLAGS "${_cflags}") + + target_link_libraries(${_app}.out -Wl,-Map=${_app}.map -Wl,--gc-sections ${_linker_opt} -Wl,--start-group ${OPENAMP_LIB}-static ${_deps} -Wl,--end-group) + + install (TARGETS ${_app}.out RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + endif (${PROJECT_SYSTEM} STREQUAL "linux" ) + endif (WITH_STATIC_LIB) +endforeach(_app) diff --git a/apps/examples/nocopy_echo/rpmsg-echo.h b/apps/examples/nocopy_echo/rpmsg-echo.h new file mode 100644 index 0000000..d26c5da --- /dev/null +++ b/apps/examples/nocopy_echo/rpmsg-echo.h @@ -0,0 +1,10 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef RPMSG_ECHO_H +#define RPMSG_ECHO_H + +#define RPMSG_SERVICE_NAME "rpmsg-openamp-demo-channel" + +#endif /* RPMSG_ECHO_H */ diff --git a/apps/tests/msg/rpmsg-nocopy-ping.c b/apps/examples/nocopy_echo/rpmsg-nocopy-ping.c similarity index 97% rename from apps/tests/msg/rpmsg-nocopy-ping.c rename to apps/examples/nocopy_echo/rpmsg-nocopy-ping.c index 88acf7e..5a522db 100644 --- a/apps/tests/msg/rpmsg-nocopy-ping.c +++ b/apps/examples/nocopy_echo/rpmsg-nocopy-ping.c @@ -11,7 +11,7 @@ #include #include #include "platform_info.h" -#include "rpmsg-ping.h" +#include "rpmsg-echo.h" #define LPRINTF(format, ...) printf(format, ##__VA_ARGS__) #define LPERROR(format, ...) LPRINTF("ERROR: " format, ##__VA_ARGS__) @@ -32,10 +32,6 @@ static int rnum; static int err_cnt; static int ept_deleted; -/* External functions */ -extern int init_system(void); -extern void cleanup_system(void); - static int rpmsg_endpoint_cb(struct rpmsg_endpoint *ept, void *data, size_t len, uint32_t src, void *priv) { diff --git a/apps/tests/msg/CMakeLists.txt b/apps/tests/msg/CMakeLists.txt index 7242ae6..982b6db 100644 --- a/apps/tests/msg/CMakeLists.txt +++ b/apps/tests/msg/CMakeLists.txt @@ -15,7 +15,7 @@ collector_list (_deps PROJECT_LIB_DEPS) set (OPENAMP_LIB open_amp) -foreach (_app msg-test-rpmsg-ping msg-test-rpmsg-update msg-test-rpmsg-flood-ping msg-test-rpmsg-nocopy-ping) +foreach (_app msg-test-rpmsg-ping msg-test-rpmsg-update msg-test-rpmsg-flood-ping) collector_list (_sources APP_COMMON_SOURCES) if (${_app} STREQUAL "msg-test-rpmsg-ping") list (APPEND _sources "${CMAKE_CURRENT_SOURCE_DIR}/rpmsg-ping.c") @@ -23,8 +23,6 @@ foreach (_app msg-test-rpmsg-ping msg-test-rpmsg-update msg-test-rpmsg-flood-pin list (APPEND _sources "${CMAKE_CURRENT_SOURCE_DIR}/rpmsg-update.c") elseif (${_app} STREQUAL "msg-test-rpmsg-flood-ping") list (APPEND _sources "${CMAKE_CURRENT_SOURCE_DIR}/rpmsg-flood-ping.c") - elseif (${_app} STREQUAL "msg-test-rpmsg-nocopy-ping") - list (APPEND _sources "${CMAKE_CURRENT_SOURCE_DIR}/rpmsg-nocopy-ping.c") endif (${_app} STREQUAL "msg-test-rpmsg-ping") if (WITH_SHARED_LIB)