ifdef pi ? lazarus / 32-Linux ---------------------------------------------------------------------- dieselnutjob · 2016-04-14 11:59 Hi, for the following code can someone show me how to set A:=5 for a raspberry pi running raspian please? Code: [Select]{$IFDEF Win32}   A:=1; {$ENDIF} {$IFDEF Linux}   {$IFDEF BIT32}     A:=2;   {$ENDIF}   {$IFDEF BIT64}     A:=3;   {$ENDIF} {$ENDIF} {$IFDEF Darwin}   A:=4; {$ENDIF}          thanks ---------------------------------------------------------------------- Thaddy · 2016-04-14 12:15 So whats the problem? Raspbian = Debian linux. ---------------------------------------------------------------------- dieselnutjob · 2016-04-14 12:25 sorry I should be clearer. I would like A:=2 for 32 bit Intel A:=3 for 64 bit Intel A:=5 for a Pi thanks ---------------------------------------------------------------------- balazsszekely · 2016-04-14 12:30 We do know that raspberry pi is powered by arm processors. So the following ifdef should help: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  {$IFDEF Arm}  //... {$ENDIF}Unfortunately other device can also have arm processors. So the condition is not enough. ---------------------------------------------------------------------- dieselnutjob · 2016-04-14 12:43 and probably I should be using ifdef i386 and ifdef cpux86_64 for the intel cases (32 bit and 64 bit respectively)? also isn't there an ifdef armhf ? to be honest arm is good enough for me for now ---------------------------------------------------------------------- Leledumbo · 2016-04-14 12:46 Quote from: dieselnutjob on April 14, 2016, 02:43:26 pmand probably I should be using ifdef i386 and ifdef cpux86_64 for the intel cases (32 bit and 64 bit respectively)? also isn't there an ifdef armhf ? to be honest arm is good enough for me for now Execute fpc -vc [your arm options here], see all symbols defined by the compiler. My arm compiler now is built for ARMEL and it has CPUARMEL defined, something similar for ARMHF should be defined as well. ---------------------------------------------------------------------- SymbolicFrank · 2016-04-14 12:48 For Arm targets running a *NIX, I always process /proc/cpuinfo at startup. (Or  sysctl -a | grep machdep.cpu for Apple.) But that's not evaluated at compile-time. ---------------------------------------------------------------------- dieselnutjob · 2016-04-14 15:20 Quote from: Leledumbo on April 14, 2016, 02:46:57 pmExecute fpc -vc [your arm options here], see all symbols defined by the compiler. My arm compiler now is built for ARMEL and it has CPUARMEL defined, something similar for ARMHF should be defined as well. this worked, I got CPUARM and CPUARMHF thanks ---------------------------------------------------------------------- ab1jx · 2016-05-06 04:03 You could also do a standard "uname -a" at a system level which gets something like: Linux raspberrypi 4.1.19-v7+ #858 SMP Tue Mar 15 15:56:00 GMT 2016 armv7l GNU/Linux You can probably read that in as a string and pull out 'raspberrypi' and the kernel version.  I think the earlier Pi models didn't use an SMP (multi-core) kernel, another tidbit of information. But see "man uname", you can get different fields, -a is all. -m is machine.