Linkage Zephyr V1.13 versus V2.X
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.
I also had a look at this : https://github.com/zephyrproject-rtos/zephyr/issues/8851
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.