Error: No such file or directory when adding new files in sdk, call back function definition in ble_service.c definition in

Learn MoreFAQsTutorials

6 posts / 0 new
Last post
prasanna
Online
Last seen:5 min 25 sec ago
Joined:2020-09-29 11:56
Error: No such file or directory when adding new files in sdk, call back function definition in ble_service.c definition in

Dear Dialog,

1. In the process of custom service creation, I have created two files custom_service.h and custom_service.c inside the "sdk -> ble-> services" folder of the ble_adv demo project. I am using the sdk 10.0.10. when I tried to build the project, I am getting this error for custom_service.h.

"fatal error: custom_service.h: No such file or directory
#include "custom_service.h"
| ^~~~~~~~~~~~~~~~~~

I am not understanding what's wrong with this new files addition. They are in the correct path and their project locations are the same. I checked the include paths in the c/c++ build settings as well. everything looks fine. I request you to please help me with this as I cannot test my my new additions whether they are working or not.

2. I have some confusion in understanding the call back functions prototype and their definition in ble_service.h and ble_service.c files in /ble_adv/sdk/ble/services/includes/ble_service.h and /ble_adv/sdk/ble/services/src/ble_service.c files respectvely in the sdk. I will attach here one function to explain what I did not understand.

//call back function prototype in ble_service.h typedef void (* connected_evt_t) ( ble_service_t *svc, const ble_evt_gap_connected_t *evt); // I am assuming the following is the above call back function(connected_evt) definition static void connected_evt(const ble_evt_gap_connected_t *evt) { int i; for (i = 0; i < MAX_SERVICES; i++) { ble_service_t *svc = services[i]; if (svc && svc->connected_evt) { svc->connected_evt( evt); } } }

So, here what I didnot get is

1. If (*connected_evt_t) is pointing to the connected_evt() function, why the first argument (ble_service_t *svc) is not passed in the function definition. Since the prototype and the definition should be same with number of argments?

Thanks in advance.

Regards, Prasanna

Device:
PM_Dialog
Online
Last seen:10 min 18 sec ago
Staff
Joined:2018-02-08 11:03
Hi Prasanna,

Hi Prasanna,

As you mentioned in your initial post, you have started developing your own project. So, could you please take a look at theDA1469x Tutorial Starting a Projectto make sure that the setup is OK? In section 2, you will also find steps to include your own files.

Can you please also take a screenshot with the error and share it?

The typedef struct ble_service ble_service_t; is a global structure.

Thanks, PM_Dialog

prasanna
Online
Last seen:5 min 25 sec ago
Joined:2020-09-29 11:56
Hi PM_Dialog,

Hi PM_Dialog,

I have imported the ble_adv demo project from the sdk and started to make changes to it. In this process, i added custom_service.h and custom_service.c to "sdk -> ble-> services" include and source files respectively. Is this the correct way to make changes to the existing demo project? Please find the error attached regarding adding files to ble_adv demo project.

错误当添加新文件构建fi SDKle: /home/prasanna/DiaSemi/SDK_10.0.10.118/sdk/interfaces/ble/services/src/custom_service.c Invoking: Cross ARM C Compiler /home/prasanna/DiaSemi/SDK_10.0.10.118/sdk/interfaces/ble/services/src/custom_service.c:49:10: fatal error: custom_service.h: No such file or directory 49 | #include "custom_service.h" | ^~~~~~~~~~~~~~~~~~ compilation terminated. make[1]: *** [sdk/ble/services/src/subdir.mk:116: sdk/ble/services/src/custom_service.o] Error 1 make: *** [makefile:60: all] Error 2 "make --silent all" terminated with exit code 2. Build might be incomplete.

2. Also, I encounter another problem. Whatever changes I do to one demo project under SDK, they are applying to other demo projects as well since they are under same SDK. For example if I add one header file to ble-> service->include of ble_adv project, they are also automatically added to the same path of the ble_custom_service project. This is bringing me additional problems of deleting and adding files. Please tell me how to rectify this problem.

PM_Dialog
Online
Last seen:10 min 18 sec ago
Staff
Joined:2018-02-08 11:03
Hi Prasanna,

Hi Prasanna,

You mentioned that the problem has been fixed in this ticket, hasn’t it?

https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software/error-undefined-reference-function

Could you please clarify your second question? There are tutorial and SW Examples demonstrating how to implement a custom service. You don’t need to modify any of the SDK files.

Thanks, PM_Dialog

prasanna
Online
Last seen:5 min 25 sec ago
Joined:2020-09-29 11:56
Hi PM_Dialog,

Hi PM_Dialog,

My second question.

我用两个演示项目at the moment. One is the "ble-adv" demo and the other is the "da1469x_custom_ble_service_sample_code". I wanted to copy the custom_service.c and custom_service.h files created outside the sdk in the "da1469x_custom_ble_service_sample_code" to the "ble_adv" demo project inside the sdk/ble/services folder. So, now what's happening is those files are also being copied to the "custom_ble_service_sample_code" sdk inside ble/services folder.

Sumary: The new files added to one demo project inside the sdk are automatically seen in other project sdk. So, I understood its better to add own files outside the sdk. Is this correct?

Regards,Prasanna

PM_Dialog
Online
Last seen:10 min 18 sec ago
Staff
Joined:2018-02-08 11:03
Hi Prasanna,