eProsima / Micro-XRCE-DDS-Client

Micro XRCE-DDS Client repository. Looking for commercial support? Contact info@eprosima.com
Apache License 2.0
134 stars 85 forks source link

processor architecture not supported on Zephyr #393

Closed MOG-Lee closed 5 days ago

MOG-Lee commented 1 week ago

Hello, I have cloned Micro-XRCE-DDS-Client and Agent projects, to publish simple dds message (PublishHelloWorld project), and everything is ok. I am using Windows OS and I want to move Micro-XRCE-DDS-Client on Zephyr so it can be run on this. I created the CMakelists and configure all important options and also moved "HelloWorld.c", "main.c", "HelloWorld.idl", "HelloWorld.h" files to the zephyr project. When I want to build Zephyr with this command "west build -b qemu_x86 samples/hello_world", I got the follwing two errors: (I also share the content of my CMakelists at the end of this message)

" FAILED: CMakeFiles/microxrceddsclient.dir/C/z/Micro-XRCE-DDS-Client/src/c/util/time.c.obj ... In file included from C:/z/zephyrproject/zephyr/include/zephyr/toolchain.h:50, from C:/z/zephyrproject/zephyr/include/zephyr/kernel_includes.h:23, from C:/z/zephyrproject/zephyr/include/zephyr/kernel.h:17, from C:/z/zephyrproject/zephyr/include/zephyr/posix/posix_types.h:30, from C:/z/zephyrproject/zephyr/include/zephyr/posix/sys/select.h:9, from c:\users\mohamm~1\downlo~1\zephyr~1.0\x86_64~1\x86_64-zephyr-elf\sys-include\sys\types.h:50, from c:\users\mohamm~1\downlo~1\zephyr~1.0\x86_64~1\x86_64-zephyr-elf\sys-include\time.h:28, from C:/z/zephyrproject/zephyr/include/zephyr/posix/time.h:117, from C:/z/zephyrproject/zephyr/include/zephyr/posix/time.h:12, from C:/z/Micro-XRCE-DDS-Client/src/c/util/time.c:3: C:/z/zephyrproject/zephyr/include/zephyr/toolchain/gcc.h:579:2: error: #error processor architecture not supported 579 | #error processor architecture not supported | ^~~~~ In file included from C:/z/zephyrproject/zephyr/include/zephyr/kernel_includes.h:32: C:/z/zephyrproject/zephyr/include/zephyr/kernel_structs.h:123:28: error: 'CONFIG_NUM_PREEMPT_PRIORITIES' undeclared here (not in a function) 123 | sys_dlist_t queues[K_NUM_THREAD_PRIO]; | ^~~~~ C:/z/zephyrproject/zephyr/include/zephyr/kernel_structs.h:123:28: error: 'CONFIG_NUM_COOP_PRIORITIES' undeclared here (not in a function) 123 | sys_dlist_t queues[K_NUM_THREAD_PRIO]; | ^~~~~ C:/z/zephyrproject/zephyr/include/zephyr/kernel_structs.h:203:26: error: 'CONFIG_MP_MAX_NUM_CPUS' undeclared here (not in a function) 203 | struct _cpu cpus[CONFIG_MP_MAX_NUM_CPUS]; | ^~~~~~ In file included from C:/z/zephyrproject/zephyr/include/zephyr/kernel_includes.h:34: C:/z/zephyrproject/zephyr/include/zephyr/syscall.h:11:10: fatal error: zephyr/syscall_list.h: No such file or directory 11 | #include <zephyr/syscall_list.h> | ^~~~~~~ compilation terminated. [17/149] Building C object CMakeFiles/microxrceddsclient.dir/C/z/Micro-XRCE-DDS-Client/src/c/util/ping.c.obj

