Page 1 of 1

New Component creation for project

Posted: Mon Sep 24, 2018 10:37 am
by Karim1993
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

Re: New Component creation for project

Posted: Tue Sep 25, 2018 2:49 am
by ESP_Sprite
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?

Re: New Component creation for project

Posted: Wed Sep 26, 2018 4:32 am
by Karim1993
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 ?

Re: New Component creation for project

Posted: Wed Sep 26, 2018 6:18 am
by ESP_Sprite
Any chance you can put the log saying that and/or the entire project somewhere, so we can take a look?

Re: New Component creation for project

Posted: Wed Sep 26, 2018 8:27 am
by Karim1993
PFA, log and Makefile .
Its basically the blink example where i added the component