Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boards: emlid_navio - support 64-bit OS on Raspberry Pi 4,5 #24006

Merged
merged 2 commits into from
Nov 28, 2024

Conversation

slgrobotics
Copy link
Contributor

Solved Problem

Raspberry Pi 4,5 support 64-bit OS (Ubuntu) and "aarch64-linux-gnu" toolchain.

This PR adds a single file that optionally allows cross-builds for ARM64 target architecture.

Solution

  • Using a Ubuntu 24.04 Intel or similar desktop machine for builds
  • This PR adds file boards/emlid/navio2/arm64.px4board
  • Install ARM64 toolchain: sudo apt install g++-aarch64-linux-gnu

The 32-bit toolchain can be installed by sudo apt install g++-arm-linux-gnueabihf

Now both 32-bit and 64-bit builds are available:

make emlid_navio2 upload
make emlid_navio2_arm64 upload

@slgrobotics
Copy link
Contributor Author

@dagar - please take a look. RPi 5 is mainstream now and it doesn't support 32-bit Ubuntu

dagar
dagar previously approved these changes Nov 21, 2024
@dagar
Copy link
Member

dagar commented Nov 21, 2024

@slgrobotics the build is failing here, but I'm not yet sure why.
https://github.com/PX4/PX4-Autopilot/actions/runs/11943770023/job/33293471754?pr=24006

@slgrobotics
Copy link
Contributor Author

@dagar - it builds for me after I apply changes per #23994

I build on an Intel I7 Ubuntu 24.04 desktop machine, all updates applied.

.../PX4-Autopilot/platforms/common/spi.cpp