FAILED: CMakeFiles/microxrceddsclient.dir/C/z/Micro-XRCE-DDS-Client/src/c/util/ping.c.obj ... In file included from C:/z/zephyrproject/zephyr/include/zephyr/toolchain.h:50, from C:/z/zephyrproject/zephyr/include/zephyr/kernel_includes.h:23, from C:/z/zephyrproject/zephyr/include/zephyr/kernel.h:17, from C:/z/zephyrproject/zephyr/include/zephyr/posix/posix_types.h:30, from C:/z/zephyrproject/zephyr/include/zephyr/posix/sys/select.h:9, from c:\users\mohamm~1\downlo~1\zephyr~1.0\x86_64~1\x86_64-zephyr-elf\sys-include\sys\types.h:50, from C:/z/Micro-XRCE-DDS-Client/include/uxr/client/profile/transport/ip/udp/udp_transport_posix.h:23, from C:/z/Micro-XRCE-DDS-Client/include/uxr/client/transport.h:24, from C:/z/Micro-XRCE-DDS-Client/include/uxr/client/util/ping.h:28, from C:/z/Micro-XRCE-DDS-Client/src/c/util/ping.c:1: C:/z/zephyrproject/zephyr/include/zephyr/toolchain/gcc.h:579:2: error: #error processor architecture not supported 579 | #error processor architecture not supported | ^~~~~ In file included from C:/z/zephyrproject/zephyr/include/zephyr/kernel_includes.h:32: C:/z/zephyrproject/zephyr/include/zephyr/kernel_structs.h:123:28: error: 'CONFIG_NUM_PREEMPT_PRIORITIES' undeclared here (not in a function) 123 | sys_dlist_t queues[K_NUM_THREAD_PRIO]; | ^~~~~ C:/z/zephyrproject/zephyr/include/zephyr/kernel_structs.h:123:28: error: 'CONFIG_NUM_COOP_PRIORITIES' undeclared here (not in a function) 123 | sys_dlist_t queues[K_NUM_THREAD_PRIO]; | ^~~~~ C:/z/zephyrproject/zephyr/include/zephyr/kernel_structs.h:203:26: error: 'CONFIG_MP_MAX_NUM_CPUS' undeclared here (not in a function) 203 | struct _cpu cpus[CONFIG_MP_MAX_NUM_CPUS]; | ^~~~~~ In file included from C:/z/zephyrproject/zephyr/include/zephyr/kernel_includes.h:34: C:/z/zephyrproject/zephyr/include/zephyr/syscall.h:11:10: fatal error: zephyr/syscall_list.h: No such file or directory 11 | #include <zephyr/syscall_list.h> | ^~~~~~~ compilation terminated. [19/149] Generating misc/generated/syscalls.json, misc/generated/struct_tags.json ninja: build stopped: subcommand failed. "


My CMakelists :


"

SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)

Find Zephyr and initialize the project

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(PublishHelloWorld)

Micro-XRCE-DDS Client build options

option(UCLIENT_PROFILE_UDP "Enable UDP transport" ON) option(UCLIENT_PROFILE_SERIAL "Enable Serial transport" ON) set(UCLIENT_C_STANDARD 99 CACHE STRING "Version of the C language used to build the library")

set(CMAKE_PREFIX_PATH "C:/z/Micro-XRCE-DDS-Client/build/microcdr/src/microcdr-build/cmake/config") #8585

Paths for Micro-XRCE-DDS-Client

set(MICRO_XRCE_DDS_PATH C:/z/Micro-XRCE-DDS-Client)

set(MICRO_XRCE_DDS_INCLUDE_DIR C:/z/Micro-XRCE-DDS-Client/include) set(MICRO_XRCE_DDS_SRC_DIR C:/z/Micro-XRCE-DDS-Client/src/c)

Paths for Microcdr

set(MICROCDR_INCLUDE_DIR ${MICRO_XRCE_DDS_PATH}/microcdr/include) set(MICROCDR_SRC_DIR ${MICRO_XRCE_DDS_PATH}/microcdr/src/c)

Add your source files and the Micro-XRCE-DDS sources

target_sources(app PRIVATE src/main.c src/HelloWorld.c)

Add sources for Microcdr

