TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Why is code from chip manufacturers of such a low standard?

4 pointsby sorisosabout 5 years ago
I have had the unfortunate to work with a lot of C code from chip manufacturers such as ST, Microchip(Atmel), Bosch, Semtech. More often then not the code quality is rather low[0], sometimes even embarrassing. Perhaps I am just unlucky and only seen the bad parts, but it seems like a good business plan to provide a decent driver&#x2F;library before spending a single dollar on marketing? Or at a minimum, have a experienced programmer review what is released as &quot;official&quot; to avoid shaming the company name.<p>Can anyone explain this?<p>[0] To avoid offending anyone I do not want to link repos, but here are some examples of &quot;low code quality&quot;:<p>- Libraries that looks like internal test code renamed and pushed to github.<p>- Using bit-fields for registers. Well, it will probably work even though it is implementation defined. It is however a strong indicator the programmer(s) are relative new to C which manifest itself in all kinds of other issues.

1 comment

joezydecoabout 5 years ago
<i>Can anyone explain this?</i><p>Are you asking if companies make bad reference code a deliberate part of their product? I don&#x27;t think any company will admit to that if it was their plan.<p>I&#x27;ve seen just as much bad code as you - probably more. My observations come down to this:<p>1) It&#x27;s <i>reference code</i> and labelled as such, so there&#x27;s no warranty and thus no investment in making the code look good, follow any standard, or even be readable. If it works, that&#x27;s enough. 150 out of 150 unit tests pass? End of story. Complaining to your FSE will get you either a shrug or a quote from their contact engineering arm. Better FSEs at better companies will try to get to the original author and ask them what the hell is up.<p>2) The code is written by the hardware engineers writing the Verilog and designing other parts of the chip. Sometimes they&#x27;re using it to validate the part and sometimes they&#x27;re recruited to write the reference code and sometimes it&#x27;s both but, in all cases, they&#x27;re typically not software engineers.<p>3) The code is shopped out to contract software engineers in far away time zones because of cost. Any companion software has a non-zero cost which means it has to be paid for in the price of the chip sooner or later. There&#x27;s a strong drive to keep that cost down, obviously.<p>I get your frustration and it would be nice if you could port reference drivers into your project in two clicks and then get back to finishing your sprint. I feel fortunate if there&#x27;s <i>anything</i> I can read alongside the datasheet.<p>I could mention companies that I think do better than others, but that will probably attract a flurry of counterexamples. From my POV it&#x27;s just part of the job.
评论 #23245501 未加载