Hands-On RTOS with Microcontrollers by Brian Amos
Author:Brian Amos
Language: eng
Format: mobi
Tags: COM041000 - COMPUTERS / Microprocessors, COM051060 - COMPUTERS / Programming Languages / C, COM067000 - COMPUTERS / Hardware / General
Publisher: Packt
Published: 2020-05-15T08:58:49+00:00
Important notes
Passing by reference can be more efficient than passing by value for moving large data structures around, but several things need to be kept in mind:
Keep the datatypes straight: Because the argument to a queue is of the void* data type, the compiler won't be able to warn you that you're supplying an address to a struct instead of to a pointer.
Keep the queued data around: Unlike passing data by value, when a queue holds pointers to the data, the underlying data passed to the queue needs to stay until it is used. This has the following implications: The data must not live on the stack—no local function variables! Although this can be made to work, it is generally a bad idea to define variables on a stack in the middle of a call chain and then push a pointer onto a queue. By the time the receiving task pulls the pointer off of the queue, the stack of the sending task is likely to have changed. Even if you do get this to work under some circumstances (such as when the receiving task has a higher priority than the sending task), you'll have created a very brittle system that is likely to break in a very subtle way in the future.
A stable storage location for the underlying variable is a must. Global and statically allocated variables are both acceptable. If you'd like to limit access to a variable, use static allocation inside a function. This will keep the variable in memory, just as if it was a global, but limit access to it:
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Computer Design | Control Systems |
DSPs | Embedded Systems |
Microprocessor Design | PIC Microcontroller |
Building Low Latency Applications with C++ by Sourav Ghosh(2847)
Fusion 360 for Makers by Lydia Sloan Cline(1983)
Networking A Beginner's Guide by Bruce Hallberg(1932)
But How Do It Know? by J. Clark Scott(1813)
Computers For Seniors For Dummies by Nancy C. Muir(1769)
Arduino Project Handbook, Volume 2: 25 Simple Electronics Projects for Beginners by Geddes Mark(1754)
Hands-On Linux for Architects by Denis Salamanca(1727)
Hack and HHVM by Owen Yamauchi(1671)
31 Days Before Your CompTIA A+ Exams (Shanette Luellen's Library) by Benjamin Patrick Conry(1661)
PrestaShop Recipes by Arnaldo Pérez Castaño(1465)
MicroPython Projects by Jacob Beningo(1458)
9781803246888-ENHANCING DEEP LEARNING WITH BAYESIAN INFERENCE by Unknown(1420)
Hands-On Internet of Things with MQTT by Tim Pulver(1407)
Raspberry Pi Electronics Projects for the Evil Genius (Tab) by Norris Donald & Norris Donald(1381)
Getting Started with Soldering: A Hands-On Guide to Making Electrical and Mechanical Connections by Vinck Marc de(1378)
Embedded Systems Architecture by Daniele Lacamera(1376)
Healthcare Information Security and Privacy (All-In-One) by Sean Murphy(1368)
Shaping the Fourth Industrial Revolution by Klaus Schwab & Nicholas Davis & Satya Nadella(1357)
The Internet of Things (The MIT Press Essential Knowledge series) by Greengard Samuel(1346)