Restructure RPi files (#827)
- Restructure SPi files for linux and RPi - Update RPi revision detection (#826)
This commit is contained in:
committed by
Henrik Ekblad
parent
26c237adad
commit
4c31e22d6f
@@ -17,7 +17,7 @@ SPI driver options:
|
||||
Device path. [/dev/spidev0.0]
|
||||
|
||||
Building options:
|
||||
--soc=[BCM2835|BCM2836|AM33XX|A10|A13|A20|H3]
|
||||
--soc=[BCM2835|BCM2836|BCM2837|AM33XX|A10|A13|A20|H3]
|
||||
SoC type to be used. [configure autodetected]
|
||||
--cpu-flags=<CPUFLAGS> CPU defining/optimizing flags to be used. [configure autodetected]
|
||||
--extra-cflags=<CFLAGS> Extra C flags passed to C compilation. []
|
||||
@@ -126,21 +126,38 @@ function detect_machine {
|
||||
fi
|
||||
|
||||
case $hardware in
|
||||
BCM2708)
|
||||
soc="BCM2835"
|
||||
BCM*)
|
||||
if [[ $machine == "Raspberry"* ]]; then
|
||||
tp="RPi"
|
||||
fi
|
||||
;;
|
||||
BCM2709)
|
||||
soc="BCM2836"
|
||||
if [[ $machine == "Raspberry"* ]]; then
|
||||
local rev=($(detect_rpi_revision))
|
||||
if [[ $rev == "a02082" || $rev == "a22082" ]]; then
|
||||
tp="RPi3"
|
||||
# Calculation done by joolswills(https://github.com/joolswills) for the RetroPie-Setup project
|
||||
# and based on information from https://github.com/AndrewFromMelbourne/raspberry_pi_revision
|
||||
local rev="0x$(sed -n '/^Revision/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo)"
|
||||
# if bit 23 is not set, we are on a rpi1 (bit 23 means the revision is a bitfield)
|
||||
if [[ $((($rev >> 23) & 1)) -eq 0 ]]; then
|
||||
soc="BCM2835"
|
||||
tp="rpi1"
|
||||
else
|
||||
tp="Rpi2"
|
||||
# if bit 23 is set, get the cpu from bits 12-15
|
||||
case "$((($rev >> 12) & 15))" in
|
||||
0)
|
||||
soc="BCM2835"
|
||||
tp="rpi1"
|
||||
;;
|
||||
1)
|
||||
soc="BCM2836"
|
||||
tp="rpi2"
|
||||
;;
|
||||
2)
|
||||
soc="BCM2837"
|
||||
tp="rpi3"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
elif [[ $hardware == "BCM2708"* ]]; then
|
||||
soc="BCM2835"
|
||||
elif [[ $hardware == "BCM2709"* ]]; then
|
||||
soc="BCM2836"
|
||||
elif [[ $hardware == "BCM2710"* ]]; then
|
||||
soc="BCM2837"
|
||||
fi
|
||||
;;
|
||||
sun4i|Sun4iw1p1)
|
||||
@@ -208,6 +225,9 @@ function gcc_cpu_flags {
|
||||
BCM2836)
|
||||
flags="-march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard"
|
||||
;;
|
||||
BCM2837)
|
||||
flags="-march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard"
|
||||
;;
|
||||
AM33XX)
|
||||
flags="-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=hard"
|
||||
;;
|
||||
@@ -446,8 +466,8 @@ if [ -z "${CPUFLAGS}" ]; then
|
||||
CPUFLAGS=$(gcc_cpu_flags $SOC)
|
||||
fi
|
||||
|
||||
if [[ $SOC == "BCM2835" || $SOC == "BCM2836" ]]; then
|
||||
CPPFLAGS="-DLINUX_ARCH_RASPBERRYPI $CPPFLAGS"
|
||||
if [[ $SOC == "BCM2835" || $SOC == "BCM2836" || $SOC == "BCM2837" ]]; then
|
||||
CPPFLAGS="-DLINUX_ARCH_RASPBERRYPI -DRPI_TYPE=\\\"$TYPE\\\" $CPPFLAGS"
|
||||
else
|
||||
echo "[SECTION] Checking GPIO Sysfs."
|
||||
if [[ $(eval 'ls /sys/class/gpio/export 2>/dev/null') ]]; then
|
||||
@@ -459,7 +479,7 @@ fi
|
||||
|
||||
if [ -z "${SPI_DRIVER}" ]; then
|
||||
echo "[SECTION] Detecting SPI driver."
|
||||
if [[ $SOC == "BCM2835" || $SOC == "BCM2836" ]]; then
|
||||
if [[ $SOC == "BCM2835" || $SOC == "BCM2836" || $SOC == "BCM2837" ]]; then
|
||||
SPI_DRIVER=BCM
|
||||
elif [[ $(eval 'ls /dev/spidev* 2>/dev/null') ]]; then
|
||||
SPI_DRIVER=SPIDEV
|
||||
|
||||
Reference in New Issue
Block a user