Enabling neon on imx8m plus

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Enabling neon on imx8m plus

314 Views
matheus-nogueira
Contributor I

Hello, we are using the imx8m plus to do ultrasound signal processing. At first we tried openCL, but results are too slow for our application so now we are trying it with neon. The problem is that the cross-compile gcc generated with yocto don't recognize -mfloat-abi neither -mfpu flags, and when we execute commands to detect neon on linux it doesn't show up (https://developer.arm.com/documentation/den0018/a/Compiling-NEON-Instructions/Detecting-presence-of-...).

I wrote some code using neon intrinsics and I can compile using the make file below, but I see in assembly code that it isn't using neon instructions like vadd, vmul etc.

What should I do to enable neon? Should I do something on yocto?

Makefile:

PROJ_NAME = frame_processing

# Diretório do sysroot e do Yocto SDK
ROOTFS_DIR = /opt/poky/4.0.6/sysroots/cortexa53-crypto-poky-linux
TARGET_PATH_LIB = $(ROOTFS_DIR)/usr/lib
TARGET_PATH_INCLUDE = $(ROOTFS_DIR)/usr/include

# Diretório da toolchain Yocto
TOOLCHAIN_DIR = /opt/poky/4.0.6/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux

# Fontes C e Headers
C_SOURCE = $(wildcard *.c)
H_SOURCE = $(wildcard *.h)
OBJ = $(C_SOURCE:.c=.o)

# Compilador correto do Yocto SDK
CC = $(TOOLCHAIN_DIR)/aarch64-poky-linux-gcc

# Flags de compilação e linkagem
CPU_CFLAGS = --sysroot=$(ROOTFS_DIR) -Wall -Wextra -std=c11 -O3 -Ofast -I$(TARGET_PATH_INCLUDE) -g -mcpu=cortex-a53 -march=armv8-a+simd -std=gnu11 -ftree-vectorize -fopt-info-vec-missed
CPU_LFLAGS = --sysroot=$(ROOTFS_DIR) -L$(TARGET_PATH_LIB) -lm

# Regra principal
all: $(PROJ_NAME)

# Regra para gerar o binário final
$(PROJ_NAME): $(OBJ)
$(CC) $(CPU_CFLAGS) $(CPU_LFLAGS) -o $@ $^

# Compilação dos arquivos .o
%.o: %.c
$(CC) $(CPU_CFLAGS) -c -o $@ $<
# Regra para gerar código assembly (.s) a partir de .c
%.s: %.c
$(CC) $(CPU_CFLAGS) -S -o $@ $< $(CPU_LFLAGS)
# Gera os arquivos .s (assembly) para todos os arquivos .c
assembly: $(C_SOURCE:.c=.s)

# Limpeza dos arquivos compilados
clean:
rm -f $(OBJ) $(PROJ_NAME) *.s
Labels (1)
2 Replies

269 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello,

You have to upgrade your gcc or toolchain, current yocto BSP has neon and fpu support on cortex A53, also make sure neon its enable in kernel configuration file.

Regards

0 Kudos
Reply

204 Views
matheus-nogueira
Contributor I

Thanks for responding. We tried modifying our yocto configuration file, generated a new cross-compile toolchain and compiled a simple .c file using makefile. But as we understand it, we have not yet compiled vector instructions nor have we seen neon listed when using cat /proc/cpuinfo. Could you tell me what and how we should modify our files? I attached the files as .txt.

0 Kudos
Reply