Resolving HAL Linux Differences between Master Branch and Rover 4.6 Branch

Hey all,

We are migrating our fork of Ardurover from the Master Branch to Rover 4.6.3. We are using a Raspberry Pi 5 and integrated it using AP_HAL_Linux. Originally, we created a hwdef.dat file to setup our IMU, GPIO, and CAN connections. The hwdef file was located in /libraries/AP_HAL_Linux/hwdef/.

On the Rover 4.6.3 tag it appears there are no hwdef files. How do we configure our Raspberry Pi with sensors without creating a hwdef? Is there an easy way to port our HAL configuration from the Master Branch to Rover 4.6?

I attached our hwdef file as well as the specific commits.

define CONFIG_HAL_BOARD_SUBTYPE HAL_BOARD_SUBTYPE_LINUX_MOWZE
env TOOLCHAIN aarch64-linux-gnu
env OPTIMIZE -fomit-frame-pointer -ftree-vectorize

# IMU
IMU Invensensev3 SPI:icm42688 ROTATION_NONE

# GPIO
define HAL_LINUX_GPIO_RPI_ENABLED 1

# CAN
define HAL_CANMANAGER_ENABLED 1
define HAL_NUM_CAN_IFACES 2
define HAL_WITH_ESC TELEM 1
define HAL_ENABLE_DRONECAN_DRIVERS 1

# Define the directories
define HAL_BOARD_LOG_DIRECTORY "logs"
define HAL_BOARD_TERRAIN_DIRECTORY "terrain"
define HAL_BOARD_STORAGE_DIRECTORY "."

# SPI devices

#              NAME         BUS   SUBDEV   MODE         BPW   CS_PIN           LOWSPD   HIGHSPD
LINUX_SPIDEV   "icm42688"   0     0        SPI_MODE_3   8     SPI_CS_KERNEL    1*MHZ    24*MHZ

The hwdef is from the following commit on Master branch:

And we are trying to migrate to this commit

Thanks!

Looks like we migrated to hwdef for 4.7 from a legacy mechanism for Linux builds. Is there anything you specifically dislike about the master branch that is driving you toward this solution?

4.7 is close to a beta period and release, and it may be worth your while to simply maintain what you’ve got until the stable release rather than working toward backporting.

1 Like

I agree with @Yuri_Rage, if you can wait for 4.7 that would be best. We should start beta testing 4.7 late next week but it takes us 2 to 3 months before we can release it as the stable version

Okay we’ll wait for 4.7. No reason we can’t run on the Master Branch for now.

Thank you both for the help!

2 Likes