User avatar
joan
Posts: 12746
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Compiling Ada for ARM

Mon Dec 02, 2013 9:06 am

The idea when I was around the Primary Flight Controller project was
  • three separate development teams with their own QA
  • different programming languages
  • different toolsets (compilers etc)
  • different microprocessors
  • different geographical locations

Heater
Posts: 7752
Joined: Tue Jul 17, 2012 3:02 pm

Re: Compiling Ada for ARM

Tue Dec 03, 2013 12:21 pm

tufty,

The 777's PFC's have the same code on all processors on all boxes.

I can't remember if the same Ada compiler for all targets or if they used compilers from different vendors. Probably different but I was not involved in that.

Ultimately there can only be one spec. for a project. At least at the highest level.

The project manager of the testing team printed out the PFC requirements spec. once. It was a pile of A4 about a meter high!

There has been some research into the value of using multiple teams to create multiple independent versions of code. One result that it was possible for different teams to end up with exactly the same bugs in their code! Something to do with ambiguity in the spec. or misunderstanding it the same way. Sorry I don't have any links to that research.

So it is better to pay for multiple-teams or just invest more in getting a single version correct? Who knows.

joan,

I thought the 7J7 Primary Flight Computer had three separate software lanes implementing identical requirements. One in C, one in Ada, and one in assembler.
I have no idea about the 7J7 but that idea seems terminally insane!

joan,

In reality there was:
  • One separate development team with their own QA. Although the development and testing teams were very separate and the only shared info was the requirement spec.
  • One programming language, Ada. However I found there were lot's of little subsystems in those boxes, can't remember if they were micro-controllers or
    custom ASICs, they contained a fair bit of code written in assembler. Their task in life was accepting multiple redundant sensor inputs and arriving at the best guess input value. This is a task that had to be done a lot and hence it was off loaded from the main CPU's
  • Probably different tool sets (compilers etc) I was never involved in that end of things.
  • Three different microprocessors: 486, 68xxx, 29K
  • different geographical locations - Not as far as I know.
Interestingly the is a theorem that states that if you want to tolerate a single fault in a multiply redundant system you need at least 4 of everything and they need to be totally connected (Every one connects to every other one by different paths). It goes on to state that to tolerate N failures you need 3N + 1 nodes. See the wonderful paper: "The Byzantine Generals Problem" by Lamport, Shostak and Pease. http://www.cs.cornell.edu/courses/cs614 ... /lsp82.pdf

So why doe the 777 PFC only have triple redundancy?

I did not get an answer to that question.

Now a days people like Google make a lot of use of Lamport's work to ensure reliability of their server farms.

tufty
Posts: 1454
Joined: Sun Sep 11, 2011 2:32 pm

Re: Compiling Ada for ARM

Tue Dec 03, 2013 5:32 pm

Heater wrote:There has been some research into the value of using multiple teams to create multiple independent versions of code. One result that it was possible for different teams to end up with exactly the same bugs in their code! Something to do with ambiguity in the spec. or misunderstanding it the same way. Sorry I don't have any links to that research.

So it is better to pay for multiple-teams or just invest more in getting a single version correct? Who knows.
That's pretty much what the guy I was talking to was getting at, and it's an interesting question.

Tide
Posts: 93
Joined: Wed Sep 14, 2011 11:21 am

Re: Compiling Ada for ARM

Thu Dec 12, 2013 3:16 pm

I don't know if anybody has menitoned this but Ada has been supported by RISC OS for quite some time now, IIRC !CDburn was written in Ada. Shouldn't be a problem using Ada on the RPi under RISC OS.

User avatar
reQueue1953
Posts: 2
Joined: Fri Sep 01, 2017 6:57 pm
Location: Switzerland

Re: Compiling Ada for ARM

Fri Sep 01, 2017 8:19 pm

I've read all that "troll" about "c/C++" versus "Ada/83/95/2005/..." hum :shock: ... no more to say [...] it was in 2013...

I guess, in 2017 we can compile gnat -gnat2005 (sufficient to me) for "general purpose" projects I do have, using several plateformes and architectures for distribued programming, and now using and making one for each raspberry I have buyed, 2xPi1, 4xPi2 and 5xPi3 with Raspbian and/or Kali over ARM(s). All those Raspi(s) hare about to be connected and running as ethernet-[mp]servers in a kind'a framework I'm doing in Ada (GNAT ~ 2005).

I'll be back when I while (hopefully) having firsts results in using GNAT on Debian/ARM.

Actualy this is'nt a "question"... (!)

PS: Sorry for my not so fluent english wording, I don't even knew my own native langage, near french part of Switzerland, but I do never pass my "BAC" of course, for this trivial reason.

I'm retired since several years... (don't ask)

Heater
Posts: 7752
Joined: Tue Jul 17, 2012 3:02 pm

Re: Compiling Ada for ARM

