Skip to content

Conversation

Copy link

Copilot AI commented Nov 23, 2025

Two IEEE 802.15.4 drivers used the undefined AF_UNSPEC constant instead of Zephyr's NET_AF_UNSPEC, causing build failures.

Changes

  • drivers/ieee802154/ieee802154_kw41z.c: Replace AF_UNSPECNET_AF_UNSPEC in handle_ack()
  • drivers/ieee802154/ieee802154_esp32.c: Replace AF_UNSPECNET_AF_UNSPEC in handle_ack()

Both files already use NET_AF_UNSPEC correctly elsewhere; these were isolated inconsistencies.

// Before
ack_pkt = net_pkt_rx_alloc_with_buffer(iface, len, AF_UNSPEC, 0, K_NO_WAIT);

// After  
ack_pkt = net_pkt_rx_alloc_with_buffer(iface, len, NET_AF_UNSPEC, 0, K_NO_WAIT);
Original prompt

FAILED: zephyr/drivers/ieee802154/CMakeFiles/drivers__ieee802154.dir/ieee802154_kw41z.c.obj
ccache /opt/toolchains/zephyr-sdk-0.17.4/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -DCPU_MKW41Z512VHT4 -DKERNEL -DK_HEAP_MEM_POOL_SIZE=0 -DPICOLIBC_LONG_LONG_PRINTF_SCANF -DTC_RUNID=96514c9c369b56e553db20fd6e0253b1 -DZVFS_OPEN_SIZE=6 -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/frdm_kw41z_mkw41z4/zephyr/tests/net/lib/mqtt_sn_packet/net.mqtt_sn.packet/zephyr/include/generated/zephyr -I/__w/zephyr/zephyr/include -I/__w/zephyr/zephyr/twister-out/frdm_kw41z_mkw41z4/zephyr/tests/net/lib/mqtt_sn_packet/net.mqtt_sn.packet/zephyr/include/generated -I/__w/zephyr/zephyr/soc/nxp/kinetis -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/nxp/kinetis/kwx/. -I/__w/zephyr/zephyr/soc/nxp/kinetis/common -I/__w/zephyr/zephyr/soc/nxp/kinetis/../common -I/__w/zephyr/zephyr/subsys/testsuite/include -I/__w/zephyr/zephyr/subsys/testsuite/coverage -I/__w/zephyr/zephyr/subsys/testsuite/ztest/include -I/__w/zephyr/modules/hal/cmsis_6/CMSIS/Core/Include -I/__w/zephyr/zephyr/modules/cmsis_6/. -I/__w/zephyr/modules/hal/microchip/include -I/__w/zephyr/modules/hal/nxp/mcux/mcux-sdk/devices/MKW41Z4 -I/__w/zephyr/modules/hal/nxp/mcux/mcux-sdk/devices/MKW41Z4/drivers -I/__w/zephyr/modules/hal/nxp/mcux/mcux-sdk-ng/drivers/common -I/__w/zephyr/modules/hal/nxp/mcux/mcux-sdk/devices/MKW41Z4/. -I/__w/zephyr/modules/hal/nxp/mcux/mcux-sdk-ng/drivers/lpuart -I/__w/zephyr/modules/hal/nxp/mcux/mcux-sdk-ng/drivers/port -I/__w/zephyr/modules/hal/nxp/mcux/mcux-sdk-ng/drivers/trng -I/__w/zephyr/modules/hal/nxp/mcux/middleware/wireless/framework_5.3.3/Common -I/__w/zephyr/modules/hal/nxp/mcux/middleware/wireless/framework_5.3.3/OSAbstraction/Interface -I/__w/zephyr/modules/hal/nxp/mcux/middleware/wireless/framework_5.3.3/XCVR/MKW41Z4 -I/__w/zephyr/modules/hal/st/sensor/inc -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 -isystem /__w/zephyr/zephyr/lib/libc/common/include -Wshadow -fno-strict-aliasing -Werror -Os -imacros /__w/zephyr/zephyr/twister-out/frdm_kw41z_mkw41z4/zephyr/tests/net/lib/mqtt_sn_packet/net.mqtt_sn.packet/zephyr/include/generated/zephyr/autoconf.h -fno-printf-return-value -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m0plus -mthumb -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/tests/net/lib/mqtt_sn_packet=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/ieee802154/CMakeFiles/drivers__ieee802154.dir/ieee802154_kw41z.c.obj -MF zephyr/drivers/ieee802154/CMakeFiles/drivers__ieee802154.dir/ieee802154_kw41z.c.obj.d -o zephyr/drivers/ieee802154/CMakeFiles/drivers__ieee802154.dir/ieee802154_kw41z.c.obj -c /__w/zephyr/zephyr/drivers/ieee802154/ieee802154_kw41z.c
/__w/zephyr/zephyr/drivers/ieee802154/ieee802154_kw41z.c: In function 'handle_ack':
/__w/zephyr/zephyr/drivers/ieee802154/ieee802154_kw41z.c:584:48: error: 'AF_UNSPEC' undeclared (first use in this function); did you mean 'NET_AF_UNSPEC'?
584 | AF_UNSPEC, 0, K_NO_WAIT);
| ^~~~~~~~~
| NET_AF_UNSPEC
/__w/zephyr/zephyr/drivers/ieee802154/ieee802154_kw41z.c:584:48: note: each undeclared identifier is reported only once for each function it appears in
ninja: build stopped: subcommand failed.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Fix build error in ieee802154 driver for kw41z Fix AF_UNSPEC usage in IEEE 802.15.4 drivers Nov 23, 2025
Copilot AI requested a review from kartben November 23, 2025 17:15
Copilot finished work on behalf of kartben November 23, 2025 17:15
@kartben kartben closed this Dec 6, 2025
@kartben kartben deleted the copilot/fix-ieee802154-build-error branch December 6, 2025 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants