Build system ignoring driver

I’m writing a driver for TI INA234 power sensor, but can’t get it recognized by the build system. Last time I wrote a PX driver, the cmake config file looked very different… I did the following, but the build system still ignores my code:

  1. Created code in a directory aligned with naming convention: drivers/power_monitor/ina234
  2. Assigned a sensor ID in drv_sensors.h file
  3. Updated the board config to include my code: “CONFIG_DRIVERS_POWER_MONITOR_INA234=y”
  4. Updated CMakeFile in the driver directory:
px4_add_module(
	MODULE drivers__ina234
	MAIN ina234
	COMPILE_FLAGS
		-Wno-cast-align # TODO: fix and enable
	SRCS
		ina234_main.cpp
		ina234.cpp
	DEPENDS
		battery
		px4_work_queue
	)

Am I missing anything else?

1 Like

Which px4 version are you working on?

Try using make [board_name] boardconfig
Example: make px4_fmu-v5_default boardconfig

This command will open a terminal based graphical user interface.
You can navigate under drivers folder and enable your custom driver from there.

To see your driver under boardconfig gui you must create a Kconfig file within your custom driver folder.
Please kindly checkout this link: PX4 Board Configuration (Kconfig) | PX4 User Guide

Thanks for the idea! Menuconfig was something that pointed me in the right direction. My sensor was missing, the reason being “Kconfig” file was named as “KConfig”. After fixing the capitalization, I am able to build the driver.