Re: Linkage Zephyr V1.13 versus V2.X
I had the same issue when moving forward kernel versions. The API for
At the top level get rid of the bt_gatt_ccc_cfg variables (my code has two characteristics) :
static struct bt_gatt_ccc_cfg iks_atom_ccc_cfg[BT_GATT_CCC_MAX];
static struct bt_gatt_ccc_cfg iks_mtoa_ccc_cfg[BT_GATT_CCC_MAX];
And inside the bt_gatt_attr change the parameters to the BT_GATT_CCC macro, delete the first parameter it is no longer needed, and add a new 3rd parameter (same thing in two places for me):
// BT_GATT_CCC(iks_atom_ccc_cfg_changed,BT_GATT_PERM_READ | BT_GATT_PERM_WRITE),
// BT_GATT_CCC(iks_atom_ccc_cfg_changed,BT_GATT_PERM_READ | BT_GATT_PERM_WRITE_ENCRYPT),
From: devel@... <devel@...> On Behalf Of frv
Sent: Wednesday, December 4, 2019 2:19 AM
Subject: [Zephyr-devel] Linkage Zephyr V1.13 versus V2.X
[Edited Message Follows]
Recently I have moved from Zephyr 1.13 to V2.
I ported my simple BLE peripheral application based on the sample code peripheral_hr from V1.13 to V2.
However I can't seem to get it build anymore due to a linkage issue.
As far as I can see the sources are well compiled but for some reason the linker reports an undefined reference.
"/home/frv/develop/zephyrproject/zephyr/samples/bluetooth/peripheral_hrORIGI/src/button.c:78: undefined reference to `bt_gatt_service_register'"
In my setup the GATT services are still defined in separate files.
So next to my main.c that calls the init function (button_init()) I have the sources button.c and button.h file where I define my own GATT service (cfr. hrs.c, hrs.h as done in V1.13) to follow up a button press.
The CMakeLists.txt has as content (which is pretty simple):
# SPDX-License-Identifier: Apache-2.0
FILE(GLOB app_sources src/*.c)
//has the button.h file
In the button.c code snippet:
static struct bt_gatt_service button_svc = BT_GATT_SERVICE(attrs);
int result = bt_gatt_service_register(&button_svc);
I have spend some time on looking at the boilerplate concepts but so far without any luck to prevent the linker error.
Any idea's what the issue could be and how to solve this properly. Linkage order?
BTW when I do the call, bt_gatt_service_register, in the main.c this is not seen as an undefined reference.