mirror of
				https://github.com/esp8266/Arduino.git
				synced 2025-10-27 05:56:11 +03:00 
			
		
		
		
	Fixes for IPv6, added in CI (#5557)
This commit is contained in:
		| @@ -44,6 +44,14 @@ jobs: | |||||||
|       script: $TRAVIS_BUILD_DIR/tests/common.sh |       script: $TRAVIS_BUILD_DIR/tests/common.sh | ||||||
|       env: |       env: | ||||||
|         - BUILD_TYPE=debug_odd |         - BUILD_TYPE=debug_odd | ||||||
|  |     - name: "Build IPv6 (1)" | ||||||
|  |       script: $TRAVIS_BUILD_DIR/tests/common.sh | ||||||
|  |       env: | ||||||
|  |         - BUILD_TYPE=build6_even | ||||||
|  |     - name: "Build IPv6 (2)" | ||||||
|  |       script: $TRAVIS_BUILD_DIR/tests/common.sh | ||||||
|  |       env: | ||||||
|  |         - BUILD_TYPE=build6_odd | ||||||
|     - name: "Platformio (1)" |     - name: "Platformio (1)" | ||||||
|       script: $TRAVIS_BUILD_DIR/tests/common.sh |       script: $TRAVIS_BUILD_DIR/tests/common.sh | ||||||
|       env: |       env: | ||||||
|   | |||||||
| @@ -187,11 +187,6 @@ const IPAddress INADDR_NONE(255,255,255,255); | |||||||
|  |  | ||||||
| #if LWIP_IPV6 | #if LWIP_IPV6 | ||||||
|  |  | ||||||
| IPAddress::IPAddress(const ip_addr_t* from) |  | ||||||
| { |  | ||||||
|     ip_addr_copy(_ip, *from); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| bool IPAddress::fromString6(const char *address) { | bool IPAddress::fromString6(const char *address) { | ||||||
|     // TODO: test test test |     // TODO: test test test | ||||||
|  |  | ||||||
|   | |||||||
| @@ -149,8 +149,8 @@ class IPAddress: public Printable { | |||||||
|         /* |         /* | ||||||
|                lwIP address compatibility |                lwIP address compatibility | ||||||
|         */ |         */ | ||||||
|  |         IPAddress(const ipv4_addr& fw_addr)   { setV4(); v4() = fw_addr.addr; } | ||||||
|         IPAddress(const ipv4_addr* fw_addr)   { setV4(); v4() = fw_addr->addr; } |         IPAddress(const ipv4_addr* fw_addr)   { setV4(); v4() = fw_addr->addr; } | ||||||
|         IPAddress(const ip_addr_t& lwip_addr) { _ip = lwip_addr; } |  | ||||||
|  |  | ||||||
|         operator       ip_addr_t () const { return  _ip; } |         operator       ip_addr_t () const { return  _ip; } | ||||||
|         operator const ip_addr_t*() const { return &_ip; } |         operator const ip_addr_t*() const { return &_ip; } | ||||||
| @@ -163,7 +163,8 @@ class IPAddress: public Printable { | |||||||
|  |  | ||||||
| #if LWIP_IPV6 | #if LWIP_IPV6 | ||||||
|  |  | ||||||
|         IPAddress(const ip_addr_t* from); |         IPAddress(const ip_addr_t& lwip_addr) { ip_addr_copy(_ip, lwip_addr); } | ||||||
|  |         IPAddress(const ip_addr_t* lwip_addr) { ip_addr_copy(_ip, *lwip_addr); } | ||||||
|  |  | ||||||
|         uint16_t* raw6() |         uint16_t* raw6() | ||||||
|         { |         { | ||||||
|   | |||||||
| @@ -74,10 +74,7 @@ AVRISPState_t ESP8266AVRISP::update() { | |||||||
|             if (_server.hasClient()) { |             if (_server.hasClient()) { | ||||||
|                 _client = _server.available(); |                 _client = _server.available(); | ||||||
|                 _client.setNoDelay(true); |                 _client.setNoDelay(true); | ||||||
|                 ip_addr_t lip; |                 AVRISP_DEBUG("client connect %s:%d", _client.remoteIP().toString().c_str(), _client.remotePort()); | ||||||
|                 lip.addr = _client.remoteIP(); |  | ||||||
|                 AVRISP_DEBUG("client connect %d.%d.%d.%d:%d", IP2STR(&lip), _client.remotePort()); |  | ||||||
|                 (void) lip; // Avoid unused warning when not in debug mode |  | ||||||
|                 _client.setTimeout(100); // for getch() |                 _client.setTimeout(100); // for getch() | ||||||
|                 _state = AVRISP_STATE_PENDING; |                 _state = AVRISP_STATE_PENDING; | ||||||
|                 _reject_incoming(); |                 _reject_incoming(); | ||||||
|   | |||||||
| @@ -154,11 +154,9 @@ bool ESP8266NetBIOS::begin(const char *name) | |||||||
|     if(_pcb != NULL) { |     if(_pcb != NULL) { | ||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
|     ip_addr_t addr; |  | ||||||
|     addr.addr = INADDR_ANY; |  | ||||||
|     _pcb = udp_new(); |     _pcb = udp_new(); | ||||||
|     udp_recv(_pcb, &_s_recv, (void *) this); |     udp_recv(_pcb, &_s_recv, (void *) this); | ||||||
|     err_t err = udp_bind(_pcb, &addr, NBNS_PORT); |     err_t err = udp_bind(_pcb, INADDR_ANY, NBNS_PORT); | ||||||
|     if(err != ERR_OK) { |     if(err != ERR_OK) { | ||||||
|         end(); |         end(); | ||||||
|         return false; |         return false; | ||||||
| @@ -182,9 +180,13 @@ void ESP8266NetBIOS::_recv(udp_pcb *upcb, pbuf *pb, CONST ip_addr_t *addr, uint1 | |||||||
|     while(pb != NULL) { |     while(pb != NULL) { | ||||||
|         uint8_t * data = (uint8_t*)((pb)->payload); |         uint8_t * data = (uint8_t*)((pb)->payload); | ||||||
|         size_t len = pb->len; |         size_t len = pb->len; | ||||||
|         ip_hdr* iphdr = reinterpret_cast<ip_hdr*>(data - UDP_HLEN - IP_HLEN); | #if LWIP_VERSION_MAJOR == 1 | ||||||
|         ip_addr_t saddr; |         // check UdpContext.h | ||||||
|         saddr.addr = iphdr->src.addr; |         const ip_addr_t* saddr = ¤t_iphdr_src; | ||||||
|  | #else | ||||||
|  |         // check UdpContext.h | ||||||
|  |         const ip_addr_t* saddr = &ip_data.current_iphdr_src; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|         if (len >= sizeof(struct NBNSQUESTION)) { |         if (len >= sizeof(struct NBNSQUESTION)) { | ||||||
|             struct NBNSQUESTION * question = (struct NBNSQUESTION *)data; |             struct NBNSQUESTION * question = (struct NBNSQUESTION *)data; | ||||||
| @@ -221,7 +223,7 @@ void ESP8266NetBIOS::_recv(udp_pcb *upcb, pbuf *pb, CONST ip_addr_t *addr, uint1 | |||||||
|                     if(pbt != NULL) { |                     if(pbt != NULL) { | ||||||
|                         uint8_t* dst = reinterpret_cast<uint8_t*>(pbt->payload); |                         uint8_t* dst = reinterpret_cast<uint8_t*>(pbt->payload); | ||||||
|                         memcpy(dst, (uint8_t *)&nbnsa, sizeof(nbnsa)); |                         memcpy(dst, (uint8_t *)&nbnsa, sizeof(nbnsa)); | ||||||
|                         udp_sendto(_pcb, pbt, &saddr, NBNS_PORT); |                         udp_sendto(_pcb, pbt, saddr, NBNS_PORT); | ||||||
|                         pbuf_free(pbt); |                         pbuf_free(pbt); | ||||||
|                     } |                     } | ||||||
|                 } else if (0 == strcmp(name, "*")) { |                 } else if (0 == strcmp(name, "*")) { | ||||||
| @@ -251,7 +253,7 @@ void ESP8266NetBIOS::_recv(udp_pcb *upcb, pbuf *pb, CONST ip_addr_t *addr, uint1 | |||||||
|                     if(pbt != NULL) { |                     if(pbt != NULL) { | ||||||
|                         uint8_t* dst = reinterpret_cast<uint8_t*>(pbt->payload); |                         uint8_t* dst = reinterpret_cast<uint8_t*>(pbt->payload); | ||||||
|                         memcpy(dst, (uint8_t *)&nbnsan, sizeof(nbnsan)); |                         memcpy(dst, (uint8_t *)&nbnsan, sizeof(nbnsan)); | ||||||
|                         udp_sendto(_pcb, pbt, &saddr, NBNS_PORT); |                         udp_sendto(_pcb, pbt, saddr, NBNS_PORT); | ||||||
|                         pbuf_free(pbt); |                         pbuf_free(pbt); | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|   | |||||||
| @@ -107,17 +107,14 @@ public: | |||||||
|         udp_disconnect(_pcb); |         udp_disconnect(_pcb); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     void setMulticastInterface(const IPAddress& addr) | ||||||
|  |     { | ||||||
| #if LWIP_VERSION_MAJOR == 1 | #if LWIP_VERSION_MAJOR == 1 | ||||||
|     void setMulticastInterface(const ip_addr_t addr) |         udp_set_multicast_netif_addr(_pcb, (ip_addr_t)addr); | ||||||
|     { |  | ||||||
|         udp_set_multicast_netif_addr(_pcb, addr); |  | ||||||
|     } |  | ||||||
| #else | #else | ||||||
|     void setMulticastInterface(const ip_addr_t* addr) |         udp_set_multicast_netif_addr(_pcb, ip_2_ip4((const ip_addr_t*)addr)); | ||||||
|     { |  | ||||||
|         udp_set_multicast_netif_addr(_pcb, ip_2_ip4(addr)); |  | ||||||
|     } |  | ||||||
| #endif | #endif | ||||||
|  |     } | ||||||
|  |  | ||||||
|     void setMulticastTTL(int ttl) |     void setMulticastTTL(int ttl) | ||||||
|     { |     { | ||||||
|   | |||||||
| @@ -244,9 +244,9 @@ bool MDNSResponder::_parseQuery(const MDNSResponder::stcMDNS_MsgHeader& p_MsgHea | |||||||
|                     ip_info IPInfo_Remote; |                     ip_info IPInfo_Remote; | ||||||
|                     if (((IPInfo_Remote.ip.addr = m_pUDPContext->getRemoteAddress())) && |                     if (((IPInfo_Remote.ip.addr = m_pUDPContext->getRemoteAddress())) && | ||||||
|                         (((wifi_get_ip_info(SOFTAP_IF, &IPInfo_Local)) && |                         (((wifi_get_ip_info(SOFTAP_IF, &IPInfo_Local)) && | ||||||
|                           (ip_addr_netcmp(&IPInfo_Remote.ip, &IPInfo_Local.ip, &IPInfo_Local.netmask))) ||  // Remote IP in SOFTAP's subnet OR |                           (ip4_addr_netcmp(&IPInfo_Remote.ip, &IPInfo_Local.ip, &IPInfo_Local.netmask))) ||  // Remote IP in SOFTAP's subnet OR | ||||||
|                          ((wifi_get_ip_info(STATION_IF, &IPInfo_Local)) && |                          ((wifi_get_ip_info(STATION_IF, &IPInfo_Local)) && | ||||||
|                           (ip_addr_netcmp(&IPInfo_Remote.ip, &IPInfo_Local.ip, &IPInfo_Local.netmask))))) { // Remote IP in STATION's subnet |                           (ip4_addr_netcmp(&IPInfo_Remote.ip, &IPInfo_Local.ip, &IPInfo_Local.netmask))))) { // Remote IP in STATION's subnet | ||||||
|  |  | ||||||
|                         DEBUG_EX_RX(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _parseQuery: Legacy query from local host %s!\n"), IPAddress(m_pUDPContext->getRemoteAddress()).toString().c_str());); |                         DEBUG_EX_RX(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _parseQuery: Legacy query from local host %s!\n"), IPAddress(m_pUDPContext->getRemoteAddress()).toString().c_str());); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -191,19 +191,18 @@ bool MDNSResponder::_allocUDPContext(void) { | |||||||
|      |      | ||||||
|     _releaseUDPContext(); |     _releaseUDPContext(); | ||||||
|  |  | ||||||
|     ip_addr_t   multicast_addr; |  | ||||||
| #ifdef MDNS_IP4_SUPPORT | #ifdef MDNS_IP4_SUPPORT | ||||||
|     multicast_addr.addr = DNS_MQUERY_IPV4_GROUP_INIT; |     ip_addr_t   multicast_addr = DNS_MQUERY_IPV4_GROUP_INIT; | ||||||
| #endif | #endif | ||||||
| #ifdef MDNS_IP6_SUPPORT | #ifdef MDNS_IP6_SUPPORT | ||||||
|     //TODO: set multicast address |     //TODO: set multicast address (lwip_joingroup() is IPv4 only at the time of writing) | ||||||
|     multicast_addr.addr = DNS_MQUERY_IPV6_GROUP_INIT; |     multicast_addr.addr = DNS_MQUERY_IPV6_GROUP_INIT; | ||||||
| #endif | #endif | ||||||
|     if (ERR_OK == igmp_joingroup(IP_ADDR_ANY, &multicast_addr)) { |     if (ERR_OK == igmp_joingroup(IP4_ADDR_ANY4, ip_2_ip4(&multicast_addr))) { | ||||||
|         m_pUDPContext = new UdpContext; |         m_pUDPContext = new UdpContext; | ||||||
|         m_pUDPContext->ref(); |         m_pUDPContext->ref(); | ||||||
|  |  | ||||||
|         if (m_pUDPContext->listen(IP_ADDR_ANY, DNS_MQUERY_PORT)) { |         if (m_pUDPContext->listen(IP4_ADDR_ANY, DNS_MQUERY_PORT)) { | ||||||
|             m_pUDPContext->setMulticastTTL(MDNS_MULTICAST_TTL); |             m_pUDPContext->setMulticastTTL(MDNS_MULTICAST_TTL); | ||||||
|             m_pUDPContext->onRx(std::bind(&MDNSResponder::_callProcess, this)); |             m_pUDPContext->onRx(std::bind(&MDNSResponder::_callProcess, this)); | ||||||
|              |              | ||||||
|   | |||||||
| @@ -79,10 +79,10 @@ bool MDNSResponder::_sendMDNSMessage(MDNSResponder::stcMDNSSendParameter& p_rSen | |||||||
|     if (p_rSendParameter.m_bResponse) { |     if (p_rSendParameter.m_bResponse) { | ||||||
|         if (p_rSendParameter.m_bUnicast) {  // Unicast response  -> Send to querier |         if (p_rSendParameter.m_bUnicast) {  // Unicast response  -> Send to querier | ||||||
|             DEBUG_EX_ERR(if (!m_pUDPContext->getRemoteAddress()) { DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _sendMDNSMessage: MISSING remote address for response!\n")); }); |             DEBUG_EX_ERR(if (!m_pUDPContext->getRemoteAddress()) { DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _sendMDNSMessage: MISSING remote address for response!\n")); }); | ||||||
|             ip_addr_t   ipRemote; |             IPAddress   ipRemote; | ||||||
|             ipRemote.addr = m_pUDPContext->getRemoteAddress(); |             ipRemote = m_pUDPContext->getRemoteAddress(); | ||||||
|             bResult = ((_prepareMDNSMessage(p_rSendParameter, _getResponseMulticastInterface(SOFTAP_MODE | STATION_MODE))) && |             bResult = ((_prepareMDNSMessage(p_rSendParameter, _getResponseMulticastInterface(SOFTAP_MODE | STATION_MODE))) && | ||||||
|                        (m_pUDPContext->send(&ipRemote, m_pUDPContext->getRemotePort()))); |                        (m_pUDPContext->send(ipRemote, m_pUDPContext->getRemotePort()))); | ||||||
|         } |         } | ||||||
|         else {                              // Multicast response -> Send via the same network interface, that received the query |         else {                              // Multicast response -> Send via the same network interface, that received the query | ||||||
|             bResult = _sendMDNSMessage_Multicast(p_rSendParameter, (SOFTAP_MODE | STATION_MODE)); |             bResult = _sendMDNSMessage_Multicast(p_rSendParameter, (SOFTAP_MODE | STATION_MODE)); | ||||||
| @@ -116,26 +116,20 @@ bool MDNSResponder::_sendMDNSMessage_Multicast(MDNSResponder::stcMDNSSendParamet | |||||||
|                                                int p_iWiFiOpMode) { |                                                int p_iWiFiOpMode) { | ||||||
|     bool    bResult = false; |     bool    bResult = false; | ||||||
|  |  | ||||||
|     ip_addr_t   ifFromAddress; |     IPAddress   fromIPAddress; | ||||||
|     ifFromAddress.addr = _getResponseMulticastInterface(p_iWiFiOpMode); |     fromIPAddress = _getResponseMulticastInterface(p_iWiFiOpMode); | ||||||
|     IPAddress   fromIPAddress(ifFromAddress.addr); |     m_pUDPContext->setMulticastInterface(fromIPAddress); | ||||||
| #if LWIP_VERSION_MAJOR == 1 |  | ||||||
|     m_pUDPContext->setMulticastInterface(ifFromAddress); |  | ||||||
| #else |  | ||||||
|     m_pUDPContext->setMulticastInterface(&ifFromAddress); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|     ip_addr_t   toMulticastAddress; |  | ||||||
| #ifdef MDNS_IP4_SUPPORT | #ifdef MDNS_IP4_SUPPORT | ||||||
|     toMulticastAddress.addr = DNS_MQUERY_IPV4_GROUP_INIT; |     IPAddress   toMulticastAddress(DNS_MQUERY_IPV4_GROUP_INIT); | ||||||
| #endif | #endif | ||||||
| #ifdef MDNS_IP6_SUPPORT | #ifdef MDNS_IP6_SUPPORT | ||||||
|     //TODO: set multicast address |     //TODO: set multicast address | ||||||
|     toMulticastAddress.addr = DNS_MQUERY_IPV6_GROUP_INIT; |     IPAddress   toMulticastAddress(DNS_MQUERY_IPV6_GROUP_INIT); | ||||||
| #endif | #endif | ||||||
|     DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _sendMDNSMessage_Multicast: Will send to '%s'.\n"), IPAddress(toMulticastAddress.addr).toString().c_str());); |     DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _sendMDNSMessage_Multicast: Will send to '%s'.\n"), toMulticastAddress.toString().c_str());); | ||||||
|     bResult = ((_prepareMDNSMessage(p_rSendParameter, fromIPAddress)) && |     bResult = ((_prepareMDNSMessage(p_rSendParameter, fromIPAddress)) && | ||||||
|                (m_pUDPContext->send(&toMulticastAddress, DNS_MQUERY_PORT))); |                (m_pUDPContext->send(toMulticastAddress, DNS_MQUERY_PORT))); | ||||||
|  |  | ||||||
|     DEBUG_EX_ERR(if (!bResult) { DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _sendMDNSMessage_Multicast: FAILED!\n")); }); |     DEBUG_EX_ERR(if (!bResult) { DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _sendMDNSMessage_Multicast: FAILED!\n")); }); | ||||||
|     return bResult; |     return bResult; | ||||||
| @@ -385,13 +379,13 @@ IPAddress MDNSResponder::_getResponseMulticastInterface(int p_iWiFiOpModes) cons | |||||||
|         (wifi_get_opmode() & SOFTAP_MODE)) { |         (wifi_get_opmode() & SOFTAP_MODE)) { | ||||||
|         //DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _getResponseMulticastInterface: SOFTAP_MODE\n"));); |         //DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _getResponseMulticastInterface: SOFTAP_MODE\n"));); | ||||||
|         // Get remote IP address |         // Get remote IP address | ||||||
|         ip_info IPInfo_Remote; |         IPAddress IP_Remote; | ||||||
|         IPInfo_Remote.ip.addr = m_pUDPContext->getRemoteAddress(); |         IP_Remote = m_pUDPContext->getRemoteAddress(); | ||||||
|         // Get local (AP) IP address |         // Get local (AP) IP address | ||||||
|         wifi_get_ip_info(SOFTAP_IF, &IPInfo_Local); |         wifi_get_ip_info(SOFTAP_IF, &IPInfo_Local); | ||||||
|          |          | ||||||
|         if ((IPInfo_Local.ip.addr) &&                                                       // Has local AP IP address AND |         if ((IPInfo_Local.ip.addr) &&                                                       // Has local AP IP address AND | ||||||
|             (ip_addr_netcmp(&IPInfo_Remote.ip, &IPInfo_Local.ip, &IPInfo_Local.netmask))) { // Remote address is in the same subnet as the AP |             (ip4_addr_netcmp(ip_2_ip4((const ip_addr_t*)IP_Remote), &IPInfo_Local.ip, &IPInfo_Local.netmask))) { // Remote address is in the same subnet as the AP | ||||||
|             bFoundMatch = true; |             bFoundMatch = true; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -402,8 +396,8 @@ IPAddress MDNSResponder::_getResponseMulticastInterface(int p_iWiFiOpModes) cons | |||||||
|         // Get local (STATION) IP address |         // Get local (STATION) IP address | ||||||
|         wifi_get_ip_info(STATION_IF, &IPInfo_Local); |         wifi_get_ip_info(STATION_IF, &IPInfo_Local); | ||||||
|     } |     } | ||||||
|     //DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _getResponseMulticastInterface(%i): %s\n"), p_iWiFiOpModes, IPAddress(IPInfo_Local.ip.addr).toString().c_str());); |     //DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _getResponseMulticastInterface(%i): %s\n"), p_iWiFiOpModes, IPAddress(IPInfo_Local.ip).toString().c_str());); | ||||||
|     return IPAddress(IPInfo_Local.ip.addr); |     return IPAddress(IPInfo_Local.ip); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -41,8 +41,9 @@ function build_sketches() | |||||||
|     local build_dir=build.tmp |     local build_dir=build.tmp | ||||||
|     local build_mod=$4 |     local build_mod=$4 | ||||||
|     local build_rem=$5 |     local build_rem=$5 | ||||||
|  |     local lwip=$6 | ||||||
|     mkdir -p $build_dir |     mkdir -p $build_dir | ||||||
|     local build_cmd="python tools/build.py -b generic -v -w all -s 4M1M -v -k -p $PWD/$build_dir $build_arg " |     local build_cmd="python tools/build.py -b generic -v -w all -s 4M1M -v -k -p $PWD/$build_dir -n $lwip $build_arg " | ||||||
|     local sketches=$(find $srcpath -name *.ino | sort) |     local sketches=$(find $srcpath -name *.ino | sort) | ||||||
|     print_size_info >size.log |     print_size_info >size.log | ||||||
|     export ARDUINO_IDE_PATH=$arduino |     export ARDUINO_IDE_PATH=$arduino | ||||||
| @@ -116,8 +117,8 @@ function install_ide() | |||||||
|         debug_flags="-DDEBUG_ESP_PORT=Serial -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM" |         debug_flags="-DDEBUG_ESP_PORT=Serial -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM" | ||||||
|     fi |     fi | ||||||
|     # Set custom warnings for all builds (i.e. could add -Wextra at some point) |     # Set custom warnings for all builds (i.e. could add -Wextra at some point) | ||||||
|     echo "compiler.c.extra_flags=-Wall -Wextra -Werror -DLWIP_IPV6=0 $debug_flags" > esp8266/platform.local.txt |     echo "compiler.c.extra_flags=-Wall -Wextra -Werror $debug_flags" > esp8266/platform.local.txt | ||||||
|     echo "compiler.cpp.extra_flags=-Wall -Wextra -Werror -DLWIP_IPV6=0 $debug_flags" >> esp8266/platform.local.txt |     echo "compiler.cpp.extra_flags=-Wall -Wextra -Werror $debug_flags" >> esp8266/platform.local.txt | ||||||
|     echo -e "\n----platform.local.txt----" |     echo -e "\n----platform.local.txt----" | ||||||
|     cat esp8266/platform.local.txt |     cat esp8266/platform.local.txt | ||||||
|     echo -e "\n----\n" |     echo -e "\n----\n" | ||||||
| @@ -196,10 +197,11 @@ function build_sketches_with_arduino() | |||||||
| { | { | ||||||
|     local build_mod=$1 |     local build_mod=$1 | ||||||
|     local build_rem=$2 |     local build_rem=$2 | ||||||
|  |     local lwip=$3 | ||||||
|  |  | ||||||
|     # Compile sketches |     # Compile sketches | ||||||
|     echo -e "travis_fold:start:sketch_test" |     echo -e "travis_fold:start:sketch_test" | ||||||
|     build_sketches $HOME/arduino_ide $TRAVIS_BUILD_DIR/libraries "-l $HOME/Arduino/libraries" $1 $2 |     build_sketches $HOME/arduino_ide $TRAVIS_BUILD_DIR/libraries "-l $HOME/Arduino/libraries" $build_mod $build_rem $lwip | ||||||
|     echo -e "travis_fold:end:sketch_test" |     echo -e "travis_fold:end:sketch_test" | ||||||
|  |  | ||||||
|     # Generate size report |     # Generate size report | ||||||
| @@ -221,19 +223,28 @@ fi | |||||||
|  |  | ||||||
| if [ "$BUILD_TYPE" = "build" ]; then | if [ "$BUILD_TYPE" = "build" ]; then | ||||||
|     install_arduino nodebug |     install_arduino nodebug | ||||||
|     build_sketches_with_arduino 1 0 |     build_sketches_with_arduino 1 0 lm2f | ||||||
|  | elif [ "$BUILD_TYPE" = "build6" ]; then | ||||||
|  |     install_arduino nodebug | ||||||
|  |     build_sketches_with_arduino 1 0 lm6f | ||||||
| elif [ "$BUILD_TYPE" = "build_even" ]; then | elif [ "$BUILD_TYPE" = "build_even" ]; then | ||||||
|     install_arduino nodebug |     install_arduino nodebug | ||||||
|     build_sketches_with_arduino 2 0 |     build_sketches_with_arduino 2 0 lm2f | ||||||
| elif [ "$BUILD_TYPE" = "build_odd" ]; then | elif [ "$BUILD_TYPE" = "build_odd" ]; then | ||||||
|     install_arduino nodebug |     install_arduino nodebug | ||||||
|     build_sketches_with_arduino 2 1 |     build_sketches_with_arduino 2 1 lm2f | ||||||
| elif [ "$BUILD_TYPE" = "debug_even" ]; then | elif [ "$BUILD_TYPE" = "debug_even" ]; then | ||||||
|     install_arduino debug |     install_arduino debug | ||||||
|     build_sketches_with_arduino 2 0 |     build_sketches_with_arduino 2 0 lm2f | ||||||
| elif [ "$BUILD_TYPE" = "debug_odd" ]; then | elif [ "$BUILD_TYPE" = "debug_odd" ]; then | ||||||
|     install_arduino debug |     install_arduino debug | ||||||
|     build_sketches_with_arduino 2 1 |     build_sketches_with_arduino 2 1 lm2f | ||||||
|  | elif [ "$BUILD_TYPE" = "build6_even" ]; then | ||||||
|  |     install_arduino nodebug | ||||||
|  |     build_sketches_with_arduino 2 0 lm6f | ||||||
|  | elif [ "$BUILD_TYPE" = "build6_odd" ]; then | ||||||
|  |     install_arduino nodebug | ||||||
|  |     build_sketches_with_arduino 2 1 lm6f | ||||||
| elif [ "$BUILD_TYPE" = "platformio" ]; then | elif [ "$BUILD_TYPE" = "platformio" ]; then | ||||||
|     # PlatformIO |     # PlatformIO | ||||||
|     install_platformio |     install_platformio | ||||||
|   | |||||||
| @@ -53,12 +53,13 @@ while true; do | |||||||
| 	cat << EOF | 	cat << EOF | ||||||
| Which build? | Which build? | ||||||
| 1. main | 1. main | ||||||
| 2. debug even | 2. main + IPv6 | ||||||
| 3. debug odd | 3. debug even | ||||||
| 4. platformio | 4. debug odd | ||||||
| 5. package | 5. platformio | ||||||
| 6. host | 6. package | ||||||
| 7. style | 7. host | ||||||
|  | 8. style | ||||||
| EOF | EOF | ||||||
|  |  | ||||||
| 	read ans | 	read ans | ||||||
| @@ -66,12 +67,13 @@ EOF | |||||||
| 	BUILD_TYPE="" | 	BUILD_TYPE="" | ||||||
| 	case "$ans" in | 	case "$ans" in | ||||||
| 		1) BUILD_TYPE=build;; | 		1) BUILD_TYPE=build;; | ||||||
| 		2) BUILD_TYPE=debug_even;; | 		2) BUILD_TYPE=build6;; | ||||||
| 		3) BUILD_TYPE=debug_odd;; | 		3) BUILD_TYPE=debug_even;; | ||||||
| 		4) BUILD_TYPE=platformio;; | 		4) BUILD_TYPE=debug_odd;; | ||||||
| 		5) BUILD_TYPE=package;; | 		5) BUILD_TYPE=platformio;; | ||||||
| 		6) BUILD_TYPE=host;; | 		6) BUILD_TYPE=package;; | ||||||
| 		7) BUILD_TYPE=style;; | 		7) BUILD_TYPE=host;; | ||||||
|  | 		8) BUILD_TYPE=style;; | ||||||
| 	esac | 	esac | ||||||
| 	test -z "$BUILD_TYPE" || break | 	test -z "$BUILD_TYPE" || break | ||||||
| done | done | ||||||
|   | |||||||
| @@ -50,6 +50,7 @@ def compile(tmp_dir, sketch, tools_dir, hardware_dir, ide_path, f, args): | |||||||
|             'FlashMode={flash_mode},' \ |             'FlashMode={flash_mode},' \ | ||||||
|             'baud=921600,' \ |             'baud=921600,' \ | ||||||
|             'eesz={flash_size},' \ |             'eesz={flash_size},' \ | ||||||
|  |             'ip={lwIP},' \ | ||||||
|             'ResetMethod=nodemcu'.format(**vars(args)) |             'ResetMethod=nodemcu'.format(**vars(args)) | ||||||
|     if args.debug_port and args.debug_level: |     if args.debug_port and args.debug_level: | ||||||
|         cmd += 'dbg={debug_port},lvl={debug_level}'.format(**vars(args)) |         cmd += 'dbg={debug_port},lvl={debug_level}'.format(**vars(args)) | ||||||
| @@ -85,6 +86,8 @@ def parse_args(): | |||||||
|                         choices=[80, 160], type=int) |                         choices=[80, 160], type=int) | ||||||
|     parser.add_argument('-m', '--flash_mode', help='Flash mode', default='qio', |     parser.add_argument('-m', '--flash_mode', help='Flash mode', default='qio', | ||||||
|                         choices=['dio', 'qio']) |                         choices=['dio', 'qio']) | ||||||
|  |     parser.add_argument('-n', '--lwIP', help='lwIP version', default='lm2f', | ||||||
|  |                         choices=['lm2f', 'hb2f', 'lm6f', 'hb6f', 'hb1']) | ||||||
|     parser.add_argument('-w', '--warnings', help='Compilation warnings level', |     parser.add_argument('-w', '--warnings', help='Compilation warnings level', | ||||||
|                         default='none', choices=['none', 'all', 'more']) |                         default='none', choices=['none', 'all', 'more']) | ||||||
|     parser.add_argument('-o', '--output_binary', help='File name for output binary') |     parser.add_argument('-o', '--output_binary', help='File name for output binary') | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user