target_sources(app PRIVATE ${MICROCDR_SRC_DIR}/common.c ${MICROCDR_SRC_DIR}/types/array.c ${MICROCDR_SRC_DIR}/types/basic.c ${MICROCDR_SRC_DIR}/types/sequence.c ${MICROCDR_SRC_DIR}/types/string.c )

Sources

Check platform.

set(UCLIENT_PLATFORM_ZEPHYR ON) set(UCLIENT_PLATFORM_POSIX ON)

set(_transport_src "${MICRO_XRCE_DDS_PATH}/src/c/profile/transport/ip/udp/udp_transport.c" "${MICRO_XRCE_DDS_PATH}/src/c/profile/transport/ip/udp/udp_transport_posix.c"

"11${MICRO_XRCE_DDS_PATH}/src/c/profile/transport/ip/udp/udp_transport_posix_nopoll.c"

#"11${MICRO_XRCE_DDS_PATH}/src/c/profile/transport/ip/udp/udp_transport_windows.c"
#"11${MICRO_XRCE_DDS_PATH}/src/c/profile/transport/ip/udp/udp_transport_freertos_plus_tcp.c"
#"11${MICRO_XRCE_DDS_PATH}/src/c/profile/transport/ip/udp/udp_transport_rtems_bsd_net.c"

"${MICRO_XRCE_DDS_PATH}/src/c/profile/transport/ip/tcp/tcp_transport.c"
"${MICRO_XRCE_DDS_PATH}/src/c/profile/transport/ip/tcp/tcp_transport_posix.c"
#"11${MICRO_XRCE_DDS_PATH}/src/c/profile/transport/ip/tcp/tcp_transport_posix_nopoll.c"
#"11${MICRO_XRCE_DDS_PATH}/src/c/profile/transport/ip/tcp/tcp_transport_windows.c"
#"11${MICRO_XRCE_DDS_PATH}/src/c/profile/transport/ip/tcp/tcp_transport_freertos_plus_tcp.c"
#"11${MICRO_XRCE_DDS_PATH}/src/c/profile/transport/ip/tcp/tcp_transport_rtems_bsd_net.c"

"${MICRO_XRCE_DDS_PATH}/src/c/profile/transport/serial/serial_transport.c"
"${MICRO_XRCE_DDS_PATH}/src/c/profile/transport/serial/serial_transport_posix.c"
#"11${MICRO_XRCE_DDS_PATH}/src/c/profile/transport/serial/serial_transport_rtems_bsd_net.c"

#"11${MICRO_XRCE_DDS_PATH}/src/c/profile/transport/can/can_transport.c"
#"11${MICRO_XRCE_DDS_PATH}/src/c/profile/transport/can/can_transport_posix.c"

"${MICRO_XRCE_DDS_PATH}/src/c/profile/transport/ip/ip_posix.c"
#"11${MICRO_XRCE_DDS_PATH}/src/c/profile/transport/ip/ip_windows.c"
#"11${MICRO_XRCE_DDS_PATH}/src/c/profile/transport/ip/ip_freertos_plus_tcp.c"
#"11${MICRO_XRCE_DDS_PATH}/src/c/profile/transport/ip/ip_rtems_bsd_net.c"

"${MICRO_XRCE_DDS_PATH}/src/c/profile/discovery/discovery.c"
#"11${MICRO_XRCE_DDS_PATH}/src/c/profile/transport/ip/udp/udp_transport.c"

"${MICRO_XRCE_DDS_PATH}/src/c/profile/discovery/transport/udp_transport_datagram_posix.c"
#11"${MICRO_XRCE_DDS_PATH}/src/c/profile/discovery/transport/udp_transport_datagram_posix_nopoll.c"
#11"${MICRO_XRCE_DDS_PATH}/src/c/profile/discovery/transport/udp_transport_datagram_windows.c"
#11"${MICRO_XRCE_DDS_PATH}/src/c/profile/discovery/transport/udp_transport_datagram_freertos_plus_tcp.c"
#11"${MICRO_XRCE_DDS_PATH}/src/c/profile/discovery/transport/udp_transport_datagram_rtems_bsd_net.c"

"${MICRO_XRCE_DDS_PATH}/src/c/profile/transport/custom/custom_transport.c"

)

