pho ramen soba

Sunday, 4 December 2022

[New post] espressif releases esp_idf version 5

Site logo image whbeebe posted: "Espessif officially released version 5 of their ESP_IDF (IoT Development Framework) on 2 December. I've been spending the last two days learning how to migrate from version 4.4.3 to version 5. After a few false starts I've discovered a workflow that works" Arcane Science Lab

espressif releases esp_idf version 5

whbeebe

Dec 4

Espessif officially released version 5 of their ESP_IDF (IoT Development Framework) on 2 December. I've been spending the last two days learning how to migrate from version 4.4.3 to version 5. After a few false starts I've discovered a workflow that works for me.

  • First thing I do is create a new work folder in which to migrate to version 5.
  • Within that folder I recursively copy the contents of a version 5 example that most closely matches what I want to port. In my case it was underneath the examples folder, examples/get-started/blink.
  • Once copied I step into the main folder and copy the main folder contents of the application to be ported.
  • I step out of the main folder and back into the top level migration folder
  • I perform an idf.py set-target esp32s3 or esp32c3 for the hardware I need to compile for.
  • I them start to compile the code. You're going to get errors, so you need to keep an editor open in another console tab or within a graphical editor, and fix the errors that cause compiler errors.
  • I managed to complete the migration in no more than three steps.
  • Once compiled, then flash the new binary to the test board and see if it works. In both of my cases so far, they have.

Here's one of the easiest of my apps to port so far.

  /**    DualBlink      This example code is in the Public Domain (or CC0 licensed, at your option.)      Unless required by applicable law or agreed to in writing, this    software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR    CONDITIONS OF ANY KIND, either express or implied.  **/  #include <stdio.h>  #include <array>    #include "freertos/FreeRTOS.h"  #include "freertos/task.h"  #include "driver/gpio.h"  #include "esp_log.h"  #include "led_strip.h"  #include "sdkconfig.h"    // Create an array of color arrays to cycle through continuously.  //  using std::array;  const array<array<int, 3>, 7> colors {{      {32,0,0},  // red      {0,32,0},  // green      {0,0,32},  // blue      {0,32,32}, // cyan      {32,0,32}, // magenta      {32,16,0}, // yellow      {0,0,0}    // black      }};    // Task 1.  //  static void task_blink_neo_pixel(void * pvParameters) {      // Initialized the NeoPixel.      //      static led_strip_handle_t led_strip;        led_strip_config_t strip_config = {          .strip_gpio_num = CONFIG_BLINK_GPIO,          .max_leds = 1, // at least one LED on board      };        led_strip_rmt_config_t rmt_config = {          .resolution_hz = 10000000, // 10 MHz      };        ESP_ERROR_CHECK(led_strip_new_rmt_device(          &strip_config, &rmt_config, &led_strip));        // Darken NeoPixel by setting individual LED values to 0      //      led_strip_clear(led_strip);        // Task 1 endless loop.      //      while(true) {          for(auto color : colors) {              led_strip_set_pixel(led_strip, 0, color[0], color[1], color[2]);              led_strip_refresh(led_strip);              vTaskDelay(500 / portTICK_PERIOD_MS);              led_strip_clear(led_strip);              vTaskDelay(500 / portTICK_PERIOD_MS);          }      }  }    // Task 2.  //  static void task_blink_led(void * pvParameters) {      gpio_reset_pin(GPIO_NUM_46);        // Set the GPIO as a push/pull output      //      gpio_set_direction(GPIO_NUM_46, GPIO_MODE_OUTPUT);        // Task 2 endless loop.      //      while (true) {          gpio_set_level(GPIO_NUM_46, true);   // LED on          vTaskDelay(100 / portTICK_PERIOD_MS);          gpio_set_level(GPIO_NUM_46, false);  // LED off          vTaskDelay(100 / portTICK_PERIOD_MS);          gpio_set_level(GPIO_NUM_46, true);   // LED on          vTaskDelay(100 / portTICK_PERIOD_MS);          gpio_set_level(GPIO_NUM_46, false);  // LED off          vTaskDelay(2700 / portTICK_PERIOD_MS);      }  }    // Main entry.  //  extern "C" void app_main(void) {      static const char *TAG = "DUAL_BLINK";      int core = xPortGetCoreID();      ESP_LOGI(TAG, "BEGIN");      ESP_LOGI(TAG, IDF_VER);      ESP_LOGI(TAG, "APP_MAIN CORE %i", core);        // Create task 1.      //      TaskHandle_t xHandle1 = NULL;      static uint8_t ucParameterToPass1 = 1;        xTaskCreate(          task_blink_neo_pixel,          "BlinkNeoPixel",        // human readable task name.          2048,                   // stack size in bytes.          &ucParameterToPass1,          tskIDLE_PRIORITY,          &xHandle1      );      configASSERT(xHandle1);        // Create task 2.      //      TaskHandle_t xHandle2 = NULL;      static uint8_t ucParameterToPass2 = 1;        xTaskCreate(          task_blink_led,          "BlinkLED",             // human-readable task name.          2048,                   // stack size in bytes.          &ucParameterToPass2,          tskIDLE_PRIORITY,          &xHandle2      );      configASSERT(xHandle2);        // Stay in an endless loop. Don't return from this task.      //      while (true) {          vTaskDelay(5000 / portTICK_PERIOD_MS); // 5 second period      }  }  

