Home Recommended Explore Explore Videos Explore Livestreams Explore Images Explore Audio Explore Topics Explore Users Explore groups Topics Groups About Features & roadmap Airtime extension Membership & xp moderation Community guidelines Airtime a short history imprint Contact us changelog

@Public Source Projects

Introduction to RTOS Part 4 - Memory Management | Digi-Key Electronics

#opensource

Memory management is important in a multi-threaded environment, as threads (or tasks) can quickly consume all of the allocated memory, causing bizarre effects such as overwritten memory locations or random processor resets.


The solution to the challenge in the video can be found here: https://www.digikey.com/en/maker/proj...​


In this video, we look at various ways to allocate memory to a task and how to monitor memory usage in FreeRTOS.


Most C programs rely on 3 different types of memory. Static memory is set aside prior to program execution and used for things like static variables, constants, and global variables. Stack is allowed to grow dynamically and consists of local variables declared at the function level. Finally, heap may also grow dynamically and must be specifically allocated and deallocated by the programmer (e.g. using the malloc() and free() functions, respectively).


Whenever we create a new task in FreeRTOS, we must assign it a set amount of stack memory to use out of the global, available heap. Note that each task also requires another section of heap for the Task Control Block (TCB), which stores various attributes about the task, such as its state and priority.


We demonstrate ways to monitor the stack in each thread as well as the total amount of heap available to the system. We also show what happens when you overrun the stack or heap!


Product Links:

https://www.digikey.com/en/products/d...​


Related Videos:

Introduction to RTOS Part 1 - What is a Real-Time Operating System (RTOS)? - https://youtu.be/F321087yYy4​


Introduction to RTOS Part 2 - Getting Started with FreeRTOS - https://youtu.be/JIr7Xm_riRs​


Introduction to RTOS Part 3 - Task Scheduling - https://youtu.be/95yUbClyf3E​


Introduction to RTOS Part 4 - Memory Management - https://youtu.be/Qske3yZRW5I​


Introduction to RTOS Part 5 - Queue - https://youtu.be/pHJ3lxOoWeI​


Introduction to RTOS Part 6 - Mutex - https://youtu.be/I55auRpbiTs​


Introduction to RTOS Part 7 - https://youtu.be/5JcMtbA9QEE​


Related Project Links:

https://www.digikey.com/en/maker/proj...​


Related Articles:

https://www.digikey.com/en/maker/vide...​


Learn more:

Maker.io - https://www.digikey.com/en/maker​


Digi-Key’s Blog – TheCircuit https://www.digikey.com/en/blog​


Connect with Digi-Key on Facebook https://www.facebook.com/digikey.elec...​


And follow us on Twitter https://twitter.com/digikey

Views:114
Likes:0
PostTime:1614049124237
Comment Count:0
Group Name:
Votes Count:0