Other sources

set(SRCS ${MICRO_XRCE_DDS_PATH}/src/c/core/session/stream/input_best_effort_stream.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/stream/input_reliable_stream.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/stream/output_best_effort_stream.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/stream/output_reliable_stream.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/stream/stream_storage.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/stream/stream_id.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/stream/seq_num.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/session.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/session_info.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/submessage.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/object_id.c ${MICRO_XRCE_DDS_PATH}/src/c/core/serialization/xrce_types.c ${MICRO_XRCE_DDS_PATH}/src/c/core/serialization/xrce_header.c ${MICRO_XRCE_DDS_PATH}/src/c/core/serialization/xrce_subheader.c ${MICRO_XRCE_DDS_PATH}/src/c/util/time.c ${MICRO_XRCE_DDS_PATH}/src/c/util/ping.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/common_create_entities.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/create_entities_ref.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/create_entities_xml.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/create_entities_bin.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/read_access.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/write_access.c

11${MICRO_XRCE_DDS_PATH}/src/c/profile/multithread/multithread.c

#11${MICRO_XRCE_DDS_PATH}/src/c/profile/shared_memory/shared_memory.c
#11${MICRO_XRCE_DDS_PATH}/src/c/profile/matching/matching.c
${MICRO_XRCE_DDS_PATH}/src/c/profile/transport/stream_framing/stream_framing_protocol.c
#${MICRO_XRCE_DDS_PATH}/src/c/core/log/log.c
${_transport_src}
)

Set target properties for Micro-XRCE-DDS

add_library(microxrcedds_client STATIC ${SRCS}) set_target_properties(microxrcedds_client PROPERTIES C_STANDARD 99)

target_link_libraries(microxrcedds_client

# PUBLIC
    # microcdr
    # $<$<BOOL:$<PLATFORM_ID:Windows>>:ws2_32>
# PRIVATE
    # $<$<BOOL:$<PLATFORM_ID:Linux>>:rt>
    # $<$<BOOL:$<PLATFORM_ID:Linux>>:${CMAKE_THREAD_LIBS_INIT}>

)

target_link_libraries(microxrcedds_client PRIVATE ${CMAKE_THREAD_LIBS_INIT})

message(STATUS "*****ZEPHYR_BASE=${ZEPHYR_BASE}")

Link Zephyr application with Micro-XRCE-DDS

target_link_libraries(app PRIVATE microxrcedds_client)

target_include_directories(microxrcedds_client PUBLIC ${MICRO_XRCE_DDS_INCLUDE_DIR} ${MICROCDR_INCLUDE_DIR} ${MICRO_XRCE_DDS_SRC_DIR} ${MICROCDR_SRC_DIR} ${CMAKE_BINARY_DIR}/include

${CMAKE_BINARY_DIR}/zephyr/include/generated/zephyr

${ZEPHYR_BASE}/include
${ZEPHYR_BASE}/include/zephyr
${ZEPHYR_BASE}/include/zephyr/posix

)

target_include_directories(app PRIVATE

# ${CMAKE_BINARY_DIR}/include
# ${CMAKE_BINARY_DIR}/zephyr/include/generated/zephyr
# )

Generate config.h

configure_file(
${MICRO_XRCE_DDS_PATH}/include/uxr/client/config.h.in
${CMAKE_BINARY_DIR}/include/uxr/client/config.h

)

configure_file( ${MICRO_XRCE_DDS_PATH}/microcdr/include/ucdr/config.h.in ${CMAKE_BINARY_DIR}/include/ucdr/config.h )

Install config.h

install(

# FILES
    # ${PROJECT_BINARY_DIR}/include/uxr/client/config.h
# DESTINATION
    # ${INCLUDE_INSTALL_DIR}/uxr/client
# )

"

MOG-Lee commented 5 days ago

-