Disobeying jet engines - why?

Jan 24, 2008 157 Replies

If you mean "failing" as "crashing", true. But our bare-metal assembly stuff never crashes once we get any initial stupidities out, in the first hour or so of testing. After that, "failure" becomes defined as not functioning as desired, and a post-mortem tool won't even recognize that when it happens, so can't checkpoint the event.

The best way to fix a functional problem is to note the behavior and re-read the code. The problem will usually be there in black-and-white. Next best is to step through actual code execution, with a background debugger.

If code is truly crashing intermittently, something in the design philosophy is badly wrong. That's isn't and can't be cured by debugging, because all you'll find are the once-a-day or once-a-week bugs, not the once-a-month ones. Such bugs should simply never exist by design.

Finding "practically" all the bugs isn't good enough, and failures should happen never, not "rarely." Our goal is to ship the first production unit with zero bugs, and we most always do. If your philosophy is to ship with some number of bugs, you will.

John

Fair enough.

Clearly your company is successful so I'd say you have a pretty solid strategy there.

Or getting some government contracts. :-)

You'd also be forced away from Xport modules if you entered the consumer market where the high quantities and competition wouldn't allow for the cost of something like an Xport.

---Joel

On a sunny day (Wed, 30 Jan 2008 14:25:30 -0800 (PST)) it happened Didi wrote in :

features

There are a few thing that should be taken i consideration. Some have been pointed out to you, but this is also important: First you are going to have big problems if you want to change processor, and have to rewrite all your stuff for a different architecture. I know this, some programs I wrote for several processors, in asm.

Then it is not 'bad' to use other work, in fact you will almost always need to use others work, like libraries, you do not make your own resistors now do you? In such a case libc, and all the other libs, are a must. And in case you want to interface to the real world, different protocols have different libraries.

But indeed when you stay on one stand alone embedded system, the asm may do. i use both, whatever makes most sense to me, I will not use C for a small PIC16 project.

You should look at Linux and open source, very little is 'garbage'. I have known people who made a habit of calling others code 'garbage', they did not climb the ladder to success for all I know, got lost in C++ and syntaxes, forgot about what needed to happen, disappeared from the stage so to speak.

I sort of get the feeling you do not know C. It is not a complicated language, Kernigan & Ritchie try reading the book. But with those few C notes you can do a lot, anything in fact.

Sure, 'Hello world' in asm can be shorter (and will be because of linked in libs) then in C. I have tested that :-)

Well, OK, I will refer only to my open source releases, take this news reader for example. It is exactly 100000 lines of C (counting lines with only '{' too).

formatting link
It is based on linked lists. In case you want more C, look here:
formatting link
Take a look at xste (subtitle editor), mcamip (Ethernet webcam driver), xkra (financial options auto trading), well you will have a lot of work to write every lib yourself in asm it is linked against. And portable across all Unixes.

C is not bad, it looks only Greek to those who do not know it :-) It is freeing to those who do know it, as it frees you from specific hardware.

Not with me. You seem to assume that since I do not use C there is what I need to learn about programming from your point of view, which is unlikely to be the case.

I switched from CPU32 (a flavour of 68k) to PPC a few years back; I managed to carry practically all the code (abut 15M source text IIRC) to the new platform. It took me writing the assembler - you might opt to call it a compiler because it does not do line-in/opcode out - which I call VPA, it takes CPU32 code in and produces PPC native code. I posted some links to such code already.

Far from being bad, I do use others work. I use silicon, the resistors you mention etc. In software, I am quite self sufficient. I do have an OS, I do have my development tools running under it etc., I have well over 1M lines of code which works for me. And because we know software is a lot messier than hardware not having other people intervene in my programming process just makes it less prone to errors. Not that I would have much against it, I just do not need it, I manage things quite well myself, typically (way) faster than most other people.

I do not use C to write, but I have read more than a few lines when needed. In fact before too long I may choose to put some "inline C" in my VPA as people seem to want it - if only for the "everybody says so" and "everyone does that" reason.

for example.

Oh I have more libs than you in your C compiler. More, I can always take some of them and modify without entering a learning curve.

So how long did it take you to write the newsreader - the 100 k C lines?

Have a look at

formatting link
and perhaps
formatting link
.

The DSP module debugging screen (second link, the entire module is at

formatting link
) likely matches the complexity of your newsreader - perhaps if we include the target module setup interface (the scope-like window). Can you estimate the number of C lines it will take to do that? I'll give you my figure afterwards. Notice that this screenshot is > 5years old, it is done off a

25MHz 68340 system with 1M RAM (display memory elsewhere). Porting this to the PPC - after I had written the VPA - took me PPC code.

Programming is about programming the hardware. It is a bad idea to hide it from yourself - you only need a facility to not think about it all the time. VPA does the latter, C is closer to the former.

I do use HLLs when I need some quick and dirty job done, like generate a table or process some files somehow or sort of. But this falls into the "user", not "programmer" cathegory.

Dimiter

------------------------------------------------------ Dimiter Popoff Transgalactic Instruments

formatting link

------------------------------------------------------

formatting link

Jan Panteltje wrote:

features

for example.

The consumer market is millions of units with short lifetimes, offshore production, and incredibly small margins. We're not brave enough to attempt that. Made-in-America products need enough margin to provide pay and benefits to non-slave labor, and fund all the overhead and taxes and nonsense that was apparently designed to export jobs from all the surface of the USA that's not Washington, DC. One way to do that is to go for boutique, high-performance, stone-cold-reliable products that are sold to customers willing to pay for same. It's a different business model. Since a small company can't afford marketing intelligence (which doesn't work: Edsel, New Coke, Bob, PC Jr, Itanic) the best thing to do is throw a lot of products at the wall and see which ones stick. The results are usually perplexing.

John

On a sunny day (Thu, 31 Jan 2008 13:59:09 -0800 (PST)) it happened Didi wrote in :

Well the compiler .. there is only libc, libc provides the basic functions. There are many other libs, for many other things, only loaded when needed: grml: # ldd /usr/local/bin/NewsFleX linux-gate.so.1 => (0xffffe000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0xb7ebe000) libforms.so.1 => /usr/X11R6/lib/libforms.so.1 (0xb7e2d000) libm.so.6 => /lib/tls/libm.so.6 (0xb7e08000) libXpm.so.4 => /usr/X11R6/lib/libXpm.so.4 (0xb7dfa000) libcrypt.so.1 => /lib/tls/libcrypt.so.1 (0xb7dcc000) libc.so.6 => /lib/tls/libc.so.6 (0xb7c99000) libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0xb7bda000) /lib/ld-linux.so.2 (0xb7ef2000) libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0xb7bcd000) libdl.so.2 => /lib/tls/libdl.so.2 (0xb7bc9000)

Well, the newsreader has its 10 year anniversary some time ago, writing the code to get it working was maybe a few days. But when I released it into the 'world' I got all sorts of feedback, as people wanted new features, some took the code and made their own version, etc. So last update is from a year or 2 ago? these projects never end. I do not normally count C lines, but somebody mentioned a million lines, so I looked at that newsreader and it was 100800 or so lines :-) The first version was a bit smaller, but I dunno how big.

It all looks very nice, nice hardware too, but I do not know what it does, so I cannot judge it from that science POV.

Eh... couple of graphics, some text displays, GUI, dunno what happens behind that, could be anything. that sort of GUI can be done in very few lines in xforms. xforms even has a GUI generator (fdesign), it creates C code, all you need to do is fill in the callbacks for the sliders, buttons, etc. Such a GUI you can setup in 10 minutes :-) For example

formatting link
takes only a few minutes to create a GUI like that with fdesign (I do it always by hand though), but the code that does the work takes a lot more more.

Programming can be for example math, somebody pointed out FORTRAN. If your application needs a lot of math, then a suitable high level language can 'isolate' you from hardware details and problems.

C is not easy for math though, may drive you nuts with signed and unsigned char etc.

char etc.