int px4_find_spi_bus(uint32_t devid)
{
// px4_spi_buses is only NULL on certain targets depending on defines
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Waddress"

        for (int i = 0; ((px4_spi_bus_t *) px4_spi_buses) != nullptr && i < SPI_BUS_MAX_BUS_ITEMS; ++i) {
#pragma GCC diagnostic pop
		const px4_spi_bus_t &bus_data = px4_spi_buses[i];

Here is the trace:

sergei@sergeiu7:~/src11/PX4-Autopilot$ make emlid_navio2_arm64
-- PX4_GIT_TAG: v1.16.0-alpha1-1-g31328ed7c5
CMake Warning (dev) at CMakeLists.txt:176 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.12.3", minimum required is "3") 
-- PX4 config file: /home/sergei/src11/PX4-Autopilot/boards/emlid/navio2/arm64.px4board
-- PLATFORM posix
-- LINUX_TARGET y
-- TOOLCHAIN aarch64-linux-gnu
-- ARCHITECTURE cortex-a53
-- ROMFSROOT px4fmu_common
-- ROOTFSDIR .
-- TESTING y
-- ROOT_PATH /fs/microsd
-- PARAM_FILE /fs/mtd_params
-- PX4 config: emlid_navio2_arm64
-- PX4 platform: posix
-- PX4 lockstep: disabled
-- The CXX compiler identification is GNU 13.2.0
-- The C compiler identification is GNU 13.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/aarch64-linux-gnu-gcc
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/aarch64-linux-gnu-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/aarch64-linux-gnu-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- cmake build type: RelWithDebInfo
CMake Deprecation Warning at platforms/posix/src/px4/common/lockstep_scheduler/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


/usr/bin/python3: Error while finding module specification for 'symforce.symbolic' (ModuleNotFoundError: No module named 'symforce')
-- Found Java: /usr/bin/java (found version "21.0.5") 
-- ROMFS: ROMFS/px4fmu_common
-- ROMFS:  Adding boards/emlid/navio2/init/rc.board_defaults -> /etc/init.d/rc.board_defaults
Architecture:  amd64
==> CPACK_INSTALL_PREFIX = @DEB_INSTALL_PREFIX@
-- Configuring done (2.3s)
-- Generating done (0.5s)
-- Build files have been written to: /home/sergei/src11/PX4-Autopilot/build/emlid_navio2_arm64
[0/1121] git submodule src/modules/uxrce_dds_client/Micro-XRCE-DDS-Client
[2/1121] git submodule src/drivers/gps/devices
[10/1121] git submodule src/modules/mavlink/mavlink
[15/1121] Generating actuators.json
/home/sergei/src11/PX4-Autopilot/Tools/module_config/output_groups_from_timer_config.py:33: SyntaxWarning: invalid escape sequence '\)'
  search = re.search('Timer::([0-9a-zA-Z_]+)[,\)]', line, re.IGNORECASE)
/home/sergei/src11/PX4-Autopilot/Tools/module_config/output_groups_from_timer_config.py:38: SyntaxWarning: invalid escape sequence '\)'
  search = re.search('PWM::Flex([0-9a-zA-Z_]+)..PWM::Submodule([0-9])[,\)]', line, re.IGNORECASE)
[431/1121] Building CXX object platforms/common/CMakeFiles/px4_platform.dir/spi.cpp.o
FAILED: platforms/common/CMakeFiles/px4_platform.dir/spi.cpp.o 
/usr/bin/aarch64-linux-gnu-g++ -DCONFIG_ARCH_BOARD_EMLID_NAVIO2 -D__CUSTOM_FILE_IO__ -D__PX4_LINUX -D__PX4_POSIX -D__STDC_FORMAT_MACROS -Dnoreturn_function="__attribute__((noreturn))" -I/home/sergei/src11/PX4-Autopilot/boards/emlid/navio2/src -I/home/sergei/src11/PX4-Autopilot/platforms/posix/src/px4/common/include -I/home/sergei/src11/PX4-Autopilot/build/emlid_navio2_arm64 -I/home/sergei/src11/PX4-Autopilot/build/emlid_navio2_arm64/src/lib -I/home/sergei/src11/PX4-Autopilot/platforms/posix/src/px4/generic/generic/include -I/home/sergei/src11/PX4-Autopilot/platforms/common -I/home/sergei/src11/PX4-Autopilot/platforms/common/include -I/home/sergei/src11/PX4-Autopilot/src -I/home/sergei/src11/PX4-Autopilot/src/include -I/home/sergei/src11/PX4-Autopilot/src/lib -I/home/sergei/src11/PX4-Autopilot/src/lib/matrix -I/home/sergei/src11/PX4-Autopilot/src/modules -I/home/sergei/src11/PX4-Autopilot/boards/emlid/navio2/include -I/home/sergei/src11/PX4-Autopilot/platforms/posix/include -I/home/sergei/src11/PX4-Autopilot/build/emlid_navio2_arm64/external/Install/include -O2 -g -DNDEBUG -std=gnu++14 -fPIC -g -fdata-sections -ffunction-sections -fomit-frame-pointer -fmerge-all-constants -fno-signed-zeros -fno-trapping-math -freciprocal-math -fno-math-errno -fno-strict-aliasing -fvisibility=hidden -include visibility.h -Wall -Wextra -Werror -Warray-bounds -Wcast-align -Wdisabled-optimization -Wdouble-promotion -Wfatal-errors -Wfloat-equal -Wformat-security -Winit-self -Wlogical-op -Wpointer-arith -Wshadow -Wuninitialized -Wunknown-pragmas -Wunused-variable -Wno-missing-field-initializers -Wno-missing-include-dirs -Wno-unused-parameter -fdiagnostics-color=always -Wno-stringop-truncation -fno-builtin-printf -fno-strength-reduce -Wformat=1 -Wunused-but-set-variable -Wno-format-truncation -fcheck-new -Wreorder -Wno-overloaded-virtual -fno-rtti -MD -MT platforms/common/CMakeFiles/px4_platform.dir/spi.cpp.o -MF platforms/common/CMakeFiles/px4_platform.dir/spi.cpp.o.d -o platforms/common/CMakeFiles/px4_platform.dir/spi.cpp.o -c /home/sergei/src11/PX4-Autopilot/platforms/common/spi.cpp
/home/sergei/src11/PX4-Autopilot/platforms/common/spi.cpp: In function ‘int px4_find_spi_bus(uint32_t)’:
/home/sergei/src11/PX4-Autopilot/platforms/common/spi.cpp:90:59: error: the address of ‘px4_spi_buses’ will never be NULL [-Werror=address]
   90 |         for (int i = 0; ((px4_spi_bus_t *) px4_spi_buses) != nullptr && i < SPI_BUS_MAX_BUS_ITEMS; ++i) {
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
compilation terminated due to -Wfatal-errors.
cc1plus: all warnings being treated as errors
[440/1121] Building CXX object platforms/posix/src/px4/common/px4_daemon/CMakeFiles/px4_daemon.dir/pxh.cpp.o
ninja: build stopped: subcommand failed.
make: *** [Makefile:227: emlid_navio2_arm64] Error 1
sergei@sergeiu7:~/src11/PX4-Autopilot$ meld /home/sergei/src11/PX4-Autopilot/platforms/common/spi.cpp /home/sergei/src0/PX4-Autopilot/platforms/common/spi.cpp
sergei@sergeiu7:~/src11/PX4-Autopilot$ 
sergei@sergeiu7:~/src11/PX4-Autopilot$ make emlid_navio2_arm64
[682/682] Linking CXX shared library src/examples/dyn_hello/examples__dyn_hello.px4mod
sergei@sergeiu7:~/src11/PX4-Autopilot$ 

@slgrobotics
Copy link
Contributor Author

slgrobotics commented Nov 21, 2024

BTW, make scumaker_pilotpi_arm64 builds fine on my machine too.

But this still fails after I merged the #23994 from main:

Build all targets / Build Group [aarch64-0] (pull_request) Failing after 1m

Is it related to CONFIG_MODULES_UXRCE_DDS_CLIENT=y in the boards/emlid/navio2/default.px4board ?

https://github.com/PX4/PX4-Autopilot/actions/runs/11946532582/job/33301066857?pr=24006

  [105/1121] Performing configure step for 'libmicroxrceddsclient_project'
  FAILED: src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-stamp/libmicroxrceddsclient_project-configure 
  cd /__w/PX4-Autopilot/PX4-Autopilot/build/emlid_navio2_arm64/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-build && /usr/bin/cmake -P /__w/PX4-Autopilot/PX4-Autopilot/build/emlid_navio2_arm64/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-stamp/libmicroxrceddsclient_project-configure-RelWithDebInfo.cmake && /usr/bin/cmake -E touch /__w/PX4-Autopilot/PX4-Autopilot/build/emlid_navio2_arm64/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-stamp/libmicroxrceddsclient_project-configure
  CMake Error at /__w/PX4-Autopilot/PX4-Autopilot/build/emlid_navio2_arm64/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-stamp/libmicroxrceddsclient_project-configure-RelWithDebInfo.cmake:16 (message):
    Command failed: 1
  
     '/usr/bin/cmake' '-C/__w/PX4-Autopilot/PX4-Autopilot/build/emlid_navio2_arm64/src/modules/uxrce_dds_client/tmp/libmicroxrceddsclient_project-cache-RelWithDebInfo.cmake' '-GNinja' '/__w/PX4-Autopilot/PX4-Autopilot/src/modules/uxrce_dds_client/Micro-XRCE-DDS-Client'
  
    See also
  
      /__w/PX4-Autopilot/PX4-Autopilot/build/emlid_navio2_arm64/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-stamp/libmicroxrceddsclient_project-configure-*.log

@slgrobotics
Copy link
Contributor Author

slgrobotics commented Nov 21, 2024

Stripped comments from boards/emlid/navio2/arm64.px4board - maybe this affects build?

Well, same failure - https://github.com/PX4/PX4-Autopilot/actions/runs/11946837888/job/33301868373?pr=24006

@slgrobotics
Copy link
Contributor Author

Build failure is likely related to CONFIG_MODULES_UXRCE_DDS_CLIENT=y in the boards/emlid/navio2/default.px4board

boards/scumaker/pilotpi/default.px4board does not have that switch and seems to compile fine before navio2

@mrpollo
Copy link
Contributor

mrpollo commented Nov 27, 2024

Hey just a heads up, I rebased this branch so it can pick up the latest fixes to CI, maybe this helps smooth things up.

Here's the original error so we don't loose track of it

https://github.com/PX4/PX4-Autopilot/actions/runs/11956021085/job/33329873334?pr=24006#step:8:1281

@DronecodeBot
Copy link

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/px4-sync-q-a-nov-27-2024/42604/1

@dagar
Copy link
Member

dagar commented Nov 27, 2024

The error should be fixed by #24045.

To support 64-bit OS on Raspberry Pi 4,5
stripped comments
@slgrobotics
Copy link
Contributor Author

Not sure what's crashing MAVROS, but the "Build all targets / Build Group [aarch64-0]" is successful.

@mrpollo mrpollo merged commit ab32001 into PX4:main Nov 28, 2024
54 of 59 checks passed
@mrpollo
Copy link
Contributor

mrpollo commented Nov 28, 2024

Thanks @slgrobotics, you are right tests are unrelated and will be fixed soon in #24039

@slgrobotics slgrobotics deleted the navio_arm64 branch November 28, 2024 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants