mirror of
https://github.com/apache/nuttx.git
synced 2026-08-30 13:43:09 +00:00
drivers/ is built by a single flat Makefile: every per-directory Make.defs appends its sources to one CSRCS list and its directory to one VPATH, and the objects all land in drivers/ named after the source basename. Two sources with the same basename in different subdirectories therefore map to the same object, and make resolves the prerequisite through VPATH, which is searched in the order drivers/Makefile includes the Make.defs files. lcd is included before leds, so drivers/lcd always wins. Both apa102 and max7219 exist twice, once as an LCD front-end and once as an LED driver: drivers/lcd/apa102.c CONFIG_LCD_APA102 drivers/leds/apa102.c CONFIG_LEDS_APA102 drivers/lcd/max7219.c CONFIG_LCD_MAX7219 drivers/leds/max7219.c CONFIG_LEDS_MAX7219 drivers/lcd/Make.defs puts lcd on the VPATH for the whole directory whenever CONFIG_LCD=y, so selecting only the LED driver still builds apa102.o from drivers/lcd/apa102.c and the selected LED driver is never compiled at all. Because the LCD front-ends take their constants from include/nuttx/lcd/apa102.h and include/nuttx/lcd/max7219.h, which are behind CONFIG_LCD_APA102 / CONFIG_LCD_MAX7219, the substituted source does not even compile. With CONFIG_LCD=y + CONFIG_LEDS_APA102=y and CONFIG_LCD_APA102 unset: lcd/apa102.c:701:20: error: 'APA102_BLACK' undeclared (first use in this function); did you mean 'APA102_BPP'? and correspondingly for CONFIG_LEDS_MAX7219 without CONFIG_LCD_MAX7219: lcd/max7219.c:773:20: error: 'MAX7219_BLACK' undeclared (first use in this function); did you mean 'MAX7219_BPP'? So neither LED driver can be built together with CONFIG_LCD, and there is no diagnostic pointing at the real cause. Give the LCD front-ends distinct basenames. The LCD side is the adapted use of these parts (an LED matrix driven as a display), and drivers/lcd already names such variants for their role, e.g. ht16k33_14seg.c, so the suffix goes there and the LED drivers keep the plain part names. The CMake build derives object paths from the source directory and was never affected; its source lists are updated to match. Signed-off-by: Ricard Rosson <ricard@groundbits.com> Assisted-by: Claude Opus 5 (Claude Code)
184 lines
3.8 KiB
CMake
184 lines
3.8 KiB
CMake
# ##############################################################################
|
|
# drivers/lcd/CMakeLists.txt
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
|
|
# license agreements. See the NOTICE file distributed with this work for
|
|
# additional information regarding copyright ownership. The ASF licenses this
|
|
# file to you under the Apache License, Version 2.0 (the "License"); you may not
|
|
# use this file except in compliance with the License. You may obtain a copy of
|
|
# the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations under
|
|
# the License.
|
|
#
|
|
# ##############################################################################
|
|
|
|
set(SRCS)
|
|
|
|
if(CONFIG_LCD)
|
|
|
|
# Support for the generic LCD framebuffer front-end
|
|
|
|
if(CONFIG_LCD_FRAMEBUFFER)
|
|
list(APPEND SRCS lcd_framebuffer.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_DEV)
|
|
list(APPEND SRCS lcd_dev.c)
|
|
endif()
|
|
|
|
# Include support for Graphics LCD drivers
|
|
|
|
if(CONFIG_LCD_FT80X)
|
|
list(APPEND SRCS ft80x.c)
|
|
if(CONFIG_LCD_FT80X_SPI)
|
|
list(APPEND SRCS ft80x_spi.c)
|
|
elseif(CONFIG_LCD_FT80X_I2C)
|
|
list(APPEND SRCS ft80x_i2c.c)
|
|
endif()
|
|
endif()
|
|
|
|
if(CONFIG_LCD_LPM013M091A)
|
|
list(APPEND SRCS lpm013m091a.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_APA102)
|
|
list(APPEND SRCS apa102_lcd.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_P14201)
|
|
list(APPEND SRCS p14201.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_UG2864AMBAG01)
|
|
list(APPEND SRCS ug-2864ambag01.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_UG9664HSWAG01)
|
|
list(APPEND SRCS ug-9664hswag01.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_SSD1306)
|
|
list(APPEND SRCS ssd1306_base.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_SSD1306_SPI)
|
|
list(APPEND SRCS ssd1306_spi.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_SSD1306_I2C)
|
|
list(APPEND SRCS ssd1306_i2c.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_SSD1289)
|
|
list(APPEND SRCS ssd1289.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_SSD1680)
|
|
list(APPEND SRCS ssd1680.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_SSD1351)
|
|
list(APPEND SRCS ssd1351.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_MIO283QT2)
|
|
list(APPEND SRCS mio283qt2.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_MAX7219)
|
|
list(APPEND SRCS max7219_lcd.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_MIO283QT9A)
|
|
list(APPEND SRCS mio283qt9a.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_PCD8544)
|
|
list(APPEND SRCS pcd8544.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_ST7565)
|
|
list(APPEND SRCS st7565.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_ST7567)
|
|
list(APPEND SRCS st7567.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_SHARP_MEMLCD)
|
|
list(APPEND SRCS memlcd.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_ILI9225)
|
|
list(APPEND SRCS ili9225.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_ILI9340)
|
|
list(APPEND SRCS ili9340.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_ILI9341)
|
|
list(APPEND SRCS ili9341.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_LCDDRV_SPIIF)
|
|
list(APPEND SRCS lcddrv_spiif.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_RA8875)
|
|
list(APPEND SRCS ra8875.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_ST7735)
|
|
list(APPEND SRCS st7735.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_ST7789)
|
|
list(APPEND SRCS st7789.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_ST7796)
|
|
list(APPEND SRCS st7796.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_GC9A01)
|
|
list(APPEND SRCS gc9a01.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_JD9851)
|
|
list(APPEND SRCS jd9851.c)
|
|
endif()
|
|
endif() # CONFIG_LCD
|
|
|
|
if(CONFIG_SLCD)
|
|
|
|
# Include support for Alphanumeric/Segment LCD drivers
|
|
|
|
if(CONFIG_LCD_BACKPACK)
|
|
list(APPEND SRCS pcf8574_lcd_backpack.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_ST7032)
|
|
list(APPEND SRCS st7032.c)
|
|
endif()
|
|
|
|
if(CONFIG_LCD_HT16K33)
|
|
list(APPEND SRCS ht16k33_14seg.c)
|
|
endif()
|
|
endif() # CONFIG_SLCD
|
|
|
|
# Other LCD-related devices
|
|
|
|
if(CONFIG_LCD_TDA19988)
|
|
list(APPEND SRCS tda19988.c)
|
|
endif()
|
|
|
|
target_sources(drivers PRIVATE ${SRCS})
|