From 58b411a5fe5345b3f3ad1d2d4c20d909b0ffbfa1 Mon Sep 17 00:00:00 2001 From: Tom Vijlbrief Date: Mon, 9 Oct 2017 15:11:14 +0200 Subject: [PATCH 1/8] fix makefile for multiple source files --- components/ulp/component_ulp_common.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/ulp/component_ulp_common.mk b/components/ulp/component_ulp_common.mk index 8824a6dd0..70e5b0205 100644 --- a/components/ulp/component_ulp_common.mk +++ b/components/ulp/component_ulp_common.mk @@ -43,7 +43,7 @@ $(ULP_LD_SCRIPT): $(ULP_LD_TEMPLATE) # Link object files and generate map file $(ULP_ELF): $(ULP_OBJECTS) $(ULP_LD_SCRIPT) $(summary) ULP_LD $(patsubst $(PWD)/%,%,$(CURDIR))/$@ - $(ULP_LD) -o $@ -A elf32-esp32ulp -Map=$(ULP_MAP) -T $(ULP_LD_SCRIPT) $< + $(ULP_LD) -o $@ -A elf32-esp32ulp -Map=$(ULP_MAP) -T $(ULP_LD_SCRIPT) $(ULP_OBJECTS) # Dump the list of global symbols in a convenient format. $(ULP_SYM): $(ULP_ELF) From a0cedb1f442f79e1c87a37c2653226abdd293756 Mon Sep 17 00:00:00 2001 From: Dmitry4Bh Date: Wed, 11 Oct 2017 14:02:06 +0300 Subject: [PATCH 2/8] Fix type conversion error in components/lwip/api/pppapi.c Pointer tcpip_api_call *m should be converted to pppapi_msg* instead of pppapi_msg_msg* in pppapi_do_ppp_set_default(), pppapi_do_ppp_free() and so on. It solve this issue https://github.com/espressif/esp-idf/pull/1028 so there is no need to patch ip4.c because now netif_defauilt is setted correctly. Also it prevents memory corruption when pppapi_free() is called. --- components/lwip/api/pppapi.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/components/lwip/api/pppapi.c b/components/lwip/api/pppapi.c index 2212233ce..735ae76e4 100755 --- a/components/lwip/api/pppapi.c +++ b/components/lwip/api/pppapi.c @@ -48,9 +48,9 @@ static err_t pppapi_do_ppp_set_default(struct tcpip_api_call *m) { - struct pppapi_msg_msg *msg = (struct pppapi_msg_msg *)m; + struct pppapi_msg *msg = (struct pppapi_msg *)m; - ppp_set_default(msg->ppp); + ppp_set_default(msg->msg.ppp); return ERR_OK; } @@ -103,8 +103,8 @@ pppapi_set_auth(ppp_pcb *pcb, u8_t authtype, const char *user, const char *passw static err_t pppapi_do_ppp_set_notify_phase_callback(struct tcpip_api_call *m) { - struct pppapi_msg_msg *msg = (struct pppapi_msg_msg *)m; - ppp_set_notify_phase_callback(msg->ppp, msg->msg.setnotifyphasecb.notify_phase_cb); + struct pppapi_msg *msg = (struct pppapi_msg *)m; + ppp_set_notify_phase_callback(msg->msg.ppp, msg->msg.msg.setnotifyphasecb.notify_phase_cb); return ERR_OK; } @@ -164,11 +164,11 @@ pppapi_pppos_create(struct netif *pppif, pppos_output_cb_fn output_cb, static err_t pppapi_do_pppoe_create(struct tcpip_api_call *m) { - struct pppapi_msg_msg *msg = (struct pppapi_msg_msg *)m; + struct pppapi_msg *msg = (struct pppapi_msg *)m; - msg->ppp = pppoe_create(msg->msg.ethernetcreate.pppif, msg->msg.ethernetcreate.ethif, - msg->msg.ethernetcreate.service_name, msg->msg.ethernetcreate.concentrator_name, - msg->msg.ethernetcreate.link_status_cb, msg->msg.ethernetcreate.ctx_cb); + msg->msg.ppp = pppoe_create(msg->msg.msg.ethernetcreate.pppif, msg->msg.msg.ethernetcreate.ethif, + msg->msg.msg.ethernetcreate.service_name, msg->msg.msg.ethernetcreate.concentrator_name, + msg->msg.msg.ethernetcreate.link_status_cb, msg->msg.msg.ethernetcreate.ctx_cb); return ERR_OK; } @@ -201,17 +201,17 @@ pppapi_pppoe_create(struct netif *pppif, struct netif *ethif, const char *servic static err_t pppapi_do_pppol2tp_create(struct tcpip_api_call *m) { - struct pppapi_msg_msg *msg = (struct pppapi_msg_msg *)m; + struct pppapi_msg *msg = (struct pppapi_msg *)m; - msg->ppp = pppol2tp_create(msg->msg.l2tpcreate.pppif, - msg->msg.l2tpcreate.netif, msg->msg.l2tpcreate.ipaddr, msg->msg.l2tpcreate.port, + msg->msg.ppp = pppol2tp_create(msg->msg.msg.l2tpcreate.pppif, + msg->msg.msg.l2tpcreate.netif, msg->msg.msg.l2tpcreate.ipaddr, msg->msg.msg.l2tpcreate.port, #if PPPOL2TP_AUTH_SUPPORT - msg->msg.l2tpcreate.secret, - msg->msg.l2tpcreate.secret_len, + msg->msg.msg.l2tpcreate.secret, + msg->msg.msg.l2tpcreate.secret_len, #else /* PPPOL2TP_AUTH_SUPPORT */ NULL, #endif /* PPPOL2TP_AUTH_SUPPORT */ - msg->msg.l2tpcreate.link_status_cb, msg->msg.l2tpcreate.ctx_cb); + msg->msg.msg.l2tpcreate.link_status_cb, msg->msg.msg.l2tpcreate.ctx_cb); return ERR_OK; } @@ -325,9 +325,9 @@ pppapi_close(ppp_pcb *pcb, u8_t nocarrier) static err_t pppapi_do_ppp_free(struct tcpip_api_call *m) { - struct pppapi_msg_msg *msg = (struct pppapi_msg_msg *)m; + struct pppapi_msg *msg = (struct pppapi_msg *)m; - return ppp_free(msg->ppp); + return ppp_free(msg->msg.ppp); } /** From 8712fd3ccfd6edde17305b1c8ff51b8d3ecc11d0 Mon Sep 17 00:00:00 2001 From: jeanleflambeur Date: Thu, 12 Oct 2017 09:53:09 +0200 Subject: [PATCH 3/8] Update esp_err.h Renamed the internal rc to __err_rc to avoid clashes with local variables. This code would not do the expected thing with the original ESP_ERROR_CHECK macro: esp_err_t my_func(esp_err_t x) { assert(x == 23); } esp_err_t rc = 23; //some value that is important fo the user ESP_ERROR_CHECK(my_func(rc)); The macro will expand to: esp_err_t rc = (my_func(rc)); And the code will assert, as my_func will receive a random value - whatever is in the internal macro rc temp variable. This is due to the C weirdness of allowing this code: int x = x; //x has a random value. --- components/esp32/include/esp_err.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/esp32/include/esp_err.h b/components/esp32/include/esp_err.h index cf0973c56..5486b1410 100644 --- a/components/esp32/include/esp_err.h +++ b/components/esp32/include/esp_err.h @@ -64,14 +64,14 @@ void _esp_error_check_failed(esp_err_t rc, const char *file, int line, const cha */ #ifdef NDEBUG #define ESP_ERROR_CHECK(x) do { \ - esp_err_t rc = (x); \ - (void) sizeof(rc); \ + esp_err_t __err_rc = (x); \ + (void) sizeof(__err_rc); \ } while(0); #else #define ESP_ERROR_CHECK(x) do { \ - esp_err_t rc = (x); \ - if (rc != ESP_OK) { \ - _esp_error_check_failed(rc, __FILE__, __LINE__, \ + esp_err_t __err_rc = (x); \ + if (__err_rc != ESP_OK) { \ + _esp_error_check_failed(__err_rc, __FILE__, __LINE__, \ __ASSERT_FUNC, #x); \ } \ } while(0); From 5827fd8c715990a21088d1c6e7a9fe517f908486 Mon Sep 17 00:00:00 2001 From: Krzysztof Bociurko Date: Fri, 20 Oct 2017 11:55:18 +0200 Subject: [PATCH 4/8] idf_monitor: Fixed a bug where pressing a key that doesn't encode into a proper ASCII character, terminated the monitor with an exception --- tools/idf_monitor.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/idf_monitor.py b/tools/idf_monitor.py index 1f315f29e..e4a5ec4bd 100755 --- a/tools/idf_monitor.py +++ b/tools/idf_monitor.py @@ -292,6 +292,8 @@ class Monitor(object): self.serial.write(codecs.encode(key)) except serial.SerialException: pass # this shouldn't happen, but sometimes port has closed in serial thread + except UnicodeEncodeError: + pass # this can happen if a non-ascii character was passed, ignoring def handle_serial_input(self, data): # this may need to be made more efficient, as it pushes out a byte From 6e24566186c52dc5432b6b25c81abda577c21e85 Mon Sep 17 00:00:00 2001 From: Siarhei Volkau Date: Fri, 27 Oct 2017 10:22:01 +0300 Subject: [PATCH 5/8] components/mdns: wrong Message compression detect Old behavior assumes message compressed when any of 2 most significant bits are set, But in fact Message compressed only when both those bits are set to 1. Also maximal label length should be 63 bytes. --- components/mdns/mdns.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/mdns/mdns.c b/components/mdns/mdns.c index 40b4c7096..c77283e07 100644 --- a/components/mdns/mdns.c +++ b/components/mdns/mdns.c @@ -555,9 +555,9 @@ static const uint8_t * _mdns_read_fqdn(const uint8_t * packet, const uint8_t * s return NULL; } uint8_t len = start[index++]; - if ((len & 0xC0) == 0) { - if (len > 64) { - //length can not be more than 64 + if (len < 0xC0) { + if (len > 63) { + //length can not be more than 63 return NULL; } uint8_t i; From d72bef02e954d9cf4ae28e4eb4518c352f27893c Mon Sep 17 00:00:00 2001 From: Philip Ashmore Date: Thu, 2 Nov 2017 19:47:46 +0000 Subject: [PATCH 6/8] Added .command_timeout_ms = 0 to SDMMC_HOST_DEFAULT() in components/driver/include/driver/sdmmc_host.h --- components/driver/include/driver/sdmmc_host.h | 1 + 1 file changed, 1 insertion(+) diff --git a/components/driver/include/driver/sdmmc_host.h b/components/driver/include/driver/sdmmc_host.h index f2e2d66d5..63023e903 100644 --- a/components/driver/include/driver/sdmmc_host.h +++ b/components/driver/include/driver/sdmmc_host.h @@ -42,6 +42,7 @@ extern "C" { .set_card_clk = &sdmmc_host_set_card_clk, \ .do_transaction = &sdmmc_host_do_transaction, \ .deinit = &sdmmc_host_deinit, \ + .command_timeout_ms = 0, \ } /** From 20ccec10619e7f2993f4fed9cdd853ec6088216c Mon Sep 17 00:00:00 2001 From: Frederik Merz Date: Fri, 3 Nov 2017 11:01:32 +0100 Subject: [PATCH 7/8] Disable all UART CLKs that are not console --- components/esp32/clk.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/components/esp32/clk.c b/components/esp32/clk.c index 34b36b9bb..15b8af36c 100644 --- a/components/esp32/clk.c +++ b/components/esp32/clk.c @@ -186,7 +186,15 @@ void esp_perip_clk_init(void) else { common_perip_clk = DPORT_WDG_CLK_EN | DPORT_I2S0_CLK_EN | +#if CONFIG_CONSOLE_UART_NUM != 0 + DPORT_UART0_CLK_EN | +#endif +#if CONFIG_CONSOLE_UART_NUM != 1 DPORT_UART1_CLK_EN | +#endif +#if CONFIG_CONSOLE_UART_NUM != 2 + DPORT_UART2_CLK_EN | +#endif DPORT_SPI_CLK_EN | DPORT_I2C_EXT0_CLK_EN | DPORT_UHCI0_CLK_EN | @@ -205,7 +213,6 @@ void esp_perip_clk_init(void) DPORT_PWM1_CLK_EN | DPORT_I2S1_CLK_EN | DPORT_SPI_DMA_CLK_EN | - DPORT_UART2_CLK_EN | DPORT_PWM2_CLK_EN | DPORT_PWM3_CLK_EN; hwcrypto_perip_clk = DPORT_PERI_EN_AES | From 27c1fc52baaa1edb2be337b514ceb18ae4353f36 Mon Sep 17 00:00:00 2001 From: Anton Maklakov Date: Wed, 8 Nov 2017 12:52:25 +0800 Subject: [PATCH 8/8] Added .command_timeout_ms = 0 to SDSPI_HOST_DEFAULT() too --- components/driver/include/driver/sdspi_host.h | 1 + 1 file changed, 1 insertion(+) diff --git a/components/driver/include/driver/sdspi_host.h b/components/driver/include/driver/sdspi_host.h index 72bd9f382..54eba081e 100644 --- a/components/driver/include/driver/sdspi_host.h +++ b/components/driver/include/driver/sdspi_host.h @@ -43,6 +43,7 @@ extern "C" { .set_card_clk = &sdspi_host_set_card_clk, \ .do_transaction = &sdspi_host_do_transaction, \ .deinit = &sdspi_host_deinit, \ + .command_timeout_ms = 0, \ } /**