Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySensors gateway support for 64-bit OS on RPI (gcc cpu flags) #1550

Open
frepkovsky opened this issue Aug 26, 2023 · 0 comments
Open

MySensors gateway support for 64-bit OS on RPI (gcc cpu flags) #1550

frepkovsky opened this issue Aug 26, 2023 · 0 comments

Comments

@frepkovsky
Copy link
Contributor

frepkovsky commented Aug 26, 2023

Configure script does not support auto-configuration of gcc cpu flags for RPi SoCs on 64-bit OS (i.e. official Raspberry Pi OS). For all RPI SoCs detected, optimizations flags for floating point operations are added that are specific for 32-bit gcc only (for aarch32): "-mfpu=vfp -mfloat-abi=hard" and they do not exist in 64-bit gcc for aarch64. Running configuration on 64-bit OS on aarch64 results in error:

test@raspberrypi:~/MySensors $ ./configure --my-gateway=ethernet --my-port=5003 --my-is-rfm69hw --my-transport=rfm69 --my-rfm69-frequency=868
[SECTION] Detecting target machine.
  [OK] machine detected: SoC=BCM2837, Type=rpi3, CPU=aarch64.
[SECTION] Detecting SPI driver.
  [OK] SPI driver detected:BCM.
[SECTION] Gateway configuration.
  [OK] Type: ethernet.
  [OK] Transport: rfm69.
  [OK] Signing: Disabled.
  [OK] Encryption: Disabled.
  [OK] CPPFLAGS: -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_RFM69 -DMY_RFM69_NEW_DRIVER -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RFM69_FREQUENCY=RFM69_868MHZ -DMY_IS_RFM69HW -DMY_PORT=5003 
  [OK] CXXFLAGS:  -std=c++11
[SECTION] Detecting init system.
  [OK] Init system detected: systemd.
[SECTION] Saving configuration.
  [OK] Saved.
[SECTION] Cleaning previous builds.
  [OK] Finished.

test@raspberrypi:~/MySensors $ make
gcc -MT build/hal/architecture/Linux/drivers/core/config.o -MMD -MP -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_RFM69 -DMY_RFM69_NEW_DRIVER -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RFM69_FREQUENCY=RFM69_868MHZ -DMY_IS_RFM69HW -DMY_PORT=5003  -Ofast -g -Wall -Wextra  -I. -I./core -I./hal/architecture/Linux/drivers/core -I./hal/architecture/Linux/drivers/BCM -c hal/architecture/Linux/drivers/core/config.c -o build/hal/architecture/Linux/drivers/core/config.o
gcc: error: unrecognized command-line option ‘-mfpu=neon-fp-armv8’
gcc: error: unrecognized command-line option ‘-mfloat-abi=hard’
make: *** [Makefile:103: build/hal/architecture/Linux/drivers/core/config.o] Error 1

Function gcc_cpu_flags() in configure script needs to be updated to avoid using flags "-mfpu=vfp -mfloat-abi=hard" on aarch64 (fp and simd are enabled by default for all current aarch64 architectures).

function gcc_cpu_flags {
    local soc=$1
    case $soc in
    BCM2835)
        flags="-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard"
        ;;
    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
        ;;
    BCM2711)
        flags="-march=armv8-a+crc -mtune=cortex-a72 -mfpu=neon-fp-armv8 -mfloat-abi=hard"
        ;;
    AM33XX)
        flags="-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=hard"
        ;;
    A10)
        flags="-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=hard"
        ;;
    A13)
        flags="-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=hard"
        ;;
    A20)
        flags="-march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard"
        ;;
    H3)
        flags="-march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard"
        ;;
    RK3399)
        flags="-march=armv8-a+crc+crypto -mtune=cortex-a72.cortex-a53 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419"
        ;;
    *)
        flags=""
    esac
    echo ${flags}
}

tekka007 pushed a commit that referenced this issue Oct 13, 2023
* Fix configure script errors on 64-bit OS (#1550)

Use only gcc flags relevant to aarch64 for 64-bit RPI SoCs on 64-bit
OS version

* Fix mysgw build errors on 64-bit OS (#1551)

Force data type for the parameter of min() function to avoid conflicts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant