This channel is basically covering one of my courses thats painfully unclear, absolutely awesome
@Apocobat Жыл бұрын
real time embedded systems at my school, although lecture wise is ok, does not cover hardware implementation at all. Im really disappointed considering that my school is supposed to be one of the more advanced in terms of software/hardware education. It doesnt help that they pulled the lab ta off the street and he knows virtually nothing about rtos and wants to teach us about linux and computer os instead which is completely disconnected from the course content.
@AlphaCrucis Жыл бұрын
"Good luck. We're all counting on you." I love this guy. He's good at explaining, makes it interesting, makes good use of visual aids and demos, and has a sense of humor. Thank you Shawn!
@adityasreeram.k.s95277 ай бұрын
For those who are referring his solution form website, do note that instead of "idx ;" correct it as "idx++;" .If index in not incremented there can be chance for assert failed error. Hope this helps someone.
@claytube19587 ай бұрын
I found that too..
@Dygear3 жыл бұрын
Nice Mission Impossible reference! Your voice does remind me of the guy on the tape, now that you said it.
@ShawnHymel3 жыл бұрын
I was hoping someone would catch that :)
@Astronomer65733 жыл бұрын
Really good explanation and visual demonstration on how memory allocation should be done. Your voice can really stay in my head, looking forward to all of your videos!
@turkey3434343 жыл бұрын
Excellent content. Thank you Shawn, keep them coming!
@achalasamapriya27013 жыл бұрын
was waiting for this.. thanks
@minefacex2 жыл бұрын
This guy is seriously amazing! Thanks for the vid!
@Hasan...3 жыл бұрын
Shawn, are you planning to upload a quick tutorial that uses both cores of ESP32 soon?
@ShawnHymel3 жыл бұрын
I wasn't planning on it, as these videos are focused on RTOS concepts and FreeRTOS (the ESP32 just happened to be a really easy way to start using FreeRTOS). However, I'm glad to know there's interest in talking about multi-core operations and the ESP32, so I'll keep that in mind. For now, I recommend starting by looking the differences between ESP-IDF and FreeRTOS to get a sense of how the ESP32 uses its 2 cores when running tasks: docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/freertos-smp.html
@josephlai77373 жыл бұрын
How do you get 768 bytes overhead at 6:22? Shouldn't it be 623 (1024 - 401)?
@ShawnHymel3 жыл бұрын
Each task in ESP-IDF requires 768 bytes of task stack for bare minimum operation. If you allocate 1024 bytes for stack, that gives you 1024 - 768 = 256 bytes left in stack for that task. Since we try to declare an int array with 100 elements, that will try to use 400 bytes of stack (100 * sizeof(int) = 400 bytes), which is more than we have left. Hope that helps!
@josephlai77373 жыл бұрын
@@ShawnHymel Thanks! Now I see that 768 bytes comes from documentation/configuration.
@coderhex16753 жыл бұрын
@@ShawnHymel you should have explain like that in the video. Because i have had the same question. Now , i got this but i have wasted my brain tying to figure out. Anyway.. Thank you
@jinmingtang15452 жыл бұрын
Thank you for pointing it out and bridging the gap!
@diyworkshopvn6231 Жыл бұрын
I have the same question, thank for your pointing it out. :)
@boontecklee5923 жыл бұрын
At around 0:34, you mentioned that: "This section is labelled as static memory and connot be used for other parts of the program". This explanation is misleading as it gave the impression that static memory cannot be 'used' for other parts of the program. Static memory can certainly be used in any part of program as long as the variable visibility rules are adhered to. Instead, your explanation could have been better stated as: "This section is labelled as static memory which is only allocated during compile time".
@ShawnHymel3 жыл бұрын
Good point, thank you!
@Microcontrollerslab3 жыл бұрын
What he is trying to say is that the static variables have an internal linkage that means static variables can only be accessed within the same program file where they are defined. You can not access static variables in any other file if your program has multiple files. similarly, if we use static with the function definition, it can not be accessed from any other file.
@boontecklee5923 жыл бұрын
@@Microcontrollerslabit would have been clearer and much more accurate to simply state that static variables follow the same visibility rules as other variables.
@zee-lab-electronics3 жыл бұрын
Awesome work Shawn
@shubhamsen45723 жыл бұрын
This guy is excellent
@neilbalch3 жыл бұрын
Interesting note... I wasn't able to get my ESP32-S2-Mini-1 to crash when allocating the 400-byte array when I configured the task to use 1024 bytes of stack memory. I had to lower it to something like 500 bytes to replicate the hard reset. I supposed this means that the overhead is lower for my version of the ESP-IDF core? :)
@SohamChakraborty42069 Жыл бұрын
Yes, probably this is what is happening. I suppose the overhead needed would depend on the device
@philflupp8199 Жыл бұрын
Calculating the size of the actually allocated memory gives me 4112 bytes instead of 4 * 1024 = 4096 bytes, why is that?
@vex123 Жыл бұрын
I was wondering the exact same thing. I also did the exercise and even just allocating one byte, it decreases the heap size by like 20 bytes. Is there some type of overhead in the heap when dynamic allocation is used?
@baobuiquoc47633 жыл бұрын
Dear Mr Shawn, thanks for your video. On your solution code, you use a global variable msg_flag. Will it create a race condition between the printMessage task and the interrupt handler? i.e. before the task clear the flag, interrupt occur and set the flag, then return to the task and the task clear the flag. The message will be missed, and the msg_ptr is not freed
@perlmansoong9442 жыл бұрын
Great video, Shawn! And I've a question. From 2:46, what is the usage of the light-orange-colored Stack (at the top of the RAM pattern)? Seems that this part is unused in FreeRTOS system, doesn't it? Thank you :-)
@MuhammadDaudkhanTV1003 жыл бұрын
Really good ideas
@philflupp8199 Жыл бұрын
I have completed the challenge. However I could not get my application to run properly without using vTaskDelay(0) in both tasks. Otherwise, only the task which was created first, is executed, and the other one never. The tasks are of the same priority and are pinned to one core. It seems to me that you actually have to explicitly yield task execution (by calling vTaskDelay() ) in order to give other tasks a chance to run. Which contradicts, what was said about the scheduler executing tasks of same priority in round robin fashion ?!
@user-kp7im1sg8k11 ай бұрын
I have the same problem...
@mudkiptheengineer533910 ай бұрын
check if you have configUSE_PREEMPTION 1, this will make the scheduler round Robin through all the tasks of the same priority that are in the ready state
@lucvanhove96393 жыл бұрын
Thanks Shawn, you just explain my problem and show the way to a sullution. 👍🧐
@jahidulislamrahat98773 жыл бұрын
Sorry actually, I did not understand stack size calculation. can you please describe to me how can I calculate it? in my case memory size is 408 bytes.
@ShawnHymel3 жыл бұрын
To get stack, you need to add up the size of all of the automatically allocated variables for that task.
@3adelz903 жыл бұрын
@@ShawnHymel How can I calculate thr stack size I need if I have a big Task with lots of functions ?
@fouzaialaa79628 ай бұрын
malloc is called that becoz it references the human readable Memory Allocate so it becomes malloc i find it easier to memorize the functions name if i know the human readable equivalent .
@vikrantgsai73275 ай бұрын
If the heap has some bytes remaining that is more than enough to allocate more arrays of 1024 integers in the above example at 9:17 why does it say that the heap has run out of heap?
@minefacex2 жыл бұрын
Hey Shawn! I have realized that if I put vTaskDelay(100 / portTICK_PERIOD_MS); at the and of the task where you demonstrated the stack free space size problem, there is no Guru Meditation Error! Why is that?
@MingOnUTube2 жыл бұрын
Please can anyone help? Why is the stack canary watchpoint not triggered immediately and the task while loop is able to run several times before the trigger? Also, is it watching the "real" stack or the "task" stack in the heap?
@taccle1129 Жыл бұрын
Could you find any answer to your question?
@yadavsomnath6188 Жыл бұрын
Same question buddy..
@MingOnUTube Жыл бұрын
@@taccle1129 Nope. I moved on. Better not be stuck. Can always revisit this issue.
@pandabar2869 Жыл бұрын
The stack overflow is not checked every time when something is written to the stack, but only when the tick is finished and the kernel takes over control. Then the kernel can check if the canary was overwritten.
@MingOnUTube Жыл бұрын
@@pandabar2869 Thank you! I think it might take several ticks? Because the loop is able to run 10+ times(not sure, don't have the code at hand).
@eylulmood48302 жыл бұрын
please, how did you calculate the overhead 768 at 06:21
@digikey2 жыл бұрын
Shawn Hymel 6 months ago Each task in ESP-IDF requires 768 bytes of task stack for bare minimum operation. If you allocate 1024 bytes for stack, that gives you 1024 - 768 = 256 bytes left in stack for that task. Since we try to declare an int array with 100 elements, that will try to use 400 bytes of stack (100 * sizeof(int) = 400 bytes), which is more than we have left. Hope that helps!
@eylulmood48302 жыл бұрын
@@digikey thank you Mr it helps :)
@yadavsomnath6188 Жыл бұрын
@@digikey then why it didn't overflowed in first iteration itself ? I mean we are not freeing up the space then according to calculation 400>>usable stack.. So it should not allow this many iteration..rather it should give error at first iteration itself..
@debarkamondal64062 жыл бұрын
Why are we counting till idx-1 and why is volatile qualifier necessary?
@maurod61803 жыл бұрын
thank you very much!!!!!
@jasonleng24903 жыл бұрын
So if I dynamically allocated a array inside a task, does it go onto the task's stack?
@KP_10025 күн бұрын
How void loop() is called ? there is no api call.
@eslamsayed19473 жыл бұрын
How to change task scheduling time in freeRTOS?
@ShawnHymel3 жыл бұрын
Good question--It's set in the line "#define configTICK_RATE_HZ" in FreeRTOSConfig.h. This is set to "1000" by default in the ESP32 Arduino package.
@zulkaifahmed18932 жыл бұрын
you look like glassreflection guy who reviews anime
@mdmaroof20073 жыл бұрын
Maybe you need to slow down while explaining 😉
@alissonneres50673 жыл бұрын
Good thing it is a video and I can watch again and again if I need (and I usually do)
@boontecklee5923 жыл бұрын
I too feel the narrative is too fast. It tends to distract the listeners and affect understanding. I hope your narrative for future videos can be slower by say 10~15%. Nevertheless, your content is excellent!
@rbclima2 жыл бұрын
@@boontecklee592 you can always watch at 0.75x!
@ashwin372 Жыл бұрын
use 0.5x for that
@pnuema1.618 Жыл бұрын
Slow the video down and open up his code for review before watching the video. That's how you really learn this stuff anyway