[LinuxCNC/linuxcnc Issue#643] Configure RPi architecture dependent includes and libraries

未分类 bolang 5个月前 (10-15) 30次浏览

Issue #643 | 状态: 已关闭 | 作者: BsAtHome | 创建时间: 2019-09-06


The Raspberry Pi port of the the hm2 driver is currently detecting the RPi hardware version through non-portable ways by parsing /proc/cpuinfo. The arm64 port of raspbian is missing some information that was relied on and subsequently will cause LCNC fail to run.

The only reason for the test is to setup the hardware IO base address and size correctly for the different versions of the RPi. There is a better (official) way to do this (see https://www.raspberrypi.org/documentation/hardware/raspberrypi/peripheraladdresses.md) using bcmhostgetperipheraladdress() and bcmhostgetperipheral_size().

However, these functions reside in a library /opt/vc/lib/libbcmhost.so and the associated header is at /opt/vc/include/bcmhost.h (from the libraspberrypi packages). These files are very specific for the RPi and located in an unusual location.

A few questions arise from this for portability:
* Should the paths /opt/vc/lib and /opt/vc/include be added permanently in configure or must a test be devised? If a test must be devised, how to do this portable? Otherwise, where and how should they be added?
* What is the correct way in configure.ac to test for libbcmhost.so (using function bcmhostgetperipheral_address())? There seems to be a lot of “manual” testing in configure.ac and I am unsure if the default autoconf structures are good enough from a portability standpoint.
* Should these tests be restricted to the RPi? If yes, how do we reliably detect the platform?


Greetings Bertho


评论 (2)

#1 – BsAtHome 于 2019-09-07

I have committed a fix for the RPi arm64 (buster) problem of not having information in /proc/cpuinfo any more. Please see https://github.com/BsAtHome/linuxcnc/tree/hm2_rpspi for the changes.

The code now reads /proc/device-tree/soc/ranges, which is the same method as bcmhostgetperipheraladdress() uses. However, the reimplementation sidesteps the problem of needing to fiddle with configure.ac and should compile on all platforms. Besides, the libraspberrypi-dev package lacks pkg-config support, which has been a bug for a long time. It is in the sources, but not included in the debian package.

Please have a go at it, if you like and see if it actually works.


#2 – BsAtHome 于 2019-09-28

This has been resolved by pull-request #649.


原始Issue: https://github.com/LinuxCNC/linuxcnc/issues/643

喜欢 (0)