The solidly highlighted section above shows what had to be changed. It looks like a lot, but it's not. The functionality is still the same as it was in older versions, it's how that functionality is invoked that's changed. What I found more interesting is that none of the multitasking functionality changed. I wasn't sure what to expect, but the changes to using the NeoPixel are rather minor, all things considered. What I'm looking forward to is if I can use the external PSRAM on all the boards. Currently I can't with ESP_IDF 4.x.

There's also a problem compiling Micropython with version 5. I've already checked and there is no support in Micropython 1.19.1 for ESP_IDF 5. I found an open ticket in the Micropython forums talking about this and asking if anyone wanted to step forward and work on this.

Micropython Issue 8607: https://github.com/micropython/micropython/issues/8607

Comment
Like
Tip icon image You can also reply to this email to leave a comment.

Unsubscribe to no longer receive posts from Arcane Science Lab.
Change your email settings at manage subscriptions.

Trouble clicking? Copy and paste this URL into your browser:
https://arcanesciencelab.wordpress.com/2022/12/04/espressif-releases-esp_idf-version-5/

Powered by WordPress.com
Download on the App Store Get it on Google Play
at December 04, 2022
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

The ULTIMATE Vegan Holiday Cookie Round-Up 🍪

Our BEST vegan holiday cookie recipes! Find classic chocolate chip, chewy ginger cookies, easy no-bakes & much...

  • [New post] This tried-and-true Irish pub-inspired soup is creamy and thick with chunks of potatoes and leeks throughout.
    Emily Morgan posted: "This tried-and-true Irish pub-inspired soup is creamy and thick with chunks of potatoes and leeks thr...
  • LA COURONNE LYONNAISE, TWO WAYS
    This bread originates in Lyon, and is shaped as a crown, therefore the name ...
  • Keto Chicken Pot Pie Casserole (Gluten-Free)
    INGREDIENTS US CustomaryMetric▢4 cups cooked chicken breast (roasted, rotisserie...

Search This Blog

  • Home

About Me

phoo, ramen, soba
View my complete profile

Report Abuse

Blog Archive

  • December 2025 (1)
  • November 2025 (18)
  • October 2025 (21)
  • September 2025 (19)
  • August 2025 (28)
  • July 2025 (25)
  • June 2025 (28)
  • May 2025 (34)
  • April 2025 (36)
  • March 2025 (39)
  • February 2025 (36)
  • January 2025 (43)
  • December 2024 (46)
  • November 2024 (51)
  • October 2024 (44)
  • September 2024 (1172)
  • August 2024 (1572)
  • July 2024 (1413)
  • June 2024 (1289)
  • May 2024 (1362)
  • April 2024 (1472)
  • March 2024 (1827)
  • February 2024 (2413)
  • January 2024 (2936)
  • December 2023 (2135)
  • November 2023 (1639)
  • October 2023 (1285)
  • September 2023 (918)
  • August 2023 (864)
  • July 2023 (795)
  • June 2023 (800)
  • May 2023 (796)
  • April 2023 (754)
  • March 2023 (649)
  • February 2023 (736)
  • January 2023 (1159)
  • December 2022 (968)
  • November 2022 (921)
  • October 2022 (852)
  • September 2022 (708)
  • August 2022 (766)
  • July 2022 (877)
  • June 2022 (684)
  • May 2022 (716)
  • April 2022 (698)
  • March 2022 (781)
  • February 2022 (734)
  • January 2022 (955)
  • December 2021 (1387)
  • November 2021 (3002)
  • October 2021 (3213)
  • September 2021 (3188)
  • August 2021 (3232)
  • July 2021 (1697)
Powered by Blogger.