Backwards compatibility?

Would a program compiled on a Raspberry Pi 2, with the latest software, run on a Raspberry Pi 1? I'm thinking that the latest compiler may emit ARMv7 code which would be unknown to a RasPi 1 which is just ARMv6.

Is there a compatibility switch which could be set, so that compiling could still get the advantage of the four cores?

--
Thanks, 
David 
 Click to see the full signature
Reply to
David Taylor
Loading thread data ...

It should be compatible. The default compiler flags are set by the distribution, so running Raspbian on both old and new should be fine. At least thats my experience so-far...

I've no idea of the state of the art re. parallelising compilers these days... Maybe there is a magic bullet now...

Traditionally if you want your application to magically use multiple cores them I'm afraid that you need to write multi-threaded code to use multiple execution units (although some system libraries may take advantage) or code in a language that has parallelism built-in...

If you want to make your compiles go faster and you use 'make' then add the flag: -j5. ie. make -j5

Compiling my basic interpreter on a B+ takes 3 miuntes from scratch,

1 minute 9 seconds on a v2 with standard 'make', and 21 seconds with 'make -j5'

Gordon

Reply to
Gordon Henderson

Thanks, Gordon. I've just compiled NTP 4.3.0 on an RPi 2 and the executables produced do indeed run on RPi B and B+ correctly, as far as I can tell from the initial start. I presume at some point there will be either a new compiler or a compiler switch which enables use of the ARMv7 instructions (otherwise why have them).

I note your point on parallel programming, but the -j5 on make is enough for the moment. I'm not after writing parallel applications.

--
Cheers, 
David 
 Click to see the full signature
Reply to
David Taylor

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.