New Component creation for project

Karim1993
Posts: 20
Joined: Mon Aug 27, 2018 4:28 am

New Component creation for project

Postby Karim1993 » Mon Sep 24, 2018 10:37 am

Hi
I have below project directories
Project Folder
-components
--sensors
---sensor.c
---component.mk
---include
----sensor.h
-main
--main.c
--component.mk
-Makefile
-sdkconfig

My component.mk file in sensor folder contents are like this
COMPONENT_ADD_INCLUDEDIRS := include

I included the header file sensor.h in main.c

The component got successfully and .a static library got generated in build/sensors directory but the functions didn't get linked to the main application and i am receiving undefined reference to errors.

Could you help on this.

Thanks,
Karim

ESP_Sprite
Posts: 9020
Joined: Thu Nov 26, 2015 4:08 am

Re: New Component creation for project

Postby ESP_Sprite » Tue Sep 25, 2018 2:49 am

Your setup looks correct, no reason for linking errors to appear. Are you sure it's the problem of the component infrastructure, and not something else? Have you tried running 'make clean' as well?

Karim1993
Posts: 20
Joined: Mon Aug 27, 2018 4:28 am

Re: New Component creation for project

Postby Karim1993 » Wed Sep 26, 2018 4:32 am

Yes,

Make clean also didn't work.
For sensor header file i receive the warning: 'i2c_master_init' used but never defined
For the sensor c source file i receive the warning: 'i2c_master_init' defined but not used [-Wunused-function]
and for main.c i receive error: undefined reference to `i2c_master_init'

Do I need make any changes to the Makefile/ component.mk of main folder to include the sensor static library/component or will it automatically handled ?

ESP_Sprite
Posts: 9020
Joined: Thu Nov 26, 2015 4:08 am

Re: New Component creation for project

Postby ESP_Sprite » Wed Sep 26, 2018 6:18 am

Any chance you can put the log saying that and/or the entire project somewhere, so we can take a look?

Karim1993
Posts: 20
Joined: Mon Aug 27, 2018 4:28 am

Re: New Component creation for project

Postby Karim1993 » Wed Sep 26, 2018 8:27 am

PFA, log and Makefile .
Its basically the blink example where i added the component
Attachments
blink.zip
(6.29 KiB) Downloaded 338 times

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot], Majestic-12 [Bot] and 188 guests