Sat Sep 02, 2017 2:12 am

This isn't an answer :)

Going over the thread again I don't see any "troll" about "c/C++" versus "Ada".

I wonder how our opening poster, SKyd3R, got on with his operating system in Ada for the Pi ?

jahboater
Posts: 1796
Joined: Wed Feb 04, 2015 6:38 pm

Re: Compiling Ada for ARM

Sat Sep 02, 2017 7:49 am

And gnat is written in C, which is why its so fast.

I remember when the DoD were designing Ada they had the choice of basing it on Pascal or on Algol68. Since Algol68 was already a powerful and complete language, sadly they chose Pascal.

C is successful compared with Ada because it is simple. It is easy and cheap to produce compilers on all sorts of platforms. Therefore C becomes universally available. (Which also helps bootstrap compilers written in C). Complex languages such as PL/1, Ada, or Algol68 have never succeeded in the long term, no matter how good they are. (Modern C++ being the exception, but its based on C).

To say you cannot write large complex projects in C is clearly nonsense since most of them are in fact written in C. Large projects we use all the time, OS's, compilers, office suite's, for example. Ada has been around long enough that if it was suitable for such things it could have been chosen. From distant memory of the way Ada works, I suspect its quite hard to write anything bare metal (an OS) in it.

jahboater
Posts: 1796
Joined: Wed Feb 04, 2015 6:38 pm

Re: Compiling ADA for ARM

Sat Sep 02, 2017 8:10 am

jamesh wrote:
Wed Nov 20, 2013 5:15 pm
Heater wrote:jamesh,
Getting rid of problems early, as with type checking like this, save a lot of time testing, debugging, retesting later on.
Testing doesn't find everything (but you still need to do it), so by ensuring you are getting as much as possible 'tested' at compile time, you will improve the final time to market. Less bugs to fix later on when bugs take longer to fix anyway.

I recently spent some time porting some Videocore code to run under linux. Even simply moving to a different compiler (gcc) showed up quite a few programming issues (the latest GCC really does dig out some interesting faults), and then running under valgrind shows up various memory leaks and threading issues! So even without writing any test code, and just using standard tools, I found a load of issues. And testing on top of that should show up a load more. Now, automating the valgrind run on each checkin means we keep that part of the codebase clean (relatively).
Too true.

I don't think humans are very good at testing software, they cannot find latent bugs, or bugs in code paths not covered by the test suites. A trivial example, you write outside an array bounds. It might crash (which is good) or it might corrupt an unused or unimportant part of memory. Later after a change (such as different optimization options, different compiler, different platform etc) or different usage (e.g. in a customer demo - the customer says "can it do this?" - and it crashes). Valgrind would have found the problem during testing before any harm is done, the compiler also could find it (-fsanitize=bounds) perhaps.

Human testing is expensive so any help the computer can offer for free is worthwhile.
Computers don't get tired, or bored, or want to get home early on Friday afternoons!

Heater
Posts: 7752
Joined: Tue Jul 17, 2012 3:02 pm

Re: Compiling Ada for ARM

Sat Sep 02, 2017 8:11 am

jahboater,

No. GNAT is written in Ada. There is some "glue" code in C to access the OS and such.

The DoD did not design Ada. It was designed by Jean Ichbiah and team at Honeywell Bull. The DoD did layout language requirements and Ada was the contender that won out.

I agree, most people would rather poke their eyes out than write an operating system in Ada. But how about an OS in Ada for the Raspberry Pi ? : https://marte.unican.es

I have seen it used in "bare metal" situations: The Boeing 777 Primary Flight Computers, various military communications systems back in the day. You can even program 8 bit AVR micro-controllers in Ada if you like.
https://playground.arduino.cc/Code/AVR-Ada

jahboater
Posts: 1796
Joined: Wed Feb 04, 2015 6:38 pm

Re: Compiling Ada for ARM

Sat Sep 02, 2017 8:18 am

Heater wrote:
Sat Sep 02, 2017 8:11 am
The DoD did not design Ada. It was designed by Jean Ichbiah and team at Honeywell Bull. The DoD did layout language requirements and Ada was the contender that won out.
OK. The DoD paid for it. Didn't they even specify the color of the cover for the LRM, in terms of the light frequency it should reflect!
Last edited by jahboater on Sat Sep 02, 2017 10:48 am, edited 1 time in total.

Heater
Posts: 7752
Joined: Tue Jul 17, 2012 3:02 pm

Re: Compiling Ada for ARM

Sat Sep 02, 2017 8:27 am

Ha! Probably.

Anecdote:

A few years ago I was working though an online Ada tutorial by some CS professor in the States. Thought I'd catch up on recent Ada standards.

Well, in one example of the use of tagged types I found some very weird and indecipherable code. There was a comment on that code to the effect that "We have to do this weird thing because Ada is absurd". On further study of the standards and some books I realized that the professor did not understand how Ada's tagged types work. Because he did not understand it he had to make a weird work around. And then blamed Ada for being "absurd".

At that point I gave up with Ada. If it has become so complex that even CS profs teaching it don't understand it then it's too much for me.

Lucretia
Posts: 43
Joined: Sun Aug 28, 2011 10:49 pm
Contact: Website

Re: Compiling Ada for ARM

Mon Oct 16, 2017 4:46 pm

Just refound this thread...
jahboater wrote:
Sat Sep 02, 2017 7:49 am
And gnat is written in C, which is why its so fast.
It's written in Ada.
jahboater wrote:
Sat Sep 02, 2017 7:49 am
I remember when the DoD were designing Ada they had the choice of basing it on Pascal or on Algol68. Since Algol68 was already a powerful and complete language, sadly they chose Pascal.

C is successful compared with Ada because it is simple. It is easy and cheap to produce compilers on all sorts of platforms. Therefore C becomes universally available. (Which also helps bootstrap compilers written in C). Complex languages such as PL/1, Ada, or Algol68 have never succeeded in the long term, no matter how good they are. (Modern C++ being the exception, but its based on C).
You cannot pass any C or C++ portably through all C and C++ compilers without a ton of preprocessor directives. No C or C++ compilers are totally conformant and all have non-standard extras bolted on.
jahboater wrote:
Sat Sep 02, 2017 7:49 am
To say you cannot write large complex projects in C is clearly nonsense since most of them are in fact written in C. Large projects we
Nobody said you can't create large projects in C, it's more that people shouldn't as the languages are extremely error prone.
jahboater wrote:
Sat Sep 02, 2017 7:49 am
use all the time, OS's, compilers, office suite's, for example. Ada has been around long enough that if it was suitable for such things it could have been chosen. From distant memory of the way Ada works, I suspect its quite hard to write anything bare metal (an OS) in it.
Writing low-level code in Ada is far nicer, you can map data directly to the hardware right to the bit level. You don't have to do any masking/shifting like in C, the compiler will do that for you and is therefore less error prone. Once you have a secondary stack implemented and basic exception handling enabled, I updated Bare Bones to have these, Ada is really nice and easy for bare metal work.

jahboater
Posts: 1796
Joined: Wed Feb 04, 2015 6:38 pm

Re: Compiling Ada for ARM

Mon Oct 16, 2017 5:05 pm

Lucretia wrote:
Mon Oct 16, 2017 4:46 pm
It's written in Ada.
I stand corrected.
"configure: error: GNAT is required to build ada"
I wonder how its bootstrapped.

Lucretia
Posts: 43
Joined: Sun Aug 28, 2011 10:49 pm
Contact: Website

Re: Compiling Ada for ARM

Mon Oct 16, 2017 5:11 pm

jahboater wrote:
Mon Oct 16, 2017 5:05 pm
Lucretia wrote:
Mon Oct 16, 2017 4:46 pm
It's written in Ada.
I stand corrected.
"configure: error: GNAT is required to build ada"
I wonder how its bootstrapped.
You need an installed GNAT compiler. i.e. x86_64 Linux GNAT cross compiles to arm-linux, then use the cross compiler with a sysroot to build a native arm-linux compiler.

Heater
Posts: 7752
Joined: Tue Jul 17, 2012 3:02 pm

Re: Compiling Ada for ARM

Mon Oct 16, 2017 5:41 pm

jahboater,
From distant memory of the way Ada works, I suspect its quite hard to write anything bare metal (an OS) in it.
On the contrary, Ada has been and no doubt still is used on many embedded systems. Bare metal, no OS. The Primary Flight Control computers of the Boeing 777 is a famous example that I was lucky enough to work on back in the day.

There is even an Ada compiler for the 8 bit AVR micro controllers. Ada on the Arduino anyone?

https://sourceforge.net/p/avr-ada/wiki/Home/

Edit: Oops, seems I already said this back in July.

jahboater
Posts: 1796
Joined: Wed Feb 04, 2015 6:38 pm

Re: Compiling Ada for ARM

Mon Oct 16, 2017 5:47 pm

Lucretia wrote:
Mon Oct 16, 2017 4:46 pm
you can map data directly to the hardware right to the bit level. You don't have to do any masking/shifting like in C, the compiler will do that for you and is therefore less error prone.
By the way, C has direct support for bit fields. You don't have to do the shifting/masking unless you want to.

jahboater
Posts: 1796
Joined: Wed Feb 04, 2015 6:38 pm

Re: Compiling Ada for ARM

Mon Oct 16, 2017 5:48 pm

Heater wrote:
Mon Oct 16, 2017 5:41 pm
Edit: Oops, seems I already said this back in July.
Thats the trouble with these very long running threads. I have seen such repetition elsewhere.

Return to “Other languages”

Who is online

Users browsing this forum: No registered users and 2 guests