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.
@perlmansoong944
2 жыл бұрын
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 :-)
@jasonleng2490
3 жыл бұрын
So if I dynamically allocated a array inside a task, does it go onto the task's stack?
@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!
@Dygear
3 жыл бұрын
Nice Mission Impossible reference! Your voice does remind me of the guy on the tape, now that you said it.
@ShawnHymel
3 жыл бұрын
I was hoping someone would catch that :)
@Hasan...
3 жыл бұрын
Shawn, are you planning to upload a quick tutorial that uses both cores of ESP32 soon?
@ShawnHymel
3 жыл бұрын
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
@adityasreeram.k.s9527
9 ай бұрын
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.
@claytube1958
8 ай бұрын
I found that too..
@josephlai7737
3 жыл бұрын
How do you get 768 bytes overhead at 6:22? Shouldn't it be 623 (1024 - 401)?
@ShawnHymel
3 жыл бұрын
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!
@josephlai7737
3 жыл бұрын
@@ShawnHymel Thanks! Now I see that 768 bytes comes from documentation/configuration.
@coderhex1675
3 жыл бұрын
@@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
@jinmingtang1545
2 жыл бұрын
Thank you for pointing it out and bridging the gap!
@diyworkshopvn6231
2 жыл бұрын
I have the same question, thank for your pointing it out. :)
@bteck2005
3 жыл бұрын
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".
@ShawnHymel
3 жыл бұрын
Good point, thank you!
@Microcontrollerslab
3 жыл бұрын
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.
@bteck2005
3 жыл бұрын
@@Microcontrollerslabit would have been clearer and much more accurate to simply state that static variables follow the same visibility rules as other variables.
@turkey343434
3 жыл бұрын
Excellent content. Thank you Shawn, keep them coming!
@achalasamapriya2701
3 жыл бұрын
was waiting for this.. thanks
@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?
@Astronomer6573
3 жыл бұрын
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!
@MuhammadDaudkhanTV100
3 жыл бұрын
Really good ideas
@neilbalch
3 жыл бұрын
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
@eylulmood4830
2 жыл бұрын
please, how did you calculate the overhead 768 at 06:21
@digikey
2 жыл бұрын
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!
@eylulmood4830
2 жыл бұрын
@@digikey thank you Mr it helps :)
@yadavsomnath6188
2 жыл бұрын
@@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..
@baobuiquoc4763
3 жыл бұрын
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
@jahidulislamrahat9877
3 жыл бұрын
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.
@ShawnHymel
3 жыл бұрын
To get stack, you need to add up the size of all of the automatically allocated variables for that task.
@3adelz90
3 жыл бұрын
@@ShawnHymel How can I calculate thr stack size I need if I have a big Task with lots of functions ?
@borhanuddin6774
20 күн бұрын
How to calculate the task memory 1200 bytes?
@Tracing0029
2 жыл бұрын
This guy is seriously amazing! Thanks for the vid!
@EstherCampbell-p1k
25 күн бұрын
Anderson Steven Moore Kenneth Miller Helen
@TerryMuriel-l8s
21 күн бұрын
Young Patricia Garcia Sarah Harris Sandra
@KP_100
2 ай бұрын
How void loop() is called ? there is no api call.
@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 ?!
@Maria-y7s7r
Жыл бұрын
I have the same problem...
@mudkiptheengineer5339
Жыл бұрын
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
@Tracing0029
2 жыл бұрын
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?
@eslamsayed1947
3 жыл бұрын
How to change task scheduling time in freeRTOS?
@ShawnHymel
3 жыл бұрын
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.
@fouzaialaa7962
9 ай бұрын
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 .
@vikrantgsai7327
7 ай бұрын
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?
@MingOnUTube
2 жыл бұрын
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
2 жыл бұрын
Could you find any answer to your question?
@yadavsomnath6188
2 жыл бұрын
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).
@shubhamsen4572
3 жыл бұрын
This guy is excellent
@debarkamondal6406
2 жыл бұрын
Why are we counting till idx-1 and why is volatile qualifier necessary?
@zulkaifahmed1893
2 жыл бұрын
you look like glassreflection guy who reviews anime
@zee-lab-electronics
3 жыл бұрын
Awesome work Shawn
@maurod6180
3 жыл бұрын
thank you very much!!!!!
@lucvanhove9639
3 жыл бұрын
Thanks Shawn, you just explain my problem and show the way to a sullution. 👍🧐
@mdmaroof2007
3 жыл бұрын
Maybe you need to slow down while explaining 😉
@alissonneres5067
3 жыл бұрын
Good thing it is a video and I can watch again and again if I need (and I usually do)
@bteck2005
3 жыл бұрын
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!
@rbclima
3 жыл бұрын
@@bteck2005 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
Пікірлер: 76