who defines __ethernet_conf_h_exists_?

Technical questions regarding the XTC tools and programming with XMOS.
goodfeather
Member++
Posts: 23
Joined: Wed Mar 30, 2016 11:10 am

who defines __ethernet_conf_h_exists_?

Post by goodfeather »

Dear Sir,
AVB-DC example application in Studio13 works on module_ethernet_board_support, and the main.xc includes "ethernet_board_support.h".

In ethernet_board_support.h, this directive "#ifdef __ethernet_conf_h_exists_" is true.

Who and where does define "__ethernet_conf_h_exists_"?

And, what's .metainfo? when programming, do we need to care about this kind of file?

Thanks
peter
XCore Addict
Posts: 230
Joined: Wed Mar 10, 2010 12:46 pm

Post by peter »

Dear goodfeather,

That #define is created automatically by the build system (Makefile.common1 to be exact). It allows you to guard your include with the existence of a file.

The .metainfo files are all for the use of the tools, so you do not need to concern yourself with them.

Regards,

Peter
goodfeather
Member++
Posts: 23
Joined: Wed Mar 30, 2016 11:10 am

Post by goodfeather »

Dear Peter,
I built a test headfile "test_conf.h" in the same DIR,and find __ethernet_conf_h_ is defined but__test_conf_h_ not. Why?

We are trying to upgrade the design to Xcore200 from LSLICEKIT-L16. We want to know the reason to avoid of missing some include files.

Thanks
peter
XCore Addict
Posts: 230
Joined: Wed Mar 10, 2010 12:46 pm

Post by peter »

Sorry, I forgot to mention that you need to add something to the Makefile in order to have that define created. For example, the lib_ethernet line is:

Code: Select all

OPTIONAL_HEADERS += ethernet_conf.h
Peter
goodfeather
Member++
Posts: 23
Joined: Wed Mar 30, 2016 11:10 am

Post by goodfeather »

Dear Peter,
On your advice, for my test headfile "test_conf.h" , __test_h_exists_ is found to be defined in ethernet_board_support.h.

It also confuses me. the main.xc directly include module_ethernet_board_support's ethernet_board_support.h, why do I need to modify another module(module_ethernet)'s makefile?

Thanks
peter
XCore Addict
Posts: 230
Joined: Wed Mar 10, 2010 12:46 pm

Post by peter »

Sorry, it is not clear why you need to modify the module_ethernet module_build_info? You should be able to do it all through your own application's Makefile.

Peter
goodfeather
Member++
Posts: 23
Joined: Wed Mar 30, 2016 11:10 am

Post by goodfeather »

Dear Peter,
In fact, I can add "OPTIONAL_HEADERS += test_conf.h" in any module's makefile(even no any relation with module_ethernet_board_support), and then __ethernet_conf_h_exists_ is defined in ethernet_board_support.h.

Does it mean if I declare "OPTIONAL_HEADERS += test_conf.h" in any module, "__ethernet_conf_h_exists_" will then be defined in whole workspace?

This is different from the description about " OPTIONAL_HEADERS" in "xTIMEcomposer-User-Guide-14_14.x".

Thanks
peter
XCore Addict
Posts: 230
Joined: Wed Mar 10, 2010 12:46 pm

Post by peter »

Yes, it does appear that wherever you define the OPTIONAL_HEADERS then when compiling the entire project it will be available to all modules being used by that project.

To test this you can add VERBOSE=1 to your compiler flags and see what defines are being used.

Peter
goodfeather
Member++
Posts: 23
Joined: Wed Mar 30, 2016 11:10 am

Post by goodfeather »

Dear Peter,
Many thanks for your help!