PX4 can't compile with neopixel drive added

Hello there, I’m a very new beginner with PX4, I have a custom board which is similar with holybro kakutef7, but is has an on-board neopixel(WS2812). So I modified default holybro kakutef7 default.cmake file to add neopixel driver, I also modified board_config.h to config extra pins.

Then the problem comes! After I issued make command

make holybro_kakutef7_default

tried to compile PX4, but it gives following error:

[0/1] Re-running CMake...
-- PX4 version: v1.12.0-beta2-77-gaa22407d87
-- PX4 config file: /Users/penghuachen/PX4-Autopilot/boards/holybro/kakutef7/default.cmake
-- PX4 config: holybro_kakutef7_default
-- PX4 platform: nuttx
-- cmake build type: MinSizeRel
-- build type is MinSizeRel
-- PX4 ECL: Very lightweight Estimation & Control Library v1.9.0-rc1-551-g5d34d7a
CMake Error at cmake/px4_add_module.cmake:205 (get_target_property):
  get_target_property() called with non-existent target "arch_srgbled_dma".
Call Stack (most recent call first):
  src/drivers/lights/neopixel/CMakeLists.txt:34 (px4_add_module)


-- ROMFS: ROMFS/px4fmu_common
-- ROMFS:  Adding boards/holybro/kakutef7/bootloader/holybro_kakutef7_bootloader.bin -> /etc/extras/bootloader.bin
-- ROMFS:  Adding platforms/nuttx/init/stm32f7/rc.board_arch_defaults -> /etc/init.d/rc.board_arch_defaults
-- ROMFS:  Adding boards/holybro/kakutef7/init/rc.board_defaults -> /etc/init.d/rc.board_defaults
-- ROMFS:  Adding boards/holybro/kakutef7/init/rc.board_sensors -> /etc/init.d/rc.board_sensors
-- ROMFS:  Adding boards/holybro/kakutef7/init/rc.board_extras -> /etc/init.d/rc.board_extras
-- ROMFS:  Adding boards/holybro/kakutef7/init/rc.board_mavlink -> /etc/init.d/rc.board_mavlink
-- Configuring incomplete, errors occurred!
See also "/Users/penghuachen/PX4-Autopilot/build/holybro_kakutef7_default/CMakeFiles/CMakeOutput.log".
See also "/Users/penghuachen/PX4-Autopilot/build/holybro_kakutef7_default/CMakeFiles/CMakeError.log".
FAILED: build.ninja 
/Applications/CMake.app/Contents/bin/cmake --regenerate-during-build -S/Users/penghuachen/PX4-Autopilot -B/Users/penghuachen/PX4-Autopilot/build/holybro_kakutef7_default
ninja: error: rebuilding 'build.ninja': subcommand failed
make: *** [holybro_kakutef7_default] Error 1

It seems like cmake can’t find something called arch_srgbled_dma, but I don’t where to add it. I tried official documentation, I tried Google, but none has luck.

Help! I want to compile it successfully with neopixel(WS2812) driver support.

Hi,
I advise you to look at the repository of a board using neopixel such as cuav/can-gps-v1 and compare your files.

To use srgbled_dma you need to define few variables :

/**
* @file sled_dma.cpp
* Author: David.Sidrane@Nscdg.com
*
*  This is a DMA based driver for the the neopixel class of serial RGB LEDs.
*
*  It is arch dependent on timers ans DMA
*  To use this driver a board must define:
*
*  To use this driver the board must define:
*  BOARD_HAS_N_S_RGB_LED      - the number of LEDs
*  S_RGB_LED_DMA              - the DMAMAP Channel
*  S_RGB_LED_TIMER            - The Timer the LED(s) are connected to
*  S_RGB_LED_CHANNEL          - The Timer' channel the LED(s) are connected to
*  S_RGB_LED_CHANNELN         - If the Channel is the complamentry
*  S_RGB_LED_TIM_GPIO         - The GPIO pinmap for the connection
*
*/

Also, maybe you will need to uncomment this line in drivers/lights/CMakeLists.txt file :

#add_subdirectory(neopixel) # requires board support (BOARD_HAS_N_S_RGB_LED)

Hope this can help you.

Hello, I tried your solution, I defined all the macros you mentioned, uncommented the line in drivers/lights/CMakeLists.txt, but compiling still gives the same error output. I checked the drivers/lights/neopixel/CMakeLists.txt, it contains lines as following:

	DEPENDS
		led
		arch_srgbled_dma

I don’t know what to do with arch_srgbled_dma .