~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Firmware Update
- November 13, 2012
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
in this issue
-- How to Combine 'volatile' with 'struct' in C
-- Where in the World is Michael Barr?
-- What Does 0x47u Mean Anyway?
-- Training Schedule for Spring 2013 -- Industry News That's Not Boring
Firmware Update is a free newsletter by embedded guru Michael Barr. This issue is Copyright 2012 by Barr Group, but may be reprinted for non-commercial purposes. Please forward it to colleagues who may benefit from the information. |
|
How to Combine 'volatile' with 'struct' in C ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C's volatile keyword is a qualifier that can be used to declare a variable in such a way that the compiler will never optimize away any of the reads and writes. Though there are several important types of variables to declare volatile, this obscure keyword is especially valuable when you are interacting with hardware peripheral registers and such via memory-mapped I/O.
Sometimes a memory-mapped I/O device could be as simple as just having a single 8-bit control register at a fixed address. In that case, the placement of volatile should be to the left of the * operator in the declaration of the pointer to that address. However, it is far more common that memory-mapped peripherals have several registers. So where should you place keyword volatile when using a struct overlay to point to these registers? |
|
Where in the World is Michael Barr? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dear reader, it has been almost six months since my last Firmware Update newsletter. My apologies for being absent without leave. I have never been as busy, professionally, as over the past 14 months. I recognize I have been quiet for too long for many of you and note that several readers have written to ask if I am okay or what is keeping me so busy. I am thankful for your concern and also for your patience.
In addition to launching the new company, Barr Group, and bringing on CEO Andrew Girson earlier this year, here's a quick summary of just some of what's been keeping me so busy... |
|
What Does 0x47u Mean Anyway? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MISRA-C Rule 10.6 requires that the suffix "u" be "applied to all constants of unsigned type." Thus adoption of MISRA-C by embedded software developers around the world has increased the probability of running into code that looks like "uint8_t foo = 0x47u;" In explaining what this means, embedded guru Nigel Jones also enumerates three ways to fully comply with this MISRA-C rule.
|
|
Training Schedule for Spring 2013 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Although we have not yet fully pinned down the dates and locations, Barr Group will soon announce not only a Spring 2013 Embedded Software Boot Camp but also two completely new week-long courses. Stay tuned for details.
|
|
Industry News That's Not Boring ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Art of Reverse Engineering ANSI-C Legacy Code http://www.embedded.com/electronics-blogs/in-the-trenches/4400465/The-art-of-reverse-engineering #embedsys
Was Kasparov beaten, in 1997, by a BUG in Deep Blue rather than by IBM's computer itself? Fascinating look at history. http://www.wired.com/playbook/2012/09/deep-blue-computer-bug/ Implications of driverless cars. #embedsys #want http://www.economist.com/news/business/21564821-carmakers-are-starting-take-autonomous-vehicles-seriously-other-businesses-should-too?fsrc=scn/tw/te/pe/thedriverlessroadahead The 6 Stages of Debugging: 1. That can't happen. 2. That shouldn't happen. 3. Hmmm, weird. 4. Why does that happen? 5. Oh, I see. 6. How did that ever work? Micrium's RTOS Chosen for Mars Curiosity's Analytical Lab http://sns.mx/zfjry1 How to Build a Small Inexpensive Supercomputer from 64 Raspberry Pi Computers (and Legos!) http://www.southampton.ac.uk/~sjc/raspberrypi/ National Council of Examiners to offer first Principles and Practice of Engineering exam in software in April 2013. http://www.eetimes.com/electronics-news/4375226/Sharpen-your-pencils-for-2013-software-exam?cid=NL_Medical&Ecosystem=medical-design Hacker reveals $50 open device to unlock Onity-brand hotel room door locks. #embedsys #security http://www.forbes.com/sites/andygreenberg/2012/07/23/hacker-will-expose-potential-security-flaw-in-more-than-four-million-hotel-room-keycard-locks/ |
|
Quick Links ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
Contact Information ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
email:
[email protected]
phone:
866.65.EMBED
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|