From bf82b441ae8d598ebea01be24a90760f58d8f58e Mon Sep 17 00:00:00 2001 From: Jonathan Kaufmann Date: Wed, 12 Apr 2017 18:23:32 -0500 Subject: [PATCH 1/5] Fixed bug in ledc_set_fade_with_step where returned while holding critical section. Merges PR #515 https://github.com/espressif/esp-idf/pull/515 --- components/driver/ledc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/components/driver/ledc.c b/components/driver/ledc.c index 7da353869f..239f8f3311 100644 --- a/components/driver/ledc.c +++ b/components/driver/ledc.c @@ -541,6 +541,7 @@ esp_err_t ledc_set_fade_with_step(ledc_mode_t speed_mode, ledc_channel_t channel int duty_cur = LEDC.channel_group[speed_mode].channel[channel].duty_rd.duty_read >> LEDC_DUTY_DECIMAL_BIT_NUM; int duty_delta = target_duty > duty_cur ? target_duty - duty_cur : duty_cur - target_duty; if (duty_delta == 0) { + portEXIT_CRITICAL(&ledc_spinlock); return ESP_OK; } s_ledc_fade_rec[speed_mode][channel]->speed_mode = speed_mode; From eeb0aaa09e4e99bc12ffa17f5bf891d03d0b295c Mon Sep 17 00:00:00 2001 From: Michael Kellner Date: Thu, 13 Apr 2017 11:11:13 -0700 Subject: [PATCH 2/5] spidriver: Display length errors correctly SPI transfer length is bits, not bytes, so the error should indicate bits. Also, there are separate lengths for rx and tx (confusingly named rxlength and length... if rxlength is 0, length is used). The code checks the tx length for the rx, so it never validates rxlength. Originally contributed as part of #511 https://github.com/espressif/esp-idf/pull/511 --- components/driver/spi_master.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/driver/spi_master.c b/components/driver/spi_master.c index 723fbdb035..e828ea9f1d 100644 --- a/components/driver/spi_master.c +++ b/components/driver/spi_master.c @@ -698,8 +698,8 @@ esp_err_t spi_device_queue_trans(spi_device_handle_t handle, spi_transaction_t * { BaseType_t r; SPI_CHECK(handle!=NULL, "invalid dev handle", ESP_ERR_INVALID_ARG); - SPI_CHECK((trans_desc->flags & SPI_TRANS_USE_RXDATA)==0 ||trans_desc->length <= 32, "rxdata transfer > 32bytes", ESP_ERR_INVALID_ARG); - SPI_CHECK((trans_desc->flags & SPI_TRANS_USE_TXDATA)==0 ||trans_desc->length <= 32, "txdata transfer > 32bytes", ESP_ERR_INVALID_ARG); + SPI_CHECK((trans_desc->flags & SPI_TRANS_USE_RXDATA)==0 ||trans_desc->rxlength <= 32, "rxdata transfer > 32 bits", ESP_ERR_INVALID_ARG); + SPI_CHECK((trans_desc->flags & SPI_TRANS_USE_TXDATA)==0 ||trans_desc->length <= 32, "txdata transfer > 32 bits", ESP_ERR_INVALID_ARG); SPI_CHECK(!((trans_desc->flags & (SPI_TRANS_MODE_DIO|SPI_TRANS_MODE_QIO)) && (handle->cfg.flags & SPI_DEVICE_3WIRE)), "incompatible iface params", ESP_ERR_INVALID_ARG); SPI_CHECK(!((trans_desc->flags & (SPI_TRANS_MODE_DIO|SPI_TRANS_MODE_QIO)) && (!(handle->cfg.flags & SPI_DEVICE_HALFDUPLEX))), "incompatible iface params", ESP_ERR_INVALID_ARG); r=xQueueSend(handle->trans_queue, (void*)&trans_desc, ticks_to_wait); From e5012bd07e52d5fb9f4456a7f149d1c43561e774 Mon Sep 17 00:00:00 2001 From: "rudi ;-)" Date: Mon, 10 Apr 2017 05:07:12 +0200 Subject: [PATCH 3/5] OTA example readme: [typo]: Worflow to Workflow Merges PR #507 https://github.com/espressif/esp-idf/pull/507 --- examples/system/ota/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/system/ota/README.md b/examples/system/ota/README.md index 886dbf5fbb..2b0e0202b0 100644 --- a/examples/system/ota/README.md +++ b/examples/system/ota/README.md @@ -16,7 +16,7 @@ In this example, the ESP32 has 3 images in flash: factory, OTA_0, OTA_1. Each of Flashing the example over serial with "make flash" updates the factory app image. On first boot, the bootloader loads this factory app image which then performs an OTA update (triggered in the example code). The update downloads a new image from an http server and saves it into the OTA_0 partition. At this point the example code updates the ota_data partition to indicate the new app partition, and resets. The bootloader reads ota_data, determines the new OTA image has been selected, and runs it. -# Worflow +# Workflow The OTA_workflow.png diagram demonstrates the overall workflow: From cdc7396f97ccc7209019b0a3cde7c8420f0a0f4b Mon Sep 17 00:00:00 2001 From: Eyob Date: Sat, 8 Apr 2017 18:18:16 -0400 Subject: [PATCH 4/5] Make sure LD -L option is calculated correctly when the project Makefile has specified SRCDIRS components that are not directly below Makefile folder level. For example, SRCDIRS = comp_a happy/comp_b /c/dev/comp_c Then the following are built: build/comp_a/libcomp_a.a build/comp_b/libcomp_b.a build/comp_c/libcomp_c.a But when LD is run the -L is calculated as follows -L build/comp_a -L build/happy/comp_b -L build//c/dev/comp_c This means comp_b and comp_c are not found by LD. With this change set -L is calculated correctly for comp_b and comp_c Merges #504 https://github.com/espressif/esp-idf/pull/504 --- make/project.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/make/project.mk b/make/project.mk index fd85ef4e55..1c868ad307 100644 --- a/make/project.mk +++ b/make/project.mk @@ -189,9 +189,9 @@ endif IDF_VER := $(shell cd ${IDF_PATH} && git describe --always --tags --dirty) # Set default LDFLAGS - +SRCDIRS_COMPONENT_NAMES := $(sort $(foreach comp,$(SRCDIRS),$(lastword $(subst /, ,$(comp))))) LDFLAGS ?= -nostdlib \ - $(addprefix -L$(BUILD_DIR_BASE)/,$(COMPONENTS) $(TEST_COMPONENT_NAMES) $(SRCDIRS) ) \ + $(addprefix -L$(BUILD_DIR_BASE)/,$(COMPONENTS) $(TEST_COMPONENT_NAMES) $(SRCDIRS_COMPONENT_NAMES) ) \ -u call_user_start_cpu0 \ $(EXTRA_LDFLAGS) \ -Wl,--gc-sections \ From 52c378b447220eab0713e35bfaf33fa5b48c97c0 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Fri, 21 Apr 2017 11:31:40 +1000 Subject: [PATCH 5/5] bluedroid: Fix compilation warnings related to aliasing Merges PR #518 https://github.com/espressif/esp-idf/pull/518 --- .../bt/bluedroid/btc/profile/esp/blufi/blufi_prf.c | 12 +++++++----- components/bt/bluedroid/stack/btu/btu_task.c | 5 ++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/components/bt/bluedroid/btc/profile/esp/blufi/blufi_prf.c b/components/bt/bluedroid/btc/profile/esp/blufi/blufi_prf.c index 7379192577..800f8d8d75 100644 --- a/components/bt/bluedroid/btc/profile/esp/blufi/blufi_prf.c +++ b/components/bt/bluedroid/btc/profile/esp/blufi/blufi_prf.c @@ -345,7 +345,7 @@ static void btc_blufi_send_notify(uint8_t *pkt, int pkt_len) static void btc_blufi_recv_handler(uint8_t *data, int len) { struct blufi_hdr *hdr = (struct blufi_hdr *)data; - uint16_t checksum; + uint16_t checksum, checksum_pkt; int ret; if (hdr->seq != blufi_env.recv_seq) { @@ -369,8 +369,9 @@ static void btc_blufi_recv_handler(uint8_t *data, int len) if (BLUFI_FC_IS_CHECK(hdr->fc) && (blufi_env.cbs && blufi_env.cbs->checksum_func)) { checksum = blufi_env.cbs->checksum_func(hdr->seq, &hdr->seq, hdr->data_len + 2); - if (memcmp(&checksum, &hdr->data[hdr->data_len], 2) != 0) { - LOG_ERROR("%s checksum error %04x, pkt %04x\n", __func__, checksum, *(uint16_t *)&hdr->data[hdr->data_len]); + checksum_pkt = hdr->data[hdr->data_len] | (((uint16_t) hdr->data[hdr->data_len + 1]) << 8); + if (checksum != checksum_pkt) { + LOG_ERROR("%s checksum error %04x, pkt %04x\n", __func__, checksum, checksum_pkt); return; } } @@ -381,7 +382,7 @@ static void btc_blufi_recv_handler(uint8_t *data, int len) if (BLUFI_FC_IS_FRAG(hdr->fc)) { if (blufi_env.offset == 0) { - blufi_env.total_len = *(uint16_t *)(hdr->data); + blufi_env.total_len = hdr->data[0] | (((uint16_t) hdr->data[1]) << 8); blufi_env.aggr_buf = GKI_getbuf(blufi_env.total_len); if (blufi_env.aggr_buf == NULL) { LOG_ERROR("%s no mem, len %d\n", __func__, blufi_env.total_len); @@ -420,7 +421,8 @@ void btc_blufi_send_encap(uint8_t type, uint8_t *data, int total_data_len) } hdr->fc = 0x0; hdr->data_len = blufi_env.frag_size + 2; - *(uint16_t *)hdr->data = remain_len; + hdr->data[0] = remain_len & 0xff; + hdr->data[1] = (remain_len >> 8) & 0xff; memcpy(hdr->data + 2, &data[total_data_len - remain_len], blufi_env.frag_size); //copy first, easy for check sum hdr->fc |= BLUFI_FC_FRAG; } else { diff --git a/components/bt/bluedroid/stack/btu/btu_task.c b/components/bt/bluedroid/stack/btu/btu_task.c index 4c640fad7c..feaa50faf8 100644 --- a/components/bt/bluedroid/stack/btu/btu_task.c +++ b/components/bt/bluedroid/stack/btu/btu_task.c @@ -223,8 +223,11 @@ static void btu_hci_msg_process(BT_HDR *p_msg) /* Determine the input message type. */ switch (p_msg->event & BT_EVT_MASK) { case BTU_POST_TO_TASK_NO_GOOD_HORRIBLE_HACK: // TODO(zachoverflow): remove this - ((post_to_task_hack_t *)(&p_msg->data[0]))->callback(p_msg); + { + post_to_task_hack_t *ph = (post_to_task_hack_t *) &p_msg->data[0]; + ph->callback(p_msg); break; + } case BT_EVT_TO_BTU_HCI_ACL: /* All Acl Data goes to L2CAP */ l2c_rcv_acl_data (p_msg);