<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Barr Code &#187; ethics</title>
	<atom:link href="http://embeddedgurus.com/barr-code/tag/ethics/feed/" rel="self" type="application/rss+xml" />
	<link>http://embeddedgurus.com/barr-code</link>
	<description>A Blog by Michael Barr</description>
	<lastBuildDate>Wed, 25 Jan 2012 09:45:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>How to Enforce Coding Standards (Automatically)</title>
		<link>http://embeddedgurus.com/barr-code/2011/05/how-to-enforce-coding-standards-automatically/</link>
		<comments>http://embeddedgurus.com/barr-code/2011/05/how-to-enforce-coding-standards-automatically/#comments</comments>
		<pubDate>Wed, 25 May 2011 15:01:34 +0000</pubDate>
		<dc:creator>Michael Barr</dc:creator>
				<category><![CDATA[Coding Standards]]></category>
		<category><![CDATA[Firmware Bugs]]></category>
		<category><![CDATA[embedded]]></category>
		<category><![CDATA[ethics]]></category>
		<category><![CDATA[firmware]]></category>
		<category><![CDATA[safety]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[standards]]></category>

		<guid isPermaLink="false">http://embeddedgurus.com/barr-code/?p=623</guid>
		<description><![CDATA[Coding standards can be an important tool in the fight to keep bugs out of embedded software. Unfortunately, too many well-intentioned (especially, corporate) coding standards are ineffective and gather more dust than followers. The hard truth is that enforcement of coding standards too often depends on programmers already under deadline pressure to be disciplined while [...]]]></description>
			<content:encoded><![CDATA[<p>Coding standards can be an important tool in the fight to <a href="http://www.eetimes.com/discussion/other/4008255/Bug-killing-standards-for-firmware-coding">keep bugs out of embedded software</a>. Unfortunately, too many well-intentioned (especially, corporate) coding standards are ineffective and gather more dust than followers. The hard truth is that enforcement of coding standards too often depends on programmers already under deadline pressure to be disciplined while they code and/or to make time to perform peer code reviews. And when peer reviews are done in this scenario, they too easily devolve into compliance discussions that miss the forest for the trees.</p>
<p>To ensure your selected coding standard is followed and thus effective, your team should find as many automated ways to enforce as many of its rules as possible. And you should make such automated rule checking part of the everyday software build process. Ideally, you would also restrict version control check-ins to just code that has passed all the automated checks. No code that breaks any of these automatable rules should be allowed in peer code reviews. That way, code reviewers can focus their limited hours on (1) what the code is supposed to do, (2) whether it does so correctly, and (3) whether the code and comments together are easily understood by all involved.</p>
<p>One of the ways <a href="http://netrino.com">Netrino</a> has found to increase compliance with its <a href="http://netrino.com/Coding-Standard">Embedded C Coding Standard</a> is by configuring static analysis tools we already use to automatically enforce individual rules.</p>
<p>Perhaps the best option is to use a static analysis tool that includes built-in support for your chosen coding standard and/or the ability to be customized to proprietary rules. <a href="http://ldra.com">LDRA</a>&#8216;s static analysis engine, a screenshot from which is shown in the image below, comes preconfigured to check about 80% of the &#8220;<a href="http://www.ldra.com/netrino.asp">NETRINO</a>&#8221; coding standard rules, as well as a number of other widely used coding standards.</p>
<p align="center"><a href="http://www.ldra.com/images/integrations/Figure1_Netrino_300.JPG"><img width="700" src="http://www.ldra.com/images/integrations/Figure1_Netrino_300.JPG" alt="The LDRA Tool Suite Enforces Netrino's Embedded C Coding Standard" /></a></p>
<p>But there are other, less expensive, options available as well. Two tools that we have used are <a href="http://msquaredtechnologies.com/m2rsm/index.htm">RSM</a> and <a href="http://gimpel.com/">PC-Lint</a> from M Squared Technologies and Gimpel Software, respectively. Neither can easily and independently enforce all of our <a href="http://netrino.com/Coding-Standard">Embedded C Coding Standard</a> rules. But used together and properly configured, these two tools offer a low-cost automated coding standards enforcement mechanism that covers a large percentage of the rules.</p>
<p><strong>Configuring RSM</strong></p>
<p>The following <a href="http://msquaredtechnologies.com/m2rsm/index.htm">RSM</a> outputs can be examined and configuration options set (in version 7.75) to assist in the automated enforcement of the identified rules from the <a href="http://netrino.com/Coding-Standard">Embedded C Coding Standard</a>. Pricing for the RSM tool, which runs on Windows, Linux, and other versions of Unix (including Mac OS X), is online at <a href="http://msquaredtechnologies.com/m2rsm/order/">http://msquaredtechnologies.com/m2rsm/order/</a>.</p>
<table>
<tr>
<td><strong>Rule #</strong></td>
<td><strong>Brief Description</strong></td>
<td><strong>Tool Configuration Notes</strong></td>
</tr>
<tr>
<td>1.2.a</td>
<td>Line length limited to 80 characters.</td>
<td>Quality Notice 1</td>
</tr>
<tr>
<td>1.3.a</td>
<td>Braces surround all blocks of code.</td>
<td>Quality Notice 22</td>
</tr>
<tr>
<td>1.7.c</td>
<td>Keyword goto not used.</td>
<td>Quality Notice 9</td>
</tr>
<tr>
<td>1.7.d</td>
<td>Keyword continue not used.</td>
<td>Quality Notice 43</td>
</tr>
<tr>
<td>1.7.e</td>
<td>Keyword break not used outside switch.</td>
<td>Quality Notice 44</td>
</tr>
<tr>
<td>2.2</td>
<td>Location and content of comments.</td>
<td>Quality Notices 17, 20, 51; Options -Es -Ec -EC</td>
</tr>
<tr>
<td>3.1</td>
<td>Use of white space.</td>
<td>Quality Notices 16, 19</td>
</tr>
<tr>
<td>3.5.a</td>
<td>No tab characters.</td>
<td>Quality Notice 30; Option -Dt</td>
</tr>
<tr>
<td>3.6.a</td>
<td>UNIX-style (single-character) linefeeds.</td>
<td>Option -Du</td>
</tr>
<tr>
<td>4.1.a-d</td>
<td>Module naming conventions.</td>
<td>Option -Rn</td>
</tr>
<tr>
<td>4.2.a</td>
<td>Precisely one header file per source file.</td>
<td>Option -Rn</td>
</tr>
<tr>
<td>6.1.a-e</td>
<td>Precisely one header file per source file.</td>
<td>Quality Notice 2; Option -l</td>
</tr>
<tr>
<td>6.2</td>
<td>Cyclomatic complexity of functions.</td>
<td>Quality Notices 10, 18, 27; Option -c</td>
</tr>
<tr>
<td>6.3.b.i-iii</td>
<td>Preprocessor macro safety mechanisms.</td>
<td>Option -m</td>
</tr>
<tr>
<td>8.2.d</td>
<td>If-else if statements always have else.</td>
<td>Quality Notice 22</td>
</tr>
<tr>
<td>8.3.b</td>
<td>Switch statements always have default.</td>
<td>Quality Notices 13, 14, 56</td>
</tr>
<tr>
<td>8.5.a</td>
<td>No unconditional jumps.</td>
<td>Quality Notices 9, 43, 444</td>
</tr>
</table>
<p></p>
<p><strong>Configuring PC-Lint</strong></p>
<p>In a <a href="/barr-code/2011/06/how-to-enforce-coding-standards-using-pc-lint/">future blog post</a>, I will similarly identify <a href="http://gimpel.com">PC-Lint</a> configurations that can be used (in version 9.0) to assist in the automated enforcement of specific rules from the <a href="http://netrino.com/Coding-Standard">Embedded C Coding Standard</a>. Pricing for the PC-Lint tool, which runs on Windows, Linux, and other versions of Unix (including Mac OS X), is online at <a href="http://gimpel.com/html/order.htm">http://gimpel.com/html/order.htm</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://embeddedgurus.com/barr-code/2011/05/how-to-enforce-coding-standards-automatically/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>What NHTSA/NASA Didn&#8217;t Consider re: Toyota&#8217;s Firmware</title>
		<link>http://embeddedgurus.com/barr-code/2011/03/what-nhtsanasa-didnt-consider-re-toyotas-firmware/</link>
		<comments>http://embeddedgurus.com/barr-code/2011/03/what-nhtsanasa-didnt-consider-re-toyotas-firmware/#comments</comments>
		<pubDate>Wed, 02 Mar 2011 23:10:54 +0000</pubDate>
		<dc:creator>Michael Barr</dc:creator>
				<category><![CDATA[Coding Standards]]></category>
		<category><![CDATA[Firmware Bugs]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[embedded]]></category>
		<category><![CDATA[engineering]]></category>
		<category><![CDATA[ethics]]></category>
		<category><![CDATA[firmware]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[realtime]]></category>
		<category><![CDATA[rtos]]></category>
		<category><![CDATA[safety]]></category>
		<category><![CDATA[standards]]></category>
		<category><![CDATA[trends]]></category>

		<guid isPermaLink="false">http://embeddedgurus.com/barr-code/?p=548</guid>
		<description><![CDATA[In a blog post yesterday (Unintended Acceleration and Other Embedded Software Bugs), I wrote extensively on the report from NASA&#8217;s technical team regarding their analysis of the embedded software in Toyota&#8217;s ETCS-i system. My overall point was that it is hard to judge the quality of their analysis (and thereby the overall conclusion that the [...]]]></description>
			<content:encoded><![CDATA[<p>In a blog post yesterday (<a href="/barr-code/2011/03/unintended-acceleration-and-other-embedded-software-bugs/">Unintended Acceleration and Other Embedded Software Bugs</a>), I wrote extensively on the report from NASA&#8217;s technical team regarding their analysis of the embedded software in Toyota&#8217;s ETCS-i system. My overall point was that it is hard to judge the quality of their analysis (and thereby the overall conclusion that the software isn&#8217;t to blame for unintended accelerations) given the large number of redactions.</p>
<p>I need to put the report down and do some other work at this point, but I have a few other thoughts and observations worth writing down.</p>
<p><strong>Insufficient Explanations</strong></p>
<p>First, some of the explanations offered by Toyota, and apparently accepted by NASA, strike me as insufficent.  For example, at pages 129-132 of <a href="http://www.nhtsa.gov/staticfiles/nvs/pdf/NASA_FR_Appendix_A_Software.pdf">Appendix A</a> to the NASA Report there is a discussion of <a href="http://en.wikipedia.org/wiki/Recursion">recursion</a> in the Toyota firmware. &#8220;The question then is how to verify that the indirect recursion in the ETCS-i does in fact terminate (i.e., has no infinite recursion) and does not cause a stack overflow.&#8221; </p>
<blockquote><p>
&#8220;For the case of stack overflow, [redacted phrase], and therefore a stack overflow condition cannot be detected precisely. It is likely, however, that overflow would cause some form of memory corruption, which would in turn cause some <strong>bad behavior</strong> that would then cause a watchdog timer reset. Toyota relies on this assumption to claim that stack overflow does not occur because no reset occurred during testing.&#8221; (emphasis added)
</p></blockquote>
<p>I have written about what really happens during stack overflow before (<a href="http://embeddedgurus.com/barr-code/2010/03/firmware-specific-bug-4-stack-overflow/">Firmware-Specific Bug #4: Stack Overflow</a>) and this explains why a reset may not result and also why it is so hard to trace a stack overflow back to that root cause. (From page 20, in NASA&#8217;s words: &#8220;The system stack is limited to just 4096 bytes, it is therefore important to secure that no execution can exceed the stack limit. This type of check is normally simple to perform in the absence of recursive procedures, which is standard in safety critical embedded software.&#8221;)</p>
<p>Similarly, &#8220;Toyota designed the software with a high margin of safety with respect to deadlines and timeliness. &#8230; [but] documented no formal verification that all tasks actually meet this deadline requirement.&#8221; and &#8220;All verification of timely behavior is accomplished with CPU load measurements and other measurement-based techniques.&#8221; It&#8217;s not clear to me if the NASA team is saying it buys those Toyota explanations or merely wanted to write them down. However, I do not see a sufficient explanation in this wording from page 132:</p>
<blockquote><p>
&#8220;The [worst case execution time] analysis and recursion analysis involve two distinctly different problems, but they have one thing in common: Both of their failure modes would result in a CPU reset. &#8230; These potential malfunctions, and many others such as concurrency deadlocks and CPU starvation, would <strong>eventually</strong> manifest as a spontaneous system reset.&#8221; (emphasis added)
</p></blockquote>
<p>Might not a <a href="http://embeddedgurus.com/barr-code/2010/11/firmware-specific-bug-7-deadlock/">deadlock</a>, starvation, <a href="http://embeddedgurus.com/barr-code/2010/11/firmware-specific-bug-8-priority-inversion/">priority inversion</a>, or infinite recursion be capable of producing a bit of &#8220;bad behavior&#8221; (perhaps even unintended acceleration) before that &#8220;eventual&#8221; reset? Or might not a stack overflow just corrupt one or a few important variables a little bit and that result in bad behavior rather than or before a result? These kinds of possibilities, even at very low probabilities, are important to consider in light of NASA&#8217;s calculation that the U.S.-owned Camry 2002-2007 fleet alone is running this software a cumulative one billion hours per year.</p>
<p><strong>Paths Not Taken</strong></p>
<p>My second observation is based upon reflection on the steps NASA might have taken in its review of Toyota&#8217;s ETCS-i firmware, but apparently did not. Specifically, there is no mention anywhere (unless it was entirely redacted) of: </p>
<ul>
<li><a href="http://www.netrino.com/Embedded-Systems/How-To/RMA-Rate-Monotonic-Algorithm">rate monotonic analysis</a>, which is a technique that Toyota could have used to validate the critical set of tasks with deadlines and higher priority ISRs (and that NASA could have applied in its review),</li>
<li><a href="http://en.wikipedia.org/wiki/Cyclomatic_complexity">cyclomatic complexity</a>, which NASA might have used as an additional winnowing tool to focus its limited time on particularly complex and hard to test routines,</li>
<li><a href="http://www.fda.gov/MedicalDevices/DeviceRegulationandGuidance/GuidanceDocuments/ucm089543.htm">hazard analysis and mitigation</a>, as those terms are defined by FDA guidelines regarding software contained in medical devices, nor</li>
<li>any discussion or review of Toyota&#8217;s specific software testing regimen and bug tracking system.
</ul>
<p>Importantly, there is also a complete absence of discussion of how Toyota&#8217;s ETCS-i firmware versions evolved over time. Which makes and models (and model years) had which versions of that firmware? (Presumably there were also hardware changes worthy of note.) Were updates or patches ever made to cars once they were sold, say while at the dealer during official recalls or other types of service?</p>
]]></content:encoded>
			<wfw:commentRss>http://embeddedgurus.com/barr-code/2011/03/what-nhtsanasa-didnt-consider-re-toyotas-firmware/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Unintended Acceleration and Other Embedded Software Bugs</title>
		<link>http://embeddedgurus.com/barr-code/2011/03/unintended-acceleration-and-other-embedded-software-bugs/</link>
		<comments>http://embeddedgurus.com/barr-code/2011/03/unintended-acceleration-and-other-embedded-software-bugs/#comments</comments>
		<pubDate>Tue, 01 Mar 2011 19:09:54 +0000</pubDate>
		<dc:creator>Michael Barr</dc:creator>
				<category><![CDATA[Coding Standards]]></category>
		<category><![CDATA[Firmware Bugs]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[embedded]]></category>
		<category><![CDATA[ethics]]></category>
		<category><![CDATA[firmware]]></category>
		<category><![CDATA[outsourcing]]></category>
		<category><![CDATA[realtime]]></category>
		<category><![CDATA[rtos]]></category>
		<category><![CDATA[safety]]></category>
		<category><![CDATA[standards]]></category>
		<category><![CDATA[trends]]></category>

		<guid isPermaLink="false">http://embeddedgurus.com/barr-code/?p=517</guid>
		<description><![CDATA[Last month, NHTSA and the NASA Engineering and Safety Center (NESC) published reports of their joint investigation into the causes of unintended acceleration in Toyota vehicles. NASA&#8217;s multi-disciplinary NESC technical team was asked, by Congress, to assist NHTSA by performing a review of Toyota&#8217;s electronic throttle control and the associated embedded software. In carefully worded [...]]]></description>
			<content:encoded><![CDATA[<p>Last month, <a href="http://www.nhtsa.dot.gov">NHTSA</a> and the <a href="http://www.nasa.gov/offices/nesc/home/index.html">NASA Engineering and Safety Center (NESC)</a> published reports of their joint investigation into the causes of unintended acceleration in Toyota vehicles. NASA&#8217;s multi-disciplinary NESC technical team was asked, by Congress, to assist NHTSA by performing a review of Toyota&#8217;s electronic throttle control and the associated embedded software. In carefully worded concluding statement, NASA stated that it &#8220;found no electronic flaws in Toyota vehicles capable of producing the large throttle openings required to create dangerous high-speed unintended acceleration incidents.&#8221; (The official reports and a number of supporting files are available for download at <a href="http://www.nhtsa.gov/UA">http://www.nhtsa.gov/UA</a>.)</p>
<p>The first thing you will notice if you join me in trying to judge the technical issues for yourself are the redactions: pages and pages of them. In parts and entirely for unexplained reasons, this report on automotive electronics reads like the public version of a CIA Training Manual. I&#8217;ve observed that approximately 193 of the 1,061 pages released so far feature some level of redaction (via black boxes, which obscure from a single number, word, or phrase to a full table, page, or section). The redactions are at their worst in NASA&#8217;s <a href="http://www.nhtsa.gov/staticfiles/nvs/pdf/NASA_FR_Appendix_A_Software.pdf">Appendix A</a>, which describes NASA&#8217;s review of Toyota&#8217;s embedded software in detail. More than half of all the pages with redactions (including the vast majority of fully redacted tables, pages, and sections) are in that Appendix.</p>
<p>Despite the redactions, we can still learn some interesting facts about Toyota&#8217;s embedded software and NASA&#8217;s technical review of the same.  The bulk of the below outlines what I&#8217;ve been able to make sense of in about two days of reading.  Throughout, my focus is on embedded software inside the electronic throttle control, so I&#8217;m leaving out considerations of other potential causes, including EMI (which NASA also investigated).  First a little background on the investigation.</p>
<p><strong>Background</strong></p>
<p>Although the inquiry was taken to examine unintended acceleration reports across all Toyota, Scion, and Lexus models, NASA focused its technical inquiry almost entirely on Toyota Camry models equipped with the <em>Electronic Throttle Control System, Intelligent</em> (ETCS-i). The Camry has long been among the top cars bought in the U.S., so this choice probably made finding relevant complaint data and affected vehicles easier for NHTSA. (BTW, NASA says the voluntary complaint database shows both that unintended accelerations were reported before the introduction of electronic throttle control and that press coverage and Congressional hearings can increase the volume of complaints.)</p>
<p>According to a press release by the company made upon publication of the NHTSA and NASA reports, Toyota&#8217;s ETCS-i has been installed in &#8220;more than 40 million cars and trucks sold around the world, including more than 16 million in the United States.&#8221; Undoubtedly, ETCS-i has also &#8220;made possible significant safety advances such as vehicle stability control and traction control.&#8221; But as with any other embedded system there have been refinements made through the years to both the electronics and the embedded software. </p>
<p>Though Toyota apparently made available, under agreed terms and via its attorneys, schematics, design documents, and source code &#8220;for multiple Camry years and versions&#8221; (Appendix A, p. 9) as well as many of the Japanese engineers involved in its design and evolution, NASA only closely examined one version. In NASA&#8217;s words, &#8220;The area of emphasis will be the 2005 Toyota Camry because this vehicle has a consistently high rate of reported &#8216;UA events&#8217; over all Toyota models and all years, when normalized to the number of each model and year, according to NHTSA data.&#8221; (p. 7) Except as otherwise stated, everything else in this column concerns the electronics and firmware found in that year, make, and model.</p>
<p><strong>Event Data Recorders</strong></p>
<p>Event Data Recorder (EDR) is the generic term for the automotive equivalent of an aircraft black box <a href="http://en.wikipedia.org/wiki/Flight_data_recorder">flight data recorder</a>. EDRs were first installed in cars in the early 1990s and have increased in use as well as sophistication in the years since. Generally speaking, the event data recorder is an embedded system residing within the airbag control module located in the front center of the engine compartment. The event data recorder is connected to other parts of the car&#8217;s electronics via the CAN bus and is always monitoring vehicle speed, the position of the brake and accelerator pedals, and other key parameters. </p>
<p>In the event of an impossibly high (for the vehicle operating normally) acceleration or deceleration sensor reading, Toyota&#8217;s latest event data recorders save the prior five 1Hz samples of these parameters in a non-volatile memory area. Once saved, an event record can be read over the car&#8217;s On-Board Diagnostics (OBD) port (or, in the event of a more severe accident, directly from the airbag control module) via a special cable and PC software. If the airbag actually deploys, the event record will be permanently locked. The last 2 or 3 (depending on version) lesser &#8220;bump&#8221; records are also stored, but may be overwritten in a FIFO manner.</p>
<p>This investigation of Toyota&#8217;s unintended acceleration marked the first time that anyone from NHTSA had ever read data from a Toyota event data recorder. (Toyota representatives apparently testified in Congress that there had previously just been one copy of the necessary PC software in the U.S.) As part of this study, NHTSA validated and used tools provided by Toyota to extract historical data from 52 vehicles involved in incidents of unintended acceleration, with acknowledged bias toward geographically reachable recent events. After reviewing driver and other witness statements and examining said black box data, NHTSA concluded that 39 of these 52 events were explainable as &#8220;pedal misapplications.&#8221; That&#8217;s a very nice way of saying that whenever the driver reported &#8220;stepping on the brake&#8221; he or she had pressed the accelerator pedal by mistake. Figure 5 of a <a href="http://www.nhtsa.gov/staticfiles/nvs/pdf/NHTSA-Toyota_EDR_field_inspection.pdf">supplemental report describing these facts</a> portrays an increasing likelihood of such incidents with driver age vs. the bell curve of Camry ownership by age.</p>
<p>Note that no record is apparently ever made, in the event data recorder or elsewhere, of any events or state changes within the ETCS-i firmware. So-called &#8220;Diagnostic Trouble Codes&#8221; concerning sensor and other hardware failures are recorded in non-volatile memory and the presence of one or more such codes enables the &#8220;Check Engine&#8221; light on the dashboard. But no logging is done of significant software faults, including but not limited to watchdog-initiated resets. </p>
<p><strong>Engine Control Module</strong></p>
<p>ETCS-i is a collection of components and features that was changed in the basic engine design when Toyota switched from mechanical to electronic throttle control. (Electronic throttle control is also known as &#8220;throttle-by-wire&#8221;.) Toyota has used two different types of pedal sensors in the ETCS-i system, always in a redundant fashion. The earlier design, pre-2007, using potentiometers was susceptible to current leakage via growth of <a href="http://nepp.nasa.gov/whisker/">tin whiskers</a>. Though this type of failure was not known to cause sudden high-speed behaviors, it did seem to be associated with a higher number of warranty claims. The newer pedal sensor design uses <a href="http://en.wikipedia.org/wiki/Hall_effect_sensor">Hall effect sensors</a>.</p>
<p>Importantly, the brakes are not a part of the ETCS-i system. In the 2005 Camry, Toyota&#8217;s brake pedal was mechanically controlled. (It may still be.) It appears this is one of the reasons the NASA team felt comfortable with their conclusion that driver reports of wide open throttle behavior that could not be stopped with the brakes were not caused by software failures (alone). &#8220;The NESC team did not find an electrical path from the ETCS-i that could disable braking.&#8221; (<a href="http://www.nhtsa.gov/staticfiles/nvs/pdf/NASA-UA_report.pdf">NASA Report</a>, p. 15) It is clear, though, that power assisted brakes lose the enabling vacuum pressure when the throttle is wide open and the driver subsequently pumps the brakes; thus any system failure that opened the throttle could indirectly make bringing the vehicle to a stop considerably harder.</p>
<p>The Engine Control Module at the heart of the ETCS-i consists of a Main-CPU and a Sub-CPU located within a pair of ASICs. The Sub-CPU contains a set of A/D converters that translates raw sensor inputs, such as voltages VPA and VPA1 from the accelerator pedal, into digital position values and sends them to the Main-CPU via a serial interface. In addition, the Sub-CPU monitors the outputs of the Main-CPU and is able to reset (in the manner of a watchdog timer) the Main-CPU.</p>
<p>The Main-CPU is reported to be a <a href="http://america2.renesas.com/docs/files/U14559EJ2V0UM00.pdf">V850E1</a> microcontroller, which is &#8220;a 32-bit RISC CPU core for ASIC&#8221; designed by Renesas (nee NEC). The V850E1 processor has a 64MB program address space, which is part of an overall 4GB linear address space. The Main-CPU also keeps tabs on the Sub-CPU and can reset it if anything is found wrong.</p>
<p>NASA reports that the embedded software in the Main-CPU is written (mostly) in ANSI C and compiled using a <a href="http://www.ghs.com">GreenHills</a> C compiler (Appendix A, p. 14). Furthermore, an <a href="http://en.wikipedia.org/wiki/OSEK">OSEK</a>-compliant real-time operating system with fixed-priority preemptive scheduling is used to manage a redacted (but apparently larger than ten, based on the size of the redaction) number of real-time tasks. The actual firmware development (design, coding and unit testing) was outsourced to <a href="http://www.globaldenso.com/en/">Denso</a> (p. 19). Toyota apparently performed integration testing and ran several commercial and in-house static analysis tools, including <a href="http://www.programmingresearch.com/qac_main.html">QAC</a> (p. 20). The code was written in English, with Japanese comments and design documents, and follows a proprietary Toyota naming convention/coding standard that predates but half overlaps with the 1998 version of <a href="http://www.misra-c.com/Activities/MISRAC/tabid/160/Default.aspx">MISRA-C</a>.</p>
<p><strong>Are There Bugs in Toyota&#8217;s Firmware?</strong></p>
<p>In the NASA Report&#8217;s executive summary it is made clear that &#8220;because proof that the ETCS-i caused the reported UAs was not found does not mean it could not occur.&#8221; (NASA Report, p. 17) The report also states that NASA&#8217;s analysis was time-limited and top-down, remarking &#8220;The Toyota Electronic Throttle Control (ETC) was far more complex than expected involving hundreds of thousands of lines of software code&#8221; and that this <a href="http://www.nhtsa.gov/staticfiles/nvs/pdf/NHTSA-Toyota_peer_review.pdf">affected the quality of a planned peer review</a>.</p>
<p>It&#8217;s stated that &#8220;Reported [Unintended Accelerations (UAs)] are rare events. Typically, the reporting of UAs is about 1/100,000 vehicles/year.&#8221; But there are millions of cars on the road, and so NHTSA has collected some &#8220;831 UA reports for Camry&#8221; alone. &#8220;Over one-half of the reported events described large (greater than 25 degrees) high-throttle opening UAs of unknown cause&#8221; (NASA Report, p. 14), the causes of which are never fully explained in these reports.</p>
<p>The NASA apparently identified some lesser firmware bugs themselves, saying &#8220;[our] logic model verifications identified a number of potential issues. All of these issues involved unrealistic timing delays in the multiprocessing, asynchronous software control flow.&#8221; (Appendix A, p. 11)  NASA also spent time simulating possible <a href="http://embeddedgurus.com/barr-code/2010/02/firmware-specific-bug-1-race-condition/">race conditions</a> due to worrisome &#8220;recursively nested interrupt masking&#8221; (pp, 44-46); note, though, that simulation success is not a sufficient proof of lack of races. As well, the NASA team seems to recommend &#8220;reducing the amount of global data&#8221; (p. 38) and eliminating &#8220;dead code&#8221; (p. 40). </p>
<p>Additionally, the redacted text in other parts of Appendix A seems to be obscuring that:</p>
<ul>
<li>&#8220;<a href="http://gcc.gnu.org/">The standard gcc compiler</a> version 4&#8243; generated a redacted number of warnings (probably larger than 100) about the code, in 11 different warning categories. (p. 25)</li>
<li>&#8220;<a href="http://www.coverity.com/">Coverity</a> version 4.2&#8243; generated a redacted number of warnings (probably larger than 154) about the code, in 10 different warning categories. (p. 27)</li>
<li>&#8220;<a href="http://www.grammatech.com/products/codesonar/">Codesonar</a> version 3.6p1&#8243; generated a redacted number of warnings (probably larger than 136) about the code, in 10 different warning categories.</li>
<li>&#8220;<a href="http://spinroot.com/uno/">Uno</a> version 2.12&#8243; generated a redacted number of warnings (probably larger than 72) about the code, in 9 different warning categories.</li>
<li>The code contained at least 347 deviations from a subset of 14 of the <a href="http://www.misra-c.com/Activities/MISRAC/tabid/160/Default.aspx">MISRA-C rules</a>.</li>
<li>The code contained at least 243 violations of a subset of 9 of the 10 &#8220;<a href="http://spinroot.com/p10">Power of 10&#8211;Rules for Developing Safety Critical Code</a>,&#8221; which was published in IEEE Computer in 2006 by NASA team member Gerard Holzmann.</li>
</ul>
<p>It looks to me like Figure 6.2.3-1 of the NASA Report (p. 30) shows that UA complaints filed with NHTSA increased in the year of introduction of electronic throttle control for the vast majority of Toyota, Scion, and Lexus models&#8211;and that complaint counts have remained higher but generally declined over time since those transitions years. Such a complaint data pattern is perhaps consistent with firmware bugs. (Note to NHTSA: It would be helpful to see this same chart normalized by number of vehicles sold by model year and with the rows sorted by the year of ETC introduction. It would also be nice to see a chart of ETCS-i firmware versions and updates, which vehicles they apply to, and the dates on which each was put into new production vehicles or distributed through dealers.)</p>
<p><strong>Final Thoughts</strong></p>
<p>I am not privy to all of the facts considered by the NHTSA or NASA review teams and thus cannot say if I agree or disagree with their overall conclusion that embedded software bugs are not to blame for reports of unintended acceleration in Toyota vehicles. How about you? If you&#8217;ve spotted something I missed in the reports from NHTSA or NASA, please send me an e-mail or leave a comment below. Let&#8217;s keep the conversation going.</p>
]]></content:encoded>
			<wfw:commentRss>http://embeddedgurus.com/barr-code/2011/03/unintended-acceleration-and-other-embedded-software-bugs/feed/</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
		<item>
		<title>Embedded Software is the Future of Product Quality and Safety</title>
		<link>http://embeddedgurus.com/barr-code/2010/02/embedded-software-is-the-future-of-product-quality-and-safety/</link>
		<comments>http://embeddedgurus.com/barr-code/2010/02/embedded-software-is-the-future-of-product-quality-and-safety/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 18:18:00 +0000</pubDate>
		<dc:creator>Michael Barr</dc:creator>
				<category><![CDATA[embedded]]></category>
		<category><![CDATA[engineering]]></category>
		<category><![CDATA[ethics]]></category>
		<category><![CDATA[safety]]></category>
		<category><![CDATA[trends]]></category>

		<guid isPermaLink="false">http://www.gfcdev.org/test-stack/2010/02/08/embedded-software-is-the-future-of-product-quality-and-safety/</guid>
		<description><![CDATA[Last year a friend had a St. Jude pacemaker attached to his heart. When he reported an unexpected low battery reading (displayed on an associated digital watch) to his doctor a month later, he learned this was the result of a firmware bug known to the manufacturer. The battery was fine and would last on [...]]]></description>
			<content:encoded><![CDATA[<p>Last year a friend had a <a href="http://www.sjmprofessional.com/en/Products/US/Pacing-Systems/Accent-Pacemaker.aspx">St. Jude pacemaker</a> attached to his heart.  When he reported an unexpected low battery reading (displayed on an associated digital watch) to his doctor a month later, he learned this was the result of a firmware bug known to the manufacturer.  The battery was fine and would last on the order of a decade more.  His new-model pacemaker&#8217;s firmware didn&#8217;t include a bug fix that was provided the year before to wearers of old-model.</p>
<p>Another friend owns a <a href="http://www.landroverusa.com/us/en/Vehicles/new-LR2/overview.htm">Land Rover LR2</a> SUV with back-up sensors.  When the car is in reverse and nearing an obstacle or another car, the driver is alerted via a beeping sound.  Except that the back-up sensors don&#8217;t always work.  Some &#8220;reboots&#8221; of the SUV don&#8217;t seem to have this feature enabled.  He suspects there is a &#8220;<a href="http://www.netrino.com/Embedded-Systems/Glossary-R#race_condition">race condition</a>&#8221; during the software startup sequence.</p>
<p>Yet another friend has driven a <a href="http://www.toyota.com/prius-hybrid/">Toyota Prius</a> hybrid over 100,000 miles.  He reports that the brakes very occasionally have an odd/different feel.  But his older model Prius is not expected to be subject to <a href="http://www.huffingtonpost.com/2010/02/08/toyota-recall-prius-hybri_n_453188.html">the 2010 model year recall</a>.</p>
<p>These are just a few of the personal anecdotes behind the headlines.  Embedded software is everywhere now, with <a href="http://www.embeddedgurus.net/barr-code/2008/03/vdc-counts-4-billion-embedded-products.html">over 4 billion new devices manufactured each year</a>.  Increasingly the quality and safety of products is a side-effect of the quality and safety of the software embedded inside.</p>
<p>One important question is, can we trust future software updates any more than we can trust the existing firmware?  How do we know that the Toyota Prius hybrids with upgraded braking firmware will be safer than those with the factory firmware?</p>
]]></content:encoded>
			<wfw:commentRss>http://embeddedgurus.com/barr-code/2010/02/embedded-software-is-the-future-of-product-quality-and-safety/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Embedded Programmers Worldwide Earn Failing Grades in C and C++</title>
		<link>http://embeddedgurus.com/barr-code/2009/11/embedded-programmers-worldwide-earn-failing-grades-in-c-and-c/</link>
		<comments>http://embeddedgurus.com/barr-code/2009/11/embedded-programmers-worldwide-earn-failing-grades-in-c-and-c/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 15:30:00 +0000</pubDate>
		<dc:creator>Michael Barr</dc:creator>
				<category><![CDATA[education]]></category>
		<category><![CDATA[embedded]]></category>
		<category><![CDATA[ethics]]></category>
		<category><![CDATA[outsourcing]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[trends]]></category>

		<guid isPermaLink="false">http://www.gfcdev.org/test-stack/2009/11/24/embedded-programmers-worldwide-earn-failing-grades-in-c-and-c/</guid>
		<description><![CDATA[In industry surveys, over 80% of embedded software developers report using C or C++ as their primary programming language. Yet as a group, these programmers earned a failing grade on a multiple-choice quiz testing firmware-related C programming skills. A scary result, considering that embedded software inside medical devices, industrial controls, anti-lock brakes, and cockpits place [...]]]></description>
			<content:encoded><![CDATA[<p>In industry surveys, <a href="http://i.cmpnet.com/embedded/2009/0709_July2009/0709esdBarr01.gif">over 80% of embedded software developers report using C or C++</a> as their primary programming language.  Yet as a group, these programmers earned a failing grade on a multiple-choice quiz testing firmware-related C programming skills.  A scary result, considering that embedded software inside medical devices, industrial controls, anti-lock brakes, and cockpits place human lives at risk every day.</p>
<p>In a <a href="http://www.embeddedgurus.net/barr-code/2008/02/embedded-c-quiz-results.html">February 2008 blog post</a>, I examined the first few hundred results from the &#8220;<a href="http://www.netrino.com/Embedded-Systems/Embedded-C-Quiz">Embedded C Quiz</a>&#8221; on the <a href="http://www.netrino.com/">Netrino</a> website.  That analysis compared the performance of programmers in the U.S. and India with the rest of the world (the only three data sets large enough for meaningful analysis).  I concluded that the average embedded programmers in the U.S. and India don&#8217;t know C very well, but do know it better than programmers in the rest of the world.</p>
<p>Two years now since launching the quiz, we have collected thousands of data points, so it&#8217;s time for an update on programmer performance.  In total, 3,870 programmers have taken the <a href="http://www.netrino.com/Embedded-Systems/Embedded-C-Quiz">short 10-question multiple-choice C skills test</a>.  A few (a bit less than 3%) didn&#8217;t answer all of the questions; the analysis below is based on just the 3,755 completed quizzes.  (Note that each website user can only take the quiz once.)</p>
<p>Across all countries, the mean result was 60.8%&#8211;a grade of &#8216;D-&#8217; at best.   That is to say that the average embedded programmer answered just 6 out of 10 multiple-choice questions correctly.  A rather scary fact, given that C is the language of choice for most embedded projects and that C++ is even harder to master.</p>
<p>Programmers in the United States scored slightly above average.  But they still earned a failing grade of 61.8%.  Programmers in India scored slightly below the worldwide average, at 58.9%.  Together, programmers from these two large English-speaking countries accounted for the majority of all quiz takers.</p>
<p>The number of completed quizzes, mean scores, and standard deviations for all countries with more than 20 completed quizzes are shown in the table below, sorted by average score.  In general, programmers from European countries scored best.</p>
<table>
<tbody>
<tr>
<td>Country</td>
<td>Completed</td>
<td>Mean</td>
<td>Std Dev</td>
</tr>
<tr>
<td>Poland</td>
<td>23</td>
<td>68.7</td>
<td>19.2</td>
</tr>
<tr>
<td>Sweden</td>
<td>26</td>
<td>67.7</td>
<td>15.8</td>
</tr>
<tr>
<td>Australia</td>
<td>45</td>
<td>67.3</td>
<td>22.3</td>
</tr>
<tr>
<td>Germany</td>
<td>57</td>
<td>67.2</td>
<td>17.2</td>
</tr>
<tr>
<td>France</td>
<td>35</td>
<td>66.9</td>
<td>24.0</td>
</tr>
<tr>
<td>United Kingdom</td>
<td>109</td>
<td>66.1</td>
<td>22.8</td>
</tr>
<tr>
<td>Spain</td>
<td>24</td>
<td>65.0</td>
<td>18.3</td>
</tr>
<tr>
<td>Canada</td>
<td>114</td>
<td>64.5</td>
<td>19.3</td>
</tr>
<tr>
<td>China</td>
<td>51</td>
<td>64.1</td>
<td>23.4</td>
</tr>
<tr>
<td>Israel</td>
<td>22</td>
<td>62.3</td>
<td>21.7</td>
</tr>
<tr>
<td>United States</td>
<td>1346</td>
<td>61.8</td>
<td>20.4</td>
</tr>
<tr>
<td>Egypt</td>
<td>28</td>
<td>59.3</td>
<td>22.8</td>
</tr>
<tr>
<td>India</td>
<td>1288</td>
<td>58.9</td>
<td>22.4</td>
</tr>
<tr>
<td>Romania</td>
<td>45</td>
<td>58.9</td>
<td>23.0</td>
</tr>
<tr>
<td>Singapore</td>
<td>24</td>
<td>58.3</td>
<td>20.1</td>
</tr>
<tr>
<td>Italy</td>
<td>44</td>
<td>56.4</td>
<td>20.8</td>
</tr>
<tr>
<td>Turkey</td>
<td>57</td>
<td>55.6</td>
<td>23.3</td>
</tr>
<tr>
<td>Brazil</td>
<td>47</td>
<td>55.1</td>
<td>24.1</td>
</tr>
<tr>
<td>Pakistan</td>
<td>25</td>
<td>44.0</td>
<td>21.7</td>
</tr>
</tbody>
</table>
<p>How are your embedded C programming skills?  Test them by taking the Embedded C Quiz yourself now at <a href="http://www.netrino.com/Embedded-Systems/Embedded-C-Quiz">http://www.netrino.com/Embedded-Systems/Embedded-C-Quiz</a>?</p>
<p>P.S. &nbsp;We recently launched an <a href="http://www.netrino.com/Embedded-Systems/Embedded-C++-Quiz">Embedded C++ Quiz</a> and the results so far look downright abysmal. &nbsp;I&#8217;ll write something about that in a future post. &nbsp;Do you have a few minutes to <a href="http://www.netrino.com/Embedded-Systems/Embedded-C++-Quiz">take that one too</a>?</p>
]]></content:encoded>
			<wfw:commentRss>http://embeddedgurus.com/barr-code/2009/11/embedded-programmers-worldwide-earn-failing-grades-in-c-and-c/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Breathalyzer Source Code Analysis</title>
		<link>http://embeddedgurus.com/barr-code/2009/11/breathalyzer-source-code-analysis/</link>
		<comments>http://embeddedgurus.com/barr-code/2009/11/breathalyzer-source-code-analysis/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 21:59:00 +0000</pubDate>
		<dc:creator>Michael Barr</dc:creator>
				<category><![CDATA[embedded]]></category>
		<category><![CDATA[ethics]]></category>
		<category><![CDATA[safety]]></category>
		<category><![CDATA[trends]]></category>

		<guid isPermaLink="false">http://www.gfcdev.org/test-stack/2009/11/05/breathalyzer-source-code-analysis/</guid>
		<description><![CDATA[Firmware bugs seem to be everywhere these days. So much so that firmware source code analysis is even entering the courtroom in criminal cases involving data collection devices with software inside. Consider the precedent-setting case of the Alcotest 7110. After a two-year legal fight, seven defendants in New Jersey DUI cases successfully won the right [...]]]></description>
			<content:encoded><![CDATA[<p>Firmware bugs seem to be everywhere these days.  So much so that firmware source code analysis is even entering the courtroom in criminal cases involving data collection devices with software inside.  Consider the precedent-setting case of the Alcotest 7110.  After a two-year legal fight, <a href="http://www.dwi.com/new-jersey/state-v-chun">seven defendants in New Jersey DUI cases</a> successfully won the right to have their experts review the source code for the Alcotest firmware.</p>
<p>The state and the defendants both ultimately produced expert reports evaluating the quality of the firmware source code.  Though each side’s experts reached divergent opinions as to the overall code quality, several facts seem to have emerged as a result of the analysis:</p>
<p>- Of the available 12-bits of A/D precision, just 4-bits (most-significant) are used in the actual calculation.  This sorts each raw blood-alcohol reading into one of 16 buckets.  (I wonder how they biased the rounding on that.)<br />- Out of range A/D readings are forced to the high or low limit.  This must happen with at least 32 consecutive readings before any flags are raised.<br />- There is no feedback mechanism for the software to ensure that actuated devices, such as an air pump and infrared sensor, are actually on or off when they are supposed to be.<br />- The software first averages the initial two readings.  Then it averages the third reading with that average.  Then the fourth reading is averaged in, etc.  No comments or documentation explains the use of this formula, which causes the final reading to have a weight of 0.5 in the final value and the one before that to have a weight of 0.25, etc.<br />- Out of range averages are forced to the high or low limit too.<br />- Static analysis with <a href="http://www.gimpel.com">lint</a> produced over 19,000 warnings about the code (that’s about three errors for ever five lines of source code).</p>
<p>What would you infer about the reliability of a defendant’s blood-alcohol level if you were on that jury?  If you’re so inclined you can read the full expert reports for yourself: at <a href="http://www.dwi.com/new-jersey/base-one-findings">defendants</a> and <a href="http://www.dwi.com/new-jersey/new-jersey/code-review">state</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://embeddedgurus.com/barr-code/2009/11/breathalyzer-source-code-analysis/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>This Code Stinks! The Worst Embedded Code Ever</title>
		<link>http://embeddedgurus.com/barr-code/2009/11/this-code-stinks-the-worst-embedded-code-ever/</link>
		<comments>http://embeddedgurus.com/barr-code/2009/11/this-code-stinks-the-worst-embedded-code-ever/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 16:19:00 +0000</pubDate>
		<dc:creator>Michael Barr</dc:creator>
				<category><![CDATA[education]]></category>
		<category><![CDATA[embedded]]></category>
		<category><![CDATA[ethics]]></category>
		<category><![CDATA[safety]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[standards]]></category>

		<guid isPermaLink="false">http://www.gfcdev.org/test-stack/2009/11/05/this-code-stinks-the-worst-embedded-code-ever/</guid>
		<description><![CDATA[At the Embedded Systems Conference Boston in September, I gave a popular ESC Theater talk titled “This Code Stinks! The Worst Embedded Code Ever” that used lousy code from real products as a teaching tool. The example code was gathered by a number of engineers from a broad swath of companies over several years. (Minor [...]]]></description>
			<content:encoded><![CDATA[<p>At the <a href="http://www.esconline.com">Embedded Systems Conference Boston</a> in September, I gave a popular ESC Theater talk titled “This Code Stinks!  The Worst Embedded Code Ever” that used lousy code from real products as a teaching tool.  The example code was gathered by a number of engineers from a broad swath of companies over several years.  (Minor details, including variable names and function names, were changed as needed to hide the specifics of applications, companies, or programmers.)</p>
<p>Here’s just one example of the bad code in that presentation:<br /><code><br />y = (x + 305) / 146097 * 400 + (x + 305) % 146097 / 36524 * 100 + (x + 305) % 146097 % 36524 / 1461 * 4 + (x + 305) % 146097 % 36524 % 1461 / 365;<br /></code><br />I don’t know if the above snippet contains any bugs, as most of the other examples were found to.  And that’s a problem.  Where are we supposed to begin an analysis of the above?  What is this code supposed to do when it works?  What range of input values is appropriate to test?  What are the correct output values for a given input?  Is this code responsible for handling out of range inputs gracefully?  In the original listing, there were no comments on or around this line to help.</p>
<p>I eventually learned that this code computes the year, with accounting for extra days in leap years, given the number of days since a known reference date (e.g., January 1, 1970).  But I note that we still don’t know if it works in all cases; despite it being present in an <a href="http://www.fda.gov">FDA</a>-regulated medical device.  I note too that the <a href="http://bit.ly/39Ubz8">Microsoft Zune Bug</a> was buried in a much better formatted snippet of code that performed a very similar calculation. </p>
<p>Here’s another example, this time in C++, with the bug finding left as an exercise for the reader:<br /><code><br />bool Probe::getParam(uint32_t param_id, int32_t idx)<br />{<br />int32_t  val  = 0;<br />int32_t  ret  = 0;</p>
<p>ret = m_pParam-&gt;readParam(param_id, idx, &amp;val);</p>
<p>if (!ret)<br />{<br />logMsg(“attempt to read parameter failed\n”);<br />exit(1);<br />}<br />else …<br /></code><br />Hint: This code was embedded in a piece of factory automation equipment.</p>
<p>I&#8217;ve placed the full set of slides online at <a href="http://bit.ly/badcode">http://bit.ly/badcode</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://embeddedgurus.com/barr-code/2009/11/this-code-stinks-the-worst-embedded-code-ever/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Firmware Disasters</title>
		<link>http://embeddedgurus.com/barr-code/2009/06/firmware-disasters/</link>
		<comments>http://embeddedgurus.com/barr-code/2009/06/firmware-disasters/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 11:00:00 +0000</pubDate>
		<dc:creator>Michael Barr</dc:creator>
				<category><![CDATA[embedded]]></category>
		<category><![CDATA[ethics]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[safety]]></category>
		<category><![CDATA[trends]]></category>

		<guid isPermaLink="false">http://www.gfcdev.org/test-stack/2009/06/23/firmware-disasters/</guid>
		<description><![CDATA[First, an Airbus A330 fell out of the sky. Then two D.C. Metro trains collided. Several hundred people have been killed and injured in these disastrous system failures. Did bugs in embedded software play a role in either or both disasters? An incident on an earlier (October 2006) Airbus A330 flight may offer clues to [...]]]></description>
			<content:encoded><![CDATA[<p>First, an Airbus A330 fell out of the sky.  Then two D.C. Metro trains collided.  Several hundred people have been killed and injured in these disastrous system failures.  Did bugs in embedded software play a role in either or both disasters?</p>
<p>An incident on an earlier (October 2006) Airbus A330 flight may offer clues to the crash of Air France 447:</p>
<blockquote><p>Qantas Flight 72 had been airborne for three hours, flying uneventfully on autopilot from Singapore to Perth, Australia. But as the in-flight dinner service wrapped up, the aircraft&#8217;s flight-control computer went crazy. The plane abruptly entered a smooth 650-ft. dive (which the crew sensed was not being caused by turbulence) that sent dozens of people smashing into the airplane&#8217;s luggage bins and ceiling. More than 100 of the 300 people on board were hurt, with broken bones, neck and spinal injuries, and severe lacerations splattering blood throughout the cabin.  (<a href="http://www.time.com/time/world/article/0,8599,1902421,00.html">Article, Time Magazine, June 3, 2009</a>)</p></blockquote>
<p>Authorities have blamed a pair of simultaneous computer failures for that event in the fly-by-wire A330.  First, one of three redundant air data inertial reference units (ADIRUs) began giving bad angle of attack (AOA) data.  Simultaneously, a voting algorithm intended to handle precisely such a failure in 1 of the 3 units by relying only on the other matching data failed to work as designed; the flight computer instead made decisions only on the basis of the one failed ADIRU!</p>
<p>(A later analysis by Airbus &#8220;found data fingerprints suggesting similar ADIRU problems had occurred on a total of four flights. One of the earlier instances, in fact, included a September 2006 event on the same [equipment] that entered the uncommanded dive in October [2006].&#8221;  Ibid.)</p>
<p>Much of the attention in the publicly disclosed details of the Air France 447 crash has focused on the failure of one of several air speed indicators.  Were there three of those as well?  If so, was the same flight computer to blame for failing to recognize which to trust and which was unreliable?</p>
<p>It is very early in the investigation of yesterday&#8217;s collision between two D.C. Metro red line trains, in which a stopped train was rear-ended and heavily damaged by a moving train on the same track, to place blame.  But a  WashingtonPost.com article headlined &#8220;Collision was Supposed to be Impossible&#8221; says it all:</p>
<blockquote><p>Metro was designed with a fail-safe computerized signal system that is supposed to prevent trains from colliding.</p></blockquote>
<p>and </p>
<blockquote><p>During morning and afternoon rush hours, all trains except longer eight-car trains typically operate in automatic mode, meaning their movements are controlled by computerized systems and the central Operations Control Center. Both trains in yesterday&#8217;s crash [about 5pm] were six-car trains. (<a href="http://www.washingtonpost.com/wp-dyn/content/article/2009/06/23/AR2009062300653.html?hpid=topnews">Article, Washington Post, June 23, 2009</a>)</p></blockquote>
<p>Are bugs in embedded software to blame for these two disasters?  You can bet the lawyers are already looking into it.</p>
]]></content:encoded>
			<wfw:commentRss>http://embeddedgurus.com/barr-code/2009/06/firmware-disasters/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Resume Inflation</title>
		<link>http://embeddedgurus.com/barr-code/2009/01/resume-inflation/</link>
		<comments>http://embeddedgurus.com/barr-code/2009/01/resume-inflation/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 21:00:00 +0000</pubDate>
		<dc:creator>Michael Barr</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[education]]></category>
		<category><![CDATA[embedded]]></category>
		<category><![CDATA[ethics]]></category>
		<category><![CDATA[trends]]></category>

		<guid isPermaLink="false">http://www.gfcdev.org/test-stack/2009/01/14/resume-inflation/</guid>
		<description><![CDATA[Like many companies, Netrino is perpetually interviewing candidates for software engineering positions. However, since our work is primarily in the area of embedded systems design we tend to meet many software candidates who come originally from electrical engineering backgrounds. Among this group of candidates there is a prevalent bias toward a kind of resume inflation, [...]]]></description>
			<content:encoded><![CDATA[<p>Like many companies, <a href="http://www.netrino.com">Netrino</a> is perpetually interviewing candidates for software engineering positions.  However, since our work is primarily in the area of embedded systems design we tend to meet many software candidates who come originally from electrical engineering backgrounds.  Among this group of candidates there is a prevalent bias toward a kind of resume inflation, in the technical skills section.</p>
<p>Almost all of the resumes we receive for firmware engineering positions contain one of the strings &#8220;C, C++&#8221; or &#8220;C/C++&#8221; at or near the front of a longer list of programming language skills (e.g., &#8220;C/C++, Fortran, Assembly (various), Forth&#8221;).  C is generally at the front of that language list for good reason&#8211;because it is the one programming language with which the candidate has the most hands-on experience.  Too often, though, our interviews have revealed that C++ is listed second for no good reason.</p>
<p>C and C++ are fundamentally different languages.  Many of these &#8220;resume inflation&#8221; job candidates don&#8217;t even realize that C++ is as different as it is from C.  Often, their actual experience with C++ turns out to be that they&#8217;ve used C++ compilers to build C programs.  And when they really have used C++, their practical experience usually ends at the use of classes.</p>
<p>Object-oriented C++ has three important aspects: encapsulation, inheritance, and polymorphism.  Mere use of encapsulation is insufficient to claim you have C++ programming skills.  When we include C++ in a <a href="http://www.netrino.com/Embedded-Systems/Embedded-Software-Jobs">job listing</a> it is because the work may involve the use of every part of C++.  To get the job, you must be knowledgeable in all of C++.</p>
<p>What can you do if you are submitting your resume and know some C++ rather than a lot?  Be clear and humble.  If you merely worked with C++ in school or on a single project, list it in a separate section.  Or put C++ apart from C in your language list.</p>
<p>Interviewers (as well as resume reviewers) are impressed by modesty and clear communication.</p>
]]></content:encoded>
			<wfw:commentRss>http://embeddedgurus.com/barr-code/2009/01/resume-inflation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programming as Profession</title>
		<link>http://embeddedgurus.com/barr-code/2009/01/programming-as-profession/</link>
		<comments>http://embeddedgurus.com/barr-code/2009/01/programming-as-profession/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 15:31:00 +0000</pubDate>
		<dc:creator>Michael Barr</dc:creator>
				<category><![CDATA[education]]></category>
		<category><![CDATA[embedded]]></category>
		<category><![CDATA[engineering]]></category>
		<category><![CDATA[ethics]]></category>
		<category><![CDATA[safety]]></category>
		<category><![CDATA[standards]]></category>

		<guid isPermaLink="false">http://www.gfcdev.org/test-stack/2009/01/14/programming-as-profession/</guid>
		<description><![CDATA[Doing my daily reading around the embedded systems press, I happened across this gem in an article by Jim Turley: Programming is often treated as a creative endeavor, undertaken by spirited and talented artistes who cannot or should not be shackled to convention, regulations, or reasonable hygiene. Get over it. Programming is a job like [...]]]></description>
			<content:encoded><![CDATA[<p>Doing my daily reading around the embedded systems press, I happened across this gem <a href="http://www.embeddedtechjournal.com/articles_2009/20090113_coverity.htm">in an article by Jim Turley</a>:</p>
<blockquote><p>Programming is often treated as a creative endeavor, undertaken by spirited and talented <span style="font-style:italic">artistes</span> who cannot or should not be shackled to convention, regulations, or reasonable hygiene. Get over it. Programming is a job like any other, and an employer’s responsibility is to ship a profitable product, not coddle and babysit self-indulgent hackers.</p></blockquote>
<p>I couldn&#8217;t agree with Jim more.  It is especially unfortunate when a lack of professionalism shows itself in the realm of embedded systems, such as medical devices, that put human lives at risk.  I regret to inform the reader that from <a href="http://www.netrino.com">Netrino</a>&#8216;s vantage point as consultants we see everyday the train wreck that results from poorly managed and unprofessional programmers working in the embedded systems space.</p>
<p>You need a license from the state to to be a barber.  To write embedded software, you simply need to be able to spell &#8216;C&#8217;.  But I&#8217;m on a mission to change that.</p>
]]></content:encoded>
			<wfw:commentRss>http://embeddedgurus.com/barr-code/2009/01/programming-as-profession/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