If you do math, practically any HLL is better than assembler, I agree. But math is accountable for < 1% of code.... Then if you do really fast math - like tweaking the last cycle of the DSP you use, as I have done in the device you looked at - you just have no option but native DSP assembly.... :-). But this is rare, I agree HLLs are good for math. And that's about where their usefulness ends - for me, at least.

Dimiter

------------------------------------------------------ Dimiter Popoff Transgalactic Instruments

formatting link

------------------------------------------------------

formatting link

Jan Panteltje wrote:

hardware.

char etc.

Its not at all the same. You didn't show the code for the lisp engine and all of its libraries. I showed how a program that can be contained completely within an 8051 can do the operation with no references to any external data source. Your attemped example requires more that is not show than mine.

  1. Does the routine produce the right answer?

I think it's more than just not being brave enough, it's also that you're too smart to attempt it. :-)

No, he just doesn't want to plop down a million bucks for a production run of widgets that will end up selling for $.01 on the dollar in a month. ;-)

Cheers! Rich

Thanks, Rich, that made me laugh--10 times shorter than the LISP example, and in BASIC no less.... That pretentious old QUINE / LISP / AI crap from the early 70s hasn't improved any with age.

Cheers,

Phil Hobbs

Very clever, very terse, very unreadable. This is truly "code".

John

  1. How long did it take to get it to work right, measured two years later?

Anybody who spends more time testing/debugging than coding is doing something very, very wrong, in whatever language.

John

I honestly hope that folks building jets and space shuttles spend more time testing code (directly and indirectly) than writing it!

Indeed! I liked it so much, it was the first program I wrote for my Amstrad CPC6128, which turned up today :)

Cheers Terry

you would be surprised. there was an article a couple years back about the team who write the code for the space shuttle. IIRC they had 17 bugs in 400,000 LOC over 11 years. and 90% of their effort went into planning what code to write.

IMNSHO where most programmers go wrong is this:

- get asked to solve problem

- write code

- debug code

- repeat debug step ad nauseum, continually re-writing the code

- years later, finish the s***ty product, and never reflect that if you took the time to thoroughly understand the problem, then actually

*DESIGNED* the code, it would have worked much better.

I betcha Johns code works well because he:

- has a lot of experience

- is deeply concerned about whether or not it works

- designs it like he designs circuitry

many "programmers" I have met are little more than experimental typists. real engineers dont do that.

Cheers Terry

Which is true, but the whole point of choosing the right language for the problem in hand is significant here. And I wouldn't discount using existing modules when they are available either. It is one possible way to do it.

I think it is a rather fun solution. Even if a lot of the crucial code is hidden.

Your program as shown is anyway not a truly pure quine unless your DisasmDptr and NAP_TIME symbolic constants are reproduced in the final output (and symbolic reference tables seem a bit overkill in an embedded disassembler).

The second generation will be a pure quine with textually identical sourcecode containing magic hex constants.

Regards,

Martin Brown

On Feb 1, 1:02 am, Martin Brown wrote: [.. quine ..]

There is another way to solve the problem:

**** BEGIN Inserted file **** **** END Inserted file ****

No source code at all produces no output so it reproduces its self :)

I suspect that there are a lot more lines of hidden code in any HLL version. Really the problem is with how the problem is cast. There really needs to be a model of a "machine" that does the operations natively. You can then ask what non-trivial language and what non- trivial program produce the source code.

Many years ago, I used an editor written by Intel called "credit". It had a macro ability that was a complete programming language. The cute thing with doing quine on it would be that it could write the source code for the macros in the editor you used to write the source code for the macros.

This is true but it is still an interesting example of thinking about it differently. The usual HLL method is a way to encode the same information twice in the program. Disassembly only contains the information once.

Just for fun, the disassembler could be made to add comments. The comments wouldn't help anyone tryig to understand it but it would be "commented code"

ADD A,DPL ; Add the value in DPL MOV DPL,A ; Store into the DPL CLR A ; Make A zero ADDC A,DPH ; Add with carry, the value in DPH MOV DPH,A ; Store into the DPH

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required