From: Ivan Grokhotkov Date: Thu, 19 Jan 2017 02:14:34 +0000 (+0800) Subject: Merge branch 'bugfix/flash_op_unpinned_task' into 'master' X-Git-Tag: v2.0-rc1~15 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7c155ab;p=esp-idf Merge branch 'bugfix/flash_op_unpinned_task' into 'master' fixes for issues observed when using spi_flash This MR fixes three unrelated issues: - Race condition in spi_flash_enable_interrupts_caches_and_other_cpu when operations on unpinned tasks are performed. The issue is reported in https://github.com/espressif/esp-idf/pull/258 - esp_intr_noniram_disable doesn’t disable interrupts when compiled in release mode. This issue manifested itself with an illegal instruction exception when task WDT ISR was called at the time when flash was disabled. Fixes https://github.com/espressif/esp-idf/issues/263. - Tick hooks on CPU1 were not called if CPU0 scheduler was disabled for significant amount of time (which could happen when doing flash erase). The issue manifested itself as “INT WDT timeout on core 1” error. Fixes https://github.com/espressif/esp-idf/issues/219. See merge request !441 --- 7c155ab647cc998334549d75276287c9fba2e1a7 diff --cc components/spi_flash/test/test_spi_flash.c index bf05b64db4,4f3171049e..ecc472ac0e --- a/components/spi_flash/test/test_spi_flash.c +++ b/components/spi_flash/test/test_spi_flash.c @@@ -62,31 -61,25 +61,25 @@@ static void flash_test_task(void *arg vTaskDelete(NULL); } -TEST_CASE("flash write and erase work both on PRO CPU and on APP CPU", "[spi_flash]") +TEST_CASE("flash write and erase work both on PRO CPU and on APP CPU", "[spi_flash][ignore]") { - TaskHandle_t procpu_task; - TaskHandle_t appcpu_task; - struct flash_test_ctx ctx; + SemaphoreHandle_t done = xSemaphoreCreateCounting(4, 0); + struct flash_test_ctx ctx[4] = { + { .offset = 0x100 + 6, .done = done }, + { .offset = 0x100 + 7, .done = done }, + { .offset = 0x100 + 8, .done = done }, + { .offset = 0x100 + 9, .done = done } + }; - ctx.offset[0] = 6; - ctx.offset[1] = 7; - ctx.fail[0] = 0; - ctx.fail[1] = 0; - ctx.done = xSemaphoreCreateBinary(); + xTaskCreatePinnedToCore(flash_test_task, "1", 2048, &ctx[0], 3, NULL, 0); + xTaskCreatePinnedToCore(flash_test_task, "2", 2048, &ctx[1], 3, NULL, 1); + xTaskCreatePinnedToCore(flash_test_task, "3", 2048, &ctx[2], 3, NULL, tskNO_AFFINITY); + xTaskCreatePinnedToCore(flash_test_task, "4", 2048, &ctx[3], 3, NULL, tskNO_AFFINITY); - xTaskCreatePinnedToCore(flash_test_task, "1", 2048, &ctx, 3, &procpu_task, 0); - if (portNUM_PROCESSORS == 2) { - xTaskCreatePinnedToCore(flash_test_task, "2", 2048, &ctx, 3, &appcpu_task, 1); - } - - xSemaphoreTake(ctx.done, portMAX_DELAY); - if (portNUM_PROCESSORS == 2) { - xSemaphoreTake(ctx.done, portMAX_DELAY); - } - - TEST_ASSERT_EQUAL(false, ctx.fail[0]); - if (portNUM_PROCESSORS == 2) { - TEST_ASSERT_EQUAL(false, ctx.fail[1]); + for (int i = 0; i < 4; ++i) { + xSemaphoreTake(done, portMAX_DELAY); + TEST_ASSERT_FALSE(ctx[i].fail); } + vSemaphoreDelete(done); }