In this blog we will see how to create a FreeRTOS task on ESP32 , we will also see how to load the code using just MINGW command line. If you haven’t setup your dev environment for ESP32 , you can follow this post (if you just want to use text editors , you can ignore the part related setting-up eclipse).
When ever we are writing a blinking led program we will put the logic in the main loop. Instead of writing the logic for blinking LED on main loop , we will create separate method (blink_task) for that.We will use this method to create task. Task creation on FreeRTOS is very easy. We can ask FreeRTOS to create a separate task and give blink_task as entry point, this task will have its own stack
we are using xTaskCreate (entry method, task name,stack depth,prameters to the task,priority,task handle) to create new task. you can read more about this method here
In the blink task we will set the direction of GPIO 16 to OUTPUT , and toggle it on every iteration in the while loop
open MINGW console and export the IDF path
Open the Makefile and pase the following contents
PROJECT_NAME := blinking_led
Open the blinking_led.c file and paste the code from above gist.
now switch to blinking_led folder and run the following commands (if menuconfig screen opens up, select appropriate COM port)