EmbeddedRelated.com
Forums

Software Reuse In Embedded code

Started by steve June 15, 2011
Hi Walter,

On 6/23/2011 7:17 AM, Walter Banks wrote:

>>> Your first mistake is thinking you live in a democracy ... you don't >>> (no matter where you live). I can't think of a single nation that >>> actually is a democracy. >> >> Switzerland comes closer than most - they hold regular public >> referendums on major issues rather than letting them be decided by the >> representatives. > > I lived in NH for about 3 years. Local annual town hall meetings > involved most folks in making decisions and policy that affected the > community.
Town Hall governments are common in new england. I think its more of a "down home" approach to things. Of course, some things required "real" votes -- bind issues, etc. But, "should the police department have funds to purchase new radios for their squad cars" was decided by a show of hands... (though I don't recall anyone checking residency on entrance to the meeting hall! :> )
On Thu, 23 Jun 2011 10:27:54 -0400, Walter Banks
<walter@bytecraft.com> wrote:

>The alternative is copyrights to protect software. The GNU GENERAL >PUBLIC LICENSE >http://www.gnu.org/licenses/gpl.html has done a lot to promote >copyright as a primary means of software protection. From an industrial >point of view software patents are preferable to copyrights, they have >shorter life and do put technology in the public domain at the end of their life. >Copyrights have traditionally been harder to defend but FSF has given >us many case precedents that can now be used.
I don''t want to start a war here ... there are other forums for debating the merits of GPL ... but the current v3 GPL contains quite a lot of disincentive for a business to use it. There are *more* open licenses such as BSD, MIT, etc. that can protect the author's rights without unduly limiting business practices. GPL v1 & v2 were not too objectionable, but there has been a general backlash against GPL v3. It's largest failure to date has been Linus Torvald's categorical refusal to put Linux under v3. IMO, a lot of people who have embraced GPL have done so in a reactionary way and haven't really understood the implications of the various versions. Solely from a legal standpoint, I don't see how any business could choose to include v3 GPL'd software in a saleable product. [Internal use of GPL'd software is a different issue]. George
Hi George,

On 6/23/2011 12:01 PM, George Neuner wrote:

[snip]

> ... There are *more* open > licenses such as BSD, MIT, etc. that can protect the author's rights > without unduly limiting business practices.
[snip]
> IMO, a lot of people who have embraced GPL have done so in a > reactionary way and haven't really understood the implications of the > various versions. Solely from a legal standpoint, I don't see how any > business could choose to include v3 GPL'd software in a saleable > product. [Internal use of GPL'd software is a different issue].
+42 If you want to encourage innovation, then don't put silly obstacles in the way that others have to waste time working around. (e.g., writing your own standard libraries just to get around GPLL). If I mention open source to a client as a possible short-circuit for some portion of the project, the first thing out of their mouth is "We don't want to use Linux". *Period* (i.e., drop this line of discussion or we'll find someone else who'll meet our goals). They equate OSS with Linux and, thus, the GPL and rule everything out in one fell swoop. The products that *do* include GPL'd software all seem to violate at least the *spirit* of the license. Few companies make it easy to get a hold of the sources that they are supposed to make available under the license. Some go belly-up -- or are bought out (and "magically" released from their license obligations?). Others comply only with the *letter* of the license. "Here's a CD with the source code on it. *You* figure out how to unpack it, set up the build environment, etc. We don't *support* it..." If you *really* want to encourage your software to be used and improved upon, let people use it "unencumbered". Sure, you can protect *your* rights to keep using it as your own "property" (lest someone claim you are infringing *their* copyright) but there's no real point in forcing them to pass *their* improvements on to others as a condition for using "your" software. They'll just reinvent what you've done (probably better -- since they can still EXAMINE yours) and lock it up under their own closed copyright/TS anyway! If your ego is so fragile that you need to see your name *somewhere* credited with the creation of "some part of this product", then put a clause to that effect in the license. Chances are, no one other than the developers will ever see it anyway! :-/ Forcing people to give away their IP is just as bad as letting them lock you out of using it!
On Thu, 23 Jun 2011 10:17:28 -0400, Walter Banks
<walter@bytecraft.com> wrote:

>David Brown wrote: > >> > Your first mistake is thinking you live in a democracy ... you don't >> > (no matter where you live). I can't think of a single nation that >> > actually is a democracy. >> >> Switzerland comes closer than most - they hold regular public >> referendums on major issues rather than letting them be decided by the >> representatives. > >I lived in NH for about 3 years. Local annual town hall meetings >involved most folks in making decisions and policy that affected the >community.
The open town meeting is about as close to democracy as the US gets. But it is purely a local system and not all states embrace it. I live next door in Massachusetts. In my town we have representative town meetings in which the general public cannot participate. Each town district elects one or more "town meeting members" who are purported to represent their district's interests. [There are also open meeting towns in MA ... just not where I live.] George
On 23/06/11 16:27, Walter Banks wrote:
> > > David Brown wrote: > >>> The whole issue of IP protection is to create an incentive for people >>> and companies to risk a disproportionate amount of resources to >>> the potential individual gain in the development of new ideas. A large >>> percentage of these developments never produce enough revenue >>> to pay development costs. Something is needed to to protect the >>> ideas that are truly unique and useful. Real technical innovation has >>> slowed down a lot in the last decade. >>> >> >> Oh, I agree on the principle behind the original aim of patents - it's a >> good idea to have a system that rewards innovation, inventiveness and >> people willing to take risks for a good idea. It was designed to allow >> small inventors to have a good idea and let big manufacturers >> mass-produce the inventions for the public good, while letting the >> inventor get a solid share of the profits. >> >> The trouble is that the modern patent system, especially in more modern >> areas like software, simply does not do that. It fails in almost every >> conceivable way, and is a very big reason why technical innovation has >> slowed down. When technical companies spend more on lawyers than on >> engineers, the system is unrecoverably broken. > > The alternative is copyrights to protect software. The GNU GENERAL > PUBLIC LICENSE > http://www.gnu.org/licenses/gpl.html has done a lot to promote > copyright as a primary means of software protection. From an industrial > point of view software patents are preferable to copyrights, they have > shorter life and do put technology in the public domain at the end of their life. > Copyrights have traditionally been harder to defend but FSF has given > us many case precedents that can now be used. >
Copyrights and patents have different strengths and weaknesses. It is correct that patents are theoretically short-term - but in most of the software world (embedded is a little slower), 20 years is for ever. If software patents were to be of any use without being the huge hinder they are today, they should last about 3 years. Copyrights are too long - you can blame the USA and their Mickey Mouse laws here. But patents are an attempt to gain control of an idea and a way of solving a problem - this makes them much wider than copyrights, which only cover a particular expression of an idea. So copyright is the best tool to protect a program - with copyrights and no patents, you can duplicate the workings of someone else's program as long as you write it yourself. Software patents are only good from the viewpoint of a company which has got a large collection of patents and an army of lawyers to sue people. This is true regardless of whether the company is just a patent troll, or is a truly inventive and productive company that is just trying to protect itself from others. In my mind, that is not an "industrial point of view". When I write code for my company, my company owns the copyright. That means other people can't take our code and use it without our express permission. If they want something that works the same way, and don't want to pay us for it, they can do the work themselves. We get this protection automatically for no cost, without having to pay lawyers or pay bureaucratic fees. We don't have to publish or reveal the code or anything else to get that protection. We do have to pay lawyers if we want to sue someone for breaking our copyright - but the infringer must pay us for those legal fees as well as any damages. From an "industrial point of view", it doesn't get any better than that.
On 23/06/11 21:01, George Neuner wrote:
> On Thu, 23 Jun 2011 10:27:54 -0400, Walter Banks > <walter@bytecraft.com> wrote: > >> The alternative is copyrights to protect software. The GNU GENERAL >> PUBLIC LICENSE >> http://www.gnu.org/licenses/gpl.html has done a lot to promote >> copyright as a primary means of software protection. From an industrial >> point of view software patents are preferable to copyrights, they have >> shorter life and do put technology in the public domain at the end of their life. >> Copyrights have traditionally been harder to defend but FSF has given >> us many case precedents that can now be used. > > I don''t want to start a war here ... there are other forums for > debating the merits of GPL ... but the current v3 GPL contains quite a > lot of disincentive for a business to use it. There are *more* open > licenses such as BSD, MIT, etc. that can protect the author's rights > without unduly limiting business practices. > > GPL v1& v2 were not too objectionable, but there has been a general > backlash against GPL v3. It's largest failure to date has been Linus > Torvald's categorical refusal to put Linux under v3. >
The GPL definitely has its strong points and its weak points, and is suitable for some types of software but not others. The GPL v3 changes the balance slightly compared to the GPL v2. As far as Linux goes, Linus Torvalds is very much a pragmatist. When publishing Linux, he felt the GPL v2 expressed what he wanted in a license, so he used it. Since the GPL v2 did the job, he explicitly limited Linux to the GPL v2 (standard GPL's allow the the code to be re-licensed under newer versions). Having made that decision early on, it was fixed. Linus is not in the position to change it now - that would require the permission of every contributor to Linux over the years (or the removal of their code). So when the question of putting Linux under the GPL v3 came up, he made it barely bothered discussing something that was clearly impossible (and that he didn't agree with anyway). BSD and other open source licenses licences provide a different balance between the rights and freedoms of the code authors, other developers, and end users. If you think these are "more open" than the GPL, then you don't understand the GPL or the BSD - they are "differently open". In particular, they give more freedoms to other developers who want to incorporate the code with their own code - but reduce the rights and protection of the original author. Different balances for different purposes - it is important to have a range of licenses.
> IMO, a lot of people who have embraced GPL have done so in a > reactionary way and haven't really understood the implications of the > various versions. Solely from a legal standpoint, I don't see how any > business could choose to include v3 GPL'd software in a saleable > product. [Internal use of GPL'd software is a different issue]. >
I too would prefer the GPL v2 license (as used by Linux) - but I can see benefits in the GPL v3 as well. But I certainly agree that a lot of people have used the GPL without understanding it - it is very common to equate "open source" and "free software" with the GPL, and a lot of code is released under the GPL (no version specified) because "I want other people to be able to use my code as they wish". In particular, you can find plenty of example code and libraries for embedded systems under the GPL, even though the author is quite happy for you to use the code in your own systems with any other license.
On 23/06/11 21:23, Don Y wrote:
> Hi George, > > On 6/23/2011 12:01 PM, George Neuner wrote: > > [snip] > >> ... There are *more* open >> licenses such as BSD, MIT, etc. that can protect the author's rights >> without unduly limiting business practices. > > [snip] > >> IMO, a lot of people who have embraced GPL have done so in a >> reactionary way and haven't really understood the implications of the >> various versions. Solely from a legal standpoint, I don't see how any >> business could choose to include v3 GPL'd software in a saleable >> product. [Internal use of GPL'd software is a different issue]. > > +42 > > If you want to encourage innovation, then don't put silly > obstacles in the way that others have to waste time > working around. (e.g., writing your own standard libraries > just to get around GPLL). >
I agree with this - the GPL is (normally) a poor choice of licence for a library. But it's a perfectly good choice for an end-user product (assuming you want to give out the source code, of course).
> If I mention open source to a client as a possible short-circuit > for some portion of the project, the first thing out of their > mouth is "We don't want to use Linux". *Period* (i.e., drop > this line of discussion or we'll find someone else who'll > meet our goals). They equate OSS with Linux and, thus, the GPL > and rule everything out in one fell swoop. >
That's clearly a client who doesn't know what open source means, and I would be very careful about a client with such vigorous opinions about licensing that they don't understand. Make sure you have very clear and tight contracts before working with such people - they are likely to believe they have more rights to the work you do for them than they should have.
> The products that *do* include GPL'd software all seem to violate > at least the *spirit* of the license. Few companies make it easy > to get a hold of the sources that they are supposed to make available > under the license. Some go belly-up -- or are bought out (and > "magically" released from their license obligations?). Others > comply only with the *letter* of the license. "Here's a CD > with the source code on it. *You* figure out how to unpack it, > set up the build environment, etc. We don't *support* it..." >
There is definitely a fair amount of that going on - there is the full spectrum of attitudes from keeping everything as secret as they can (legally or illegally) to being fully open and encouraging tinkering. The majority of embedded systems using GPL'ed software probably fall into the "we'll give you a CD of the source code if you ask us" category. But is that the fault of the GPL, or of people who publish code under the GPL? Should the busybox author have released his code under the BSD to allow companies to modify it and use it, then keep the improvements secret from their users? Or is it the fault of the abusing companies who took this substantial code for free, and ignored the license? How would you feel if you had written the code and charged for licenses, and someone had then based their products around your code without paying you your dues? It is exactly the same thing. Programmers are under no obligation to write code to a license that /you/ find easier to use for free in your money-making products! It is certainly /nice/ when programmers use a license that lets you use their code without giving away your own code. I like the MPL-style licence, or the "GPL with exceptions" licenses such as used by FreeRTOS. I think that is a good compromise license in many cases, especially for software in embedded systems. But whether you like it or not, a lot of software has a GPL licence. The terms are not that bad - they are much less restrictive than in many commercial licences (even when you exclude all mention of costs). If you don't like it, get your software from some other source - just as you would with any other software under any other licence. It's no different.
> If you *really* want to encourage your software to be used > and improved upon, let people use it "unencumbered". Sure, > you can protect *your* rights to keep using it as your own > "property" (lest someone claim you are infringing *their* > copyright) but there's no real point in forcing them to pass > *their* improvements on to others as a condition for using > "your" software. They'll just reinvent what you've done > (probably better -- since they can still EXAMINE yours) and > lock it up under their own closed copyright/TS anyway! > > If your ego is so fragile that you need to see your name > *somewhere* credited with the creation of "some part of > this product", then put a clause to that effect in the license. > Chances are, no one other than the developers will ever see > it anyway! :-/ > > Forcing people to give away their IP is just as bad as > letting them lock you out of using it!
On 23/06/11 18:32, Walter Banks wrote:
> > > Hans-Bernhard Br&#4294967295;ker wrote: > >> On 22.06.2011 11:10, Walter Banks wrote: >> >>> Frivolous software patents are essentially a self correcting problem. >> >> If only. >> >>> They have a limited life >> >> ... which, compared to the usual speed of developments in this field of >> work we're in, is actually effectively infinite. Just about _nothing_ >> in this industry lasts anywhere as long as patents. > > I would have agreed with you 20 years ago. Most of the frivolous > patents were being filed about then. A surprisingly large amount of the > current software actually is 20 or more years old. If for example GNU > had been patented it would be in the public domain by now as it is > it is protected by copyright and is years away from being in the > public domain. > > New ideas in software development are getting rare which is why > real breakthroughs should be commercially protected. >
You've got that totally backwards. It is correct that new ideas in software development are getting rare - most of the ideas that were truly novel and inspired, and could arguably justify getting patents, were developed 20 years ago (actually, most of the important stuff was 30, 40 or more years ago). However, the rate of filings for software patents keeps growing. The obvious conclusion is that a higher and higher percentage, and absolute number, are totally frivolous. Microsoft (they are not alone, but they are a good example who are often in the news) used to try to take patents on every idea they had, or bought in, or "acquired" in some way. But they now have a new technique - they are trying to look at what ideas are currently in use but haven't been patented, regardless of whose ideas they were, and take patents on them. They are also trying to get patents on things that might some day be of use to someone - regardless of whether the technique is useful or even possible.
On 23/06/11 17:33, Hans-Bernhard Br&#4294967295;ker wrote:
> On 22.06.2011 11:10, Walter Banks wrote: > >> Frivolous software patents are essentially a self correcting problem. > > If only. > >> They have a limited life > > ... which, compared to the usual speed of developments in this field of > work we're in, is actually effectively infinite. Just about _nothing_ in > this industry lasts anywhere as long as patents. > >> The whole issue of IP protection is to create an incentive for people >> and companies to risk a disproportionate amount of resources to >> the potential individual gain in the development of new ideas. > > That's the next problem with patenting software: for (pure) software > work, that amount of resources is vanishingly small. The idea behing > patents was to enable inventors to set up a production plant and produce > the product themselves for a significant time (and thus, earnings) > before anyone else gets a right to do the same thing for free.
That's only partially correct. The idea behind patents was that the inventor would not have to set up a production plant - existing manufacturers would do the production. That's why patents require public disclosure - so that other manufacturers could see the details of the invention, and build on it. The point of the patent was that the manufacturers would them have to pay a reasonable fee to the inventor. The idea was that the product could be mass produced and be of benefit to the public at large without having to wait for the inventor to set up production facilities himself.
> Getting > software to market once you have it in a shape that could, conceivably, > be worthy of a patent, costs essentially nothing in comparison. > > But the biggest flaw in the patent system, as applied to software, is > that it is applied completely unjustly: if your work is pure software, > you can _not_ get a patent yourself, but you're still supposed to pay > others for theirs. Around here the relevant wording in the patent law is > almost uncharacteristically clear and concise: "Software as such is > un-patentable". They forgot to add ", nor can software as such be > required a licence to use a patented method". >
That's an interesting viewpoint - I don't think I've heard it expressed like that before.
> Getting patents was always supposed to be a race among equals: the first > to make it to the patent office with a valid application wins. Everybody > else pays him. But it's utterly perverse to expect people who never even > had a chance to participate in the race to participate in paying the prize. > > Among the perversions this has created are physical devices created and > patented for no other purpose but to smuggle a software patent into the > system.
On 23/06/2011 03:35, steve wrote:
>> Looking "under the hood" of so-called commercial libraries, I'm >> > terrified - the standard of coding from so-called expert houses is >> > appalling. > Appalling or just difference of style, organization, and/or > unfamilarity?
All of the above, sure. But (putting style etc aside) ultimately lack of robustness, and just plain old bugliness.
> You never been bitten with problems in your code?
Sure. But these days they tend to be typos, rather than car crashes.
> Code magically gets better just by studing it, it seems. Complexity > can can only be reduced so much, and algorithms being coded are > usually complex, so it's has to be studied to be appreciated. People > tend to recode a rat's nest of code only to produce another rat's > nest, but it's their familar rat's nest so it seems better.
Ah, now there I disagree strongly. I write code to be clear and obviously correct (hint: state machines; table-driven code; no globals; OOP design ethics in C). I like to be able to understand my own code at the very least ;). (Today's cock-up was because I'm working on a multi-build family; lots of conditional compilation. Turned out that the reason a particular state machine wasn't getting maintained was because I'd told it not to with the current build... d'oh!) There's certainly an art to decomposing complexity into a collection of simple things (I'm not entirely sure it's something one can teach, even). I guess for me it's a survival instinct thing: I need to be able to sleep nights, and have confidence that the high-value system we've just delivered to a certain branch of a national body isn't going to fall over because of me. Let me give you a concrete example of poor 3rd-party code. I'm currently using a CPU from AVR (AVR32 family). These come with "code frameworks", which include "drivers" for on-chip systems and example code to use them. Now, I have plenty of respect for the silicon. But I'm convinced that the code framework was put together by a summer intern (or several) with little experience and some guidance, but no QA. I made the mistake of using some of these "drivers" - and they've bitten my ass over and over. One quick fr'instance: there's some (complex) code to manage the MACB, which looks after Ethernet traffic. It signals to higher levels that a message has been received via a Boolean flag. The higher level, running asynchronously and at a non-controlled rate, would poll this flag, read the message, and clear the flag. We started seeing cases where it seemed that the receive mechanism was one message out of step. We realised this happened when 2 (or more) messages arrived (and were properly buffered) before the higher level had a chance to poll the Boolean flag. We were picking up one message, and clearing the flag... and losing the rest. Changing the Boolean to a counter solved the problem. If I'd written this from scratch, I would have, without thinking about it, used a counter, not a Boolean - it's fairly obvious that multiple messages can arrive between polls. But I made the mistake of trusting the 3rd-party code, because it came from AVR... There are loads of other examples. (The AVR TWI/I2C code is just completely hopeless. Bugs all over, and needless gotos, fer crying out loud... wound up ditching the lot and bit-banging I2C.) Did I say I trusted the silicon? Also ran into a hardware bug. The DMA contention system ("HMATRIX") plain doesn't work. Looks great on the datasheet, but simply doesn't work. Gah. (Fortunately Mike, may his name be blessed [he reads this ng] rescued me with some FPGA magic...) Steve -- http://www.fivetrees.com