Fix DEVICE_ID macro conflict with STM32 HAL headers in GT911 driver #318
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The GT911 touchscreen driver's
DEVICE_IDmacro collides with an identically named macro in STM32MP13 HAL headers (stm32mp135fxx_ca7.h), causing compilation failure on STM32MP13 targets.Changes:
DEVICE_IDtoREG_DEVICE_ID(2 lines: definition and usage)REG_STATUS,REG_GT911_CONFIG, etc.)Original prompt
164/562] Building C object zephyr/drivers/input/CMakeFiles/drivers__input.dir/input_gt911.c.obj
FAILED: zephyr/drivers/input/CMakeFiles/drivers__input.dir/input_gt911.c.obj
ccache /opt/toolchains/zephyr-sdk-0.17.4/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -DCORE_CA7 -DHSE_VALUE=24000000 -DKERNEL -DK_HEAP_MEM_POOL_SIZE=0 -DLV_CONF_INCLUDE_SIMPLE=1 -DLV_CONF_PATH="/w/zephyr/zephyr/modules/lvgl/include/lv_conf.h" -DPICOLIBC_LONG_LONG_PRINTF_SCANF -DSTM32MP135Fxx -DUSE_FULL_LL_DRIVER -DUSE_HAL_DRIVER -DZVFS_OPEN_SIZE=0 -D_POSIX_THREAD_SAFE_FUNCTIONS=200809L -D__LINUX_ERRNO_EXTENSIONS -D__PROGRAM_START -D__ZEPHYR_SUPERVISOR__ -D__ZEPHYR__=1 -I/__w/zephyr/zephyr/twister-out/stm32mp135f_dk_stm32mp135fxx/zephyr/samples/modules/lvgl/demos/sample.modules.lvgl.demo_benchmark/zephyr/include/generated/zephyr -I/__w/zephyr/zephyr/include -I/__w/zephyr/zephyr/twister-out/stm32mp135f_dk_stm32mp135fxx/zephyr/samples/modules/lvgl/demos/sample.modules.lvgl.demo_benchmark/zephyr/include/generated -I/__w/zephyr/zephyr/soc/st/stm32 -I/__w/zephyr/zephyr/lib/libc/picolibc/include -I/__w/zephyr/zephyr/lib/posix/c_lib_ext/getopt -I/__w/zephyr/zephyr/lib/midi2/. -I/__w/zephyr/zephyr/soc/st/stm32/common/. -I/__w/zephyr/zephyr/drivers -I/__w/zephyr/zephyr/soc/st/stm32/stm32mp13x/. -I/__w/zephyr/zephyr/subsys/shell/modules/kernel_service/thread/.. -I/__w/zephyr/modules/hal/cmsis/CMSIS/Core_A/Include -I/__w/zephyr/zephyr/modules/cmsis/. -I/__w/zephyr/modules/hal/microchip/include -I/__w/zephyr/modules/hal/st/sensor/inc -I/__w/zephyr/modules/hal/stm32/stm32cube/stm32mp13xx/soc -I/__w/zephyr/modules/hal/stm32/stm32cube/stm32mp13xx/drivers/include -I/__w/zephyr/modules/hal/stm32/stm32cube/common_ll/include -I/__w/zephyr/modules/hal/ti/mspm0/source/ti/devices/msp/. -I/__w/zephyr/modules/hal/ti/mspm0/source/ti/devices/msp/m0p -I/__w/zephyr/modules/hal/ti/mspm0/source/ti/devices/msp/peripherals -I/__w/zephyr/modules/hal/ti/mspm0/source/ti/devices/msp/peripherals/m0p -I/__w/zephyr/modules/hal/ti/mspm0/source/ti/devices/msp/peripherals/m0p/sysctl -I/__w/zephyr/modules/lib/gui/lvgl/src -I/__w/zephyr/zephyr/modules/lvgl/include -isystem /__w/zephyr/zephyr/lib/libc/common/include -Wshadow -fno-strict-aliasing -Werror -Os -imacros /__w/zephyr/zephyr/twister-out/stm32mp135f_dk_stm32mp135fxx/zephyr/samples/modules/lvgl/demos/sample.modules.lvgl.demo_benchmark/zephyr/include/generated/zephyr/autoconf.h -fno-printf-return-value -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-a7 -mabi=aapcs -mfp16-format=ieee -mtp=soft --sysroot=/opt/toolchains/zephyr-sdk-0.17.4/arm-zephyr-eabi/arm-zephyr-eabi -imacros /__w/zephyr/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -ftls-model=local-exec -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/__w/zephyr/zephyr/samples/modules/lvgl/demos=CMAKE_SOURCE_DIR -fmacro-prefix-map=/__w/zephyr/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/__w/zephyr=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=picolibc.specs -std=c17 -MD -MT zephyr/drivers/input/CMakeFiles/drivers__input.dir/input_gt911.c.obj -MF zephyr/drivers/input/CMakeFiles/drivers__input.dir/input_gt911.c.obj.d -o zephyr/drivers/input/CMakeFiles/drivers__input.dir/input_gt911.c.obj -c /__w/zephyr/zephyr/drivers/input/input_gt911.c
/__w/zephyr/zephyr/drivers/input/input_gt911.c:21: error: "DEVICE_ID" redefined [-Werror]
21 | #define DEVICE_ID BSWAP_16(0x8140U)
|
In file included from /__w/zephyr/modules/hal/stm32/stm32cube/stm32mp13xx/soc/stm32mp13xx.h:97,
from /__w/zephyr/zephyr/soc/st/stm32/stm32mp13x/./soc.h:12,
from /__w/zephyr/zephyr/modules/cmsis/./cmsis_core_a_r.h:17,
from /__w/zephyr/zephyr/modules/cmsis/./cmsis_core.h:10,
from /__w/zephyr/zephyr/include/zephyr/arch/arm/asm_inline_gcc.h:24,
from /__w/zephyr/zephyr/include/zephyr/arch/arm/asm_inline.h:18,
from /__w/zephyr/zephyr/include/zephyr/arch/arm/arch.h:30,
from /__w/zephyr/zephyr/include/zephyr/arch/cpu.h:19,
from /__w/zephyr/zephyr/include/zephyr/kernel_includes.h:36,
from /__w/zephyr/zephyr/include/zephyr/kernel.h:17,
from /__w/zephyr/zephyr/include/zephyr/tracing/tracking.h:16,
from /__w/zephyr/zephyr/include/zephyr/tracing/tracing.h:17,
from /__w/zephyr/zephyr/include/zephyr/drivers/gpio.h:23,
from /__w/zephyr/zephyr/drivers/input/input_gt911.c:11:
/__w/zephyr/modules/hal/stm32/stm32cube/stm32mp13xx/soc/stm32mp135fxx_ca7.h:36802: note: this is the location of the previous definition
36802 | #define DEVICE_ID() ((DBGMCU->IDCODE) & (DBGMCU_IDCODE_DEV_ID_Msk))
|
cc1: all warnings bein...
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.