Discuss here different C compiler set ups, and compiling executables for the ESP8266

User avatar
By kadamski
#12949 Please pull recent change and check again, the error should disappear.

As for the question - yes, this functionality is designed exactly for this purpose. You're device will report custom hostname to DHCP server when obtaining address. If your DNS server can use DHCP database for resolving hostnames (like most home wifi routers), you should be able to use this hostname instead of IP address. The actual hostname will be made by concatenating the prefix set in config/lwipopts.h with hexadecimal representation of 3 lest significant bytes of MAC address.

If you have any problems, let me know here or open issue on github.
User avatar
By minoas
#13228 Thank's it actually compiled and automatically merged with the libmain.a. Now let me see if I understood correctly what it required.

First I edited those files
Code: Select all[makefile.mk]
USE_OUR_LWIP_IF = 1
LIBMAIN_PATH = /opt/esp-open-sdk/sdk/lib/libmain.a


modily the define in lwiports.h in the config directory like this.
#define LWIP_NETIF_HOSTNAME_PREFIX "esb8266-"

cd /opt/esp-lwip
make clean
make all

Then:
modify the include/lwiports.h in esphttpd project to include the line
#define LWIP_NETIF_HOSTNAME_PREFIX "esc8266-"

In both esphttpd and some of the examples I am getting a hostname of that format:
"Unknown-MAC-ADDR"

What am I missing?

I am guessing the hostname prefix is supposed to be defined i in the projects version of lwiports.h otherwise it wouldn't be that portable. I have included both just in case trying to catch any.

Thanks
User avatar
By kadamski
#13273
minoas wrote:Thank's it actually compiled and automatically merged with the libmain.a. Now let me see if
First I edited those files
Code: Select all[makefile.mk]
USE_OUR_LWIP_IF = 1
LIBMAIN_PATH = /opt/esp-open-sdk/sdk/lib/libmain.a



You mean Makefile-local.mk, right?

minoas wrote:Then:
modify the include/lwiports.h in esphttpd project to include the line

This file is totally irrelevant.

minoas wrote:I am guessing the hostname prefix is supposed to be defined i in the projects version of lwiports.h otherwise it wouldn't be that portable. I have included both just in case trying to catch any.

You should define hostname when compiling lwip library. There is no support to change it later, when compiling projects with the library.

What wifi router are you using ? Are you able to use Wireshart to sniff the communication and verify if esp8266 is sending it's hostname to DHCP server?
User avatar
By minoas
#13292 Yes I did mean the Makefile-local.mk, sorry for the incoherent post but I it was quite late. I checked that is imported correctly to the normal Makefile.

The router is a Dlink wrt54GL running latest version of dd-wrt .I can try with a stock SKY and BTHub router.

You are right I should use wireshark. I just got a batch of ESP chips so will try on a different revision board as well. Will keep you posted thanks.