-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Description
My setup is a Bluetooth dongle with a split keyboard, so 1 central and 2 peripheral parts, i.e. 3 parts in total. I enabled battery level reporting for peripheral parts.
My user config for the dongle is:
CONFIG_ZMK_SPLIT_ROLE_CENTRAL=y
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_CENTRAL_PERIPHERALS=2
CONFIG_ZMK_BLE=y
CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING=y
CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_PROXY=y
In this setup compilation of the dongle firmware aborts with the following compile error:
FAILED: CMakeFiles/app.dir/src/split/bluetooth/central_bas_proxy.c.obj
arm-none-eabi-gcc -DKERNEL -DNRF52840_XXAA -D__PROGRAM_START -D__ZEPHYR__=1 -I/build/source/zmk/app/incl>
In file included from /build/source/zmk/app/src/split/bluetooth/central_bas_proxy.c:12:
/build/source/zephyr/include/zephyr/sys/util_listify.h:22:11: error: initialization of 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
22 | F(1, __VA_ARGS__)
| ^
/build/source/zephyr/include/zephyr/bluetooth/gatt.h:572:54: note: in definition of macro 'BT_GATT_SERVICE_DEFINE'
572 | const struct bt_gatt_attr attr_##_name[] = { __VA_ARGS__ }; \
| ^~~~~~~~~~~
/build/source/zephyr/include/zephyr/bluetooth/gatt.h:723:9: note: in expansion of macro 'BT_GATT_ATTRIBUTE'
723 | BT_GATT_ATTRIBUTE(_uuid, _perm, _read, _write, _user_data)
| ^~~~~~~~~~~~~~~~~
/build/source/zmk/app/src/split/bluetooth/central_bas_proxy.c:62:5: note: in expansion of macro 'BT_GATT_CHARACTERISTIC'
62 | BT_GATT_CHARACTERISTIC(BT_UUID_BAS_BATTERY_LEVEL, BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY, \
| ^~~~~~~~~~~~~~~~~~~~~~
/build/source/zephyr/include/zephyr/sys/util_listify.h:22:9: note: in expansion of macro 'PERIPH_BATT_LEVEL_ATTRS'
22 | F(1, __VA_ARGS__)
| ^
/build/source/zephyr/include/zephyr/sys/util_internal.h:105:36: note: in expansion of macro 'Z_UTIL_LISTIFY_2'
105 | #define UTIL_PRIMITIVE_CAT(a, ...) a##__VA_ARGS__
| ^
/build/source/zephyr/include/zephyr/sys/util_internal.h:104:26: note: in expansion of macro 'UTIL_PRIMITIVE_CAT'
104 | #define UTIL_CAT(a, ...) UTIL_PRIMITIVE_CAT(a, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~
/build/source/zephyr/include/zephyr/sys/util_macro.h:418:35: note: in expansion of macro 'UTIL_CAT'
418 | #define LISTIFY(LEN, F, sep, ...) UTIL_CAT(Z_UTIL_LISTIFY_, LEN)(F, sep, __VA_ARGS__)
| ^~~~~~~~
/build/source/zmk/app/src/split/bluetooth/central_bas_proxy.c:68:24: note: in expansion of macro 'LISTIFY'
68 | LISTIFY(CONFIG_ZMK_SPLIT_BLE_CENTRAL_PERIPHERALS, PERIPH_BATT_LEVEL_ATTRS,
| ^~~~~~~
compilation terminated due to -Wfatal-errors.
At a quick glance, the error is that the index of a list entry (an int created by LISTIFY) is assigned to bt_gatt_attr.user_data (type void *).
Note that CONFIG_ZMK_SPLIT_BLE_CENTRAL_PERIPHERAL is 2 and the list index becomes 0 and 1. There is no problem for 0 (only 1 periphery part) as int 0 is the null pointer, but int 1 (second periphery part) fails.
Additional notes:
The pull request #2938 modifies the offending code but I was not yet able to test whether it solves the issue.