Closed wimrijnders closed 6 years ago
Hi @wimrijnders,
Here is my /proc/cpuinfo
:
processor : 0
model name : ARMv6-compatible processor rev 7 (v6l)
Features : swp half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xb76
CPU revision : 7
Hardware : BCM2708
Revision : 000d
Serial : 00000000791b4652
Hardware : BCM2708
Well crap. The good news is that the cpuinfo
solution will work. The bad news is that this is another BCM number than I'm expecting, so this needs to be detected also.
Turns out that BCM2807 and BCM2835 come down to the same thing. It does make it a bit bothersome though. BCM2807 is the 'family' name and the other numbers are its members.
I think the safest thing here is to test all possible BCM numbers. From the wiki:
If you have a better idea, please let me know.
The thing is, the combination of fields Hardware
and Revision
is pretty much unique already. Testing the values of the fields is meant as an extra check. You could do a same check with Revision
, which can have the following values:
0002 0003 0004 0005 0006 0007 0008 0009 000d 000e 000f 0011
0014 0012 0015 a01041 a21041 a22042 900092 900093 9000C1 a02082
a22082 a020d3
See what I mean? I thought checking the Hardware
field would be easier. Not that it's not doable, of course. And a computer program doesn't much care how much it needs to test.
Strange though; my Pi 1 has revision 000e
but it's also a Model B Rev 2
like yours. Still, it gives BCM2835
in the Hardware-field.
@mn416 Adjusted detectPlatform
scripts to test multiple model numbers, in particular the model of your Pi.
Please test both the bash and C++ version on you platform and tell me if it works for you.
Hi @wimrijnders,
To make it future proof, how about just detecting Hardware: BCM
? This will catch the common case of someone running with QPU=1
on a PC or Mac.
OK, then. But:
BCM28
, because this is the valid family prefix for Pi'sPR forthcoming.
@mn416 Detection of prefix only added. See if this works for you.
@wimrijnders My Pi shows BCM2708
, so how about BCM2
as the prefix or BCM2(7|8)
?
BCM27x: heh, you're right. Good catch.
Hi @wimrijnders,
Now getting much further, it's correctly detecting my Pi as a Pi.
But I still get stuck on RegisterMap.cpp
:
Compiling Lib/VideoCore/RegisterMap.cpp
In file included from /opt/vc/include/interface/vcos/vcos_assert.h:149:0,
from /opt/vc/include/interface/vcos/vcos.h:114,
from /opt/vc/include/interface/vmcs_host/vc_dispmanx.h:33,
from /opt/vc/include/bcm_host.h:46,
from Lib/VideoCore/RegisterMap.cpp:8:
/opt/vc/include/interface/vcos/vcos_types.h:38:33: fatal error: vcos_platform_types.h: No such file or directory
compilation terminated.
make: *** [obj-qpu/VideoCore/RegisterMap.o] Error 1
But I still get stuck on RegisterMap.cpp:
That's what the last update in #52 is trying to solve. Can you see if that works now?
The attempted implementation for detecting if you're running on Pi does not work on early Pi versions (or distributions). This PR adds a fallback which should work on any version.
/proc/cpuinfo
to both C++ and shell versions ofdetectPlatform