Cross-Compilation of Point Cloud Library for ARM Cortex R5

130 Views Asked by At

I have Zynq UltraScale+ MPSoC board with RPU (Cortex R5). I am trying to create a FreeRTOS application on Cortex R5 to generate point clouds and send it out to a host PC. PCL library has been clonned on my WSL and I am able to compile it. But, when I try to cross-compile, I face a lot of errors and need help with getting this right.

Currently, I created toolchain-file.cmake with:

set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR cortex-r5)
 
set(CMAKE_C_COMPILER arm-none-eabi-gcc)
set(CMAKE_CXX_COMPILER arm-none-eabi-g++)
 
set(CMAKE_C_FLAGS "-mcpu=cortex-r5 -DARMR5 -mfloat-abi=hard -mfpu=vfpv3-d16")
set(CMAKE_CXX_FLAGS "-mcpu=cortex-r5 -DARMR5 -mfloat-abi=hard -mfpu=vfpv3-d16")
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--build-id=none -mcpu=cortex-r5 -DARMR5 -mfloat-abi=hard -mfpu=vfpv3-d16")
 
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
 
add_link_options(--specs=nosys.specs)

And I try to run: cmake -DCMAKE_TOOLCHAIN_FILE=../toolchain-file.cmake ..

But, I get the error:

-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - no
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
  Could NOT find Threads (missing: Threads_FOUND)
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.16/Modules/FindThreads.cmake:220 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:319 (find_package)

I believe this is due to the fact that my pthread library is compiled for WSL and my PCL is targeted for Cortex R5. Your help in fixing it is much appreciated.

I am new to all of this and might not be able to convey it well enough. Please let me know if any further details are needed.

Thanks.

0

There are 0 best solutions below