How to include .h files from other folders in make file?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I want to separate application source files in to different folders and how to direct compiler look in to these folders for .h files(make file)?

0 Likes
1 Solution
asridharan
Employee
Employee
10 comments on KBA 5 comments on KBA First comment on KBA

All your application sources have to be under the Apps directory in the SDK. You can have sub-directories under this and in your application's makefile.mk, you have to include the relative path from the application's directory when adding sources to APP_SRC. You can include sub-directories that have headers you want to include by adding the patch to the INCS make variable.

For ex. If you application is called my_app and you have 3 sourcesheaders in the top level directory and some more in a sub directory called drivers (and their headers), this is what your directory structure will then look like:

WICED-Smart-SDK/Apps/myapp/makefile.mk

WICED-Smart-SDK/Apps/myapp/my_app.c

WICED-Smart-SDK/Apps/myapp/my_app.h

WICED-Smart-SDK/Apps/myapp/my_helper.c

WICED-Smart-SDK/Apps/myapp/drivers/driver.c

WICED-Smart-SDK/Apps/myapp/drivers/driver.h

WICED-Smart-SDK/Apps/myapp/drivers/driver_helper.c

Your makefile.mk should have this:

# Include application sources; use relative patch from this directory for sub-directories.

APP_SRC += my_app.c   my_helper.c  drivers/driver.c  drivers/driver_helper.c

# Need to add path to includes in drivers sub-directory. $(DIR) is the application directory.

INCS += $(DIR)/drivers

View solution in original post

6 Replies
asridharan
Employee
Employee
10 comments on KBA 5 comments on KBA First comment on KBA

All your application sources have to be under the Apps directory in the SDK. You can have sub-directories under this and in your application's makefile.mk, you have to include the relative path from the application's directory when adding sources to APP_SRC. You can include sub-directories that have headers you want to include by adding the patch to the INCS make variable.

For ex. If you application is called my_app and you have 3 sourcesheaders in the top level directory and some more in a sub directory called drivers (and their headers), this is what your directory structure will then look like:

WICED-Smart-SDK/Apps/myapp/makefile.mk

WICED-Smart-SDK/Apps/myapp/my_app.c

WICED-Smart-SDK/Apps/myapp/my_app.h

WICED-Smart-SDK/Apps/myapp/my_helper.c

WICED-Smart-SDK/Apps/myapp/drivers/driver.c

WICED-Smart-SDK/Apps/myapp/drivers/driver.h

WICED-Smart-SDK/Apps/myapp/drivers/driver_helper.c

Your makefile.mk should have this:

# Include application sources; use relative patch from this directory for sub-directories.

APP_SRC += my_app.c   my_helper.c  drivers/driver.c  drivers/driver_helper.c

# Need to add path to includes in drivers sub-directory. $(DIR) is the application directory.

INCS += $(DIR)/drivers

Anonymous
Not applicable

Thanks for quick reply.

One more request : Hardware team wants to tweak components in impedance matching network to get optimum power performance. For this, they want me to transmit signal continuously.

Could you please suggest if it is possible at all.

0 Likes

Yes, this is possible. Have you looked at the Manufacturing Bluetooth Test (mbt) tool? There is a document that describes in SDK 2.1.x under <SDK>/Doc and the tool is in <SDK>/Tools/mbt/

0 Likes
Anonymous
Not applicable

Is it possible to add files from outside Apps directory

for example :

WICED-Smart-SDK/Apps/myapp/my_app.c

WICED-Smart-SDK/Apps/myapp/my_app.h

WICED-Smart-SDK/submodules/submodule_file1.c

WICED-Smart-SDK/submodules/submodule_file1.h



0 Likes

Yes, and you should relative paths from the app directory like above.

Anonymous
Not applicable

It worked. Thanks for information.

0 Likes