Selected FPU does not support instruction

Hi Everyone.

I am using STM32F3 , on the UFO board and trying to run ml-kem-768(kyber 768) in it.

I am facing an issue, where this is the makefile output.

 Building for platform CW308_STM32F3 with CRYPTO_TARGET=NONE
SS_VER set to SS_VER_2_1
SS_VER set to SS_VER_2_1
.
Welcome to another exciting ChipWhisperer target build!!
arm-none-eabi-gcc (15:13.2.rel1-2) 13.2.1 20231009
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

.
Compiling:
-en     simpleserial-kyber.c ...
-e Done!
.
Compiling:
-en     pqm4/crypto_kem/kyber768/m4fstack/cbd.c ...
-e Done!
.
Compiling:
-en     pqm4/crypto_kem/kyber768/m4fstack/indcpa.c ...
-e Done!
.
Compiling:
-en     pqm4/crypto_kem/kyber768/m4fstack/kem.c ...
-e Done!
.
Compiling:
-en     pqm4/crypto_kem/kyber768/m4fstack/matacc.c ...
-e Done!
.
Compiling:
-en     pqm4/crypto_kem/kyber768/m4fstack/ntt.c ...
-e Done!
.
Compiling:
-en     pqm4/crypto_kem/kyber768/m4fstack/poly.c ...
-e Done!
.
Compiling:
-en     pqm4/crypto_kem/kyber768/m4fstack/polyvec.c ...
-e Done!
.
Compiling:
-en     pqm4/crypto_kem/kyber768/m4fstack/symmetric-fips202.c ...
-e Done!
.
Compiling:
-en     pqm4/crypto_kem/kyber768/m4fstack/verify.c ...
-e Done!
.
Compiling:
-en     pqm4/common/aes.c ...
-e Done!
.
Compiling:
-en     pqm4/common/aes-publicinputs.c ...
-e Done!
.
Compiling:
-en     pqm4/common/crypto_hashblocks_sha512.c ...
-e Done!
.
Compiling:
-en     pqm4/common/hal-stm32f4.c ...
-e Done!
.
Compiling:
-en     pqm4/common/randombytes.c ...

pqm4/common/randombytes.c:38:2: warning: #warning Using a non-random randombytes [-Wcpp]
   38 | #warning Using a non-random randombytes
      |  ^~~~~~~

-e Done!
.
Compiling:
-en     pqm4/mupq/common/fips202.c ...
-e Done!
.
Compiling:
-en     .././simpleserial/simpleserial.c ...
-e Done!
.
Compiling:
-en     .././hal/stm32f3/stm32f3_hal.c ...
-e Done!
.
Compiling:
-en     .././hal/stm32f3/stm32f3_hal_lowlevel.c ...
-e Done!
.
Compiling:
-en     .././hal/stm32f3/stm32f3_sysmem.c ...
-e Done!
.
Assembling: pqm4/crypto_kem/kyber768/m4fstack/fastaddsub.S
arm-none-eabi-gcc -c -mcpu=cortex-m4 -I. -x assembler-with-cpp -mthumb -mfloat-abi=soft -fmessage-length=0 -ffunction-sections -DF_CPU=7372800 -Wa,-gstabs,-adhlns=objdir-CW308_STM32F3/fastaddsub.lst -Ipqm4/crypto_kem/kyber768/m4fstack/ -Ipqm4/mupq/common -Ipqm4/libopencm3/include/ -Ipqm4/libopencm3/lib/ -I.././simpleserial/ -I.././hal -I.././hal/stm32f3 -I.././hal/stm32f3/CMSIS -I.././hal/stm32f3/CMSIS/core -I.././hal/stm32f3/CMSIS/device -I.././hal/stm32f4/Legacy -I.././simpleserial/ -I.././crypto/ pqm4/crypto_kem/kyber768/m4fstack/fastaddsub.S -o objdir-CW308_STM32F3/pqm4/crypto_kem/kyber768/m4fstack/fastaddsub.o
.
Assembling: pqm4/crypto_kem/kyber768/m4fstack/fastbasemul.S
arm-none-eabi-gcc -c -mcpu=cortex-m4 -I. -x assembler-with-cpp -mthumb -mfloat-abi=soft -fmessage-length=0 -ffunction-sections -DF_CPU=7372800 -Wa,-gstabs,-adhlns=objdir-CW308_STM32F3/fastbasemul.lst -Ipqm4/crypto_kem/kyber768/m4fstack/ -Ipqm4/mupq/common -Ipqm4/libopencm3/include/ -Ipqm4/libopencm3/lib/ -I.././simpleserial/ -I.././hal -I.././hal/stm32f3 -I.././hal/stm32f3/CMSIS -I.././hal/stm32f3/CMSIS/core -I.././hal/stm32f3/CMSIS/device -I.././hal/stm32f4/Legacy -I.././simpleserial/ -I.././crypto/ pqm4/crypto_kem/kyber768/m4fstack/fastbasemul.S -o objdir-CW308_STM32F3/pqm4/crypto_kem/kyber768/m4fstack/fastbasemul.o
.
Assembling: pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S
arm-none-eabi-gcc -c -mcpu=cortex-m4 -I. -x assembler-with-cpp -mthumb -mfloat-abi=soft -fmessage-length=0 -ffunction-sections -DF_CPU=7372800 -Wa,-gstabs,-adhlns=objdir-CW308_STM32F3/fastinvntt.lst -Ipqm4/crypto_kem/kyber768/m4fstack/ -Ipqm4/mupq/common -Ipqm4/libopencm3/include/ -Ipqm4/libopencm3/lib/ -I.././simpleserial/ -I.././hal -I.././hal/stm32f3 -I.././hal/stm32f3/CMSIS -I.././hal/stm32f3/CMSIS/core -I.././hal/stm32f3/CMSIS/device -I.././hal/stm32f4/Legacy -I.././simpleserial/ -I.././crypto/ pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S -o objdir-CW308_STM32F3/pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.o

pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S: Assembler messages:
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:162: Error: selected FPU does not support instruction -- `vldm twiddle_ptr!,{s8-s15}'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:169: Error: selected FPU does not support instruction -- `vmov s8,tmp'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:70: Error: selected FPU does not support instruction -- `vmov.w twiddle,s9'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:176:  Info: macro invoked from here
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:79: Error: selected FPU does not support instruction -- `vmov.w twiddle,s10'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:176:  Info: macro invoked from here
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:82: Error: selected FPU does not support instruction -- `vmov.w twiddle,s11'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:176:  Info: macro invoked from here
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:179: Error: selected FPU does not support instruction -- `vmov twiddle,s12'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:183: Error: selected FPU does not support instruction -- `vmov twiddle,s13'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:187: Error: selected FPU does not support instruction -- `vmov twiddle,s14'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:191: Error: selected FPU does not support instruction -- `vmov twiddle,s15'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:195: Error: selected FPU does not support instruction -- `vmov s0,poly0'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:196: Error: selected FPU does not support instruction -- `vmov s1,poly1'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:197: Error: selected FPU does not support instruction -- `vmov s2,poly2'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:198: Error: selected FPU does not support instruction -- `vmov s3,poly3'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:199: Error: selected FPU does not support instruction -- `vmov s4,poly4'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:200: Error: selected FPU does not support instruction -- `vmov s5,poly5'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:201: Error: selected FPU does not support instruction -- `vmov s6,poly6'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:202: Error: selected FPU does not support instruction -- `vmov s7,poly7'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:70: Error: selected FPU does not support instruction -- `vmov.w twiddle,s9'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:211:  Info: macro invoked from here
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:79: Error: selected FPU does not support instruction -- `vmov.w twiddle,s10'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:211:  Info: macro invoked from here
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:82: Error: selected FPU does not support instruction -- `vmov.w twiddle,s11'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:211:  Info: macro invoked from here
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:215: Error: selected FPU does not support instruction -- `vmov tmp2,s1'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:221: Error: selected FPU does not support instruction -- `vmov tmp2,s3'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:227: Error: selected FPU does not support instruction -- `vmov tmp2,s5'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:233: Error: selected FPU does not support instruction -- `vmov tmp2,s7'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:241: Error: selected FPU does not support instruction -- `vmov poly3,s2'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:247: Error: selected FPU does not support instruction -- `vmov poly5,s4'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:253: Error: selected FPU does not support instruction -- `vmov poly7,s6'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:259: Error: selected FPU does not support instruction -- `vmov poly1,s0'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:265: Error: selected FPU does not support instruction -- `vmov tmp,s8'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:276: Error: selected FPU does not support instruction -- `vmov s10,barrettconst'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:280: Error: selected FPU does not support instruction -- `vmov s11,barrettconst'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:289: Error: selected FPU does not support instruction -- `vmov barrettconst,s10'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:290: Error: selected FPU does not support instruction -- `vmov s15,poly'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:291: Error: selected FPU does not support instruction -- `vmov poly,s11'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:294: Error: selected FPU does not support instruction -- `vmov poly,s15'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:295: Error: selected FPU does not support instruction -- `vldm twiddle_ptr!,{s0-s2}'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:70: Error: selected FPU does not support instruction -- `vmov.w twiddle,s0'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:297:  Info: macro invoked from here
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:79: Error: selected FPU does not support instruction -- `vmov.w twiddle,s1'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:297:  Info: macro invoked from here
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:82: Error: selected FPU does not support instruction -- `vmov.w twiddle,s2'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:297:  Info: macro invoked from here
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:310: Error: selected FPU does not support instruction -- `vmov s14,tmp'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:313: Error: selected FPU does not support instruction -- `vmov s13,tmp'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:331: Error: selected FPU does not support instruction -- `vmov tmp,s13'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:339: Error: selected FPU does not support instruction -- `vmov barrettconst,s10'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:340: Error: selected FPU does not support instruction -- `vmov s15,poly'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:341: Error: selected FPU does not support instruction -- `vmov poly,s11'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:343: Error: selected FPU does not support instruction -- `vmov poly,s15'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:356: Error: selected FPU does not support instruction -- `vmov tmp,s14'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:362: Error: selected FPU does not support instruction -- `vmov s13,tmp'
pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.S:379: Error: selected FPU does not support instruction -- `vmov tmp,s13'
make: *** [.././Makefile.inc:530: objdir-CW308_STM32F3/pqm4/crypto_kem/kyber768/m4fstack/fastinvntt.o] Error 1

---------------------------------------------------------------------------
CalledProcessError                        Traceback (most recent call last)
Cell In[42], line 1
----> 1 get_ipython().run_cell_magic('bash', '-s "$SS_VER" "$PLATFORM" "$CRYPTO_TARGET" "$CRYPTO_PATH"', 'make SS_VER=$1 PLATFORM=$2 CRYPTO_TARGET=$3 CRYPTO_PATH=$4\n')

File ~/chipwhisperer/myenv/lib/python3.12/site-packages/IPython/core/interactiveshell.py:2541, in InteractiveShell.run_cell_magic(self, magic_name, line, cell)
   2539 with self.builtin_trap:
   2540     args = (magic_arg_s, cell)
-> 2541     result = fn(*args, **kwargs)
   2543 # The code below prevents the output from being displayed
   2544 # when using magics with decorator @output_can_be_silenced
   2545 # when the last Python token in the expression is a ';'.
   2546 if getattr(fn, magic.MAGIC_OUTPUT_CAN_BE_SILENCED, False):

File ~/chipwhisperer/myenv/lib/python3.12/site-packages/IPython/core/magics/script.py:155, in ScriptMagics._make_script_magic.<locals>.named_script_magic(line, cell)
    153 else:
    154     line = script
--> 155 return self.shebang(line, cell)

File ~/chipwhisperer/myenv/lib/python3.12/site-packages/IPython/core/magics/script.py:315, in ScriptMagics.shebang(self, line, cell)
    310 if args.raise_error and p.returncode != 0:
    311     # If we get here and p.returncode is still None, we must have
    312     # killed it but not yet seen its return code. We don't wait for it,
    313     # in case it's stuck in uninterruptible sleep. -9 = SIGKILL
    314     rc = p.returncode or -9
--> 315     raise CalledProcessError(rc, cell)

CalledProcessError: Command 'b'make SS_VER=$1 PLATFORM=$2 CRYPTO_TARGET=$3 CRYPTO_PATH=$4\n'' returned non-zero exit status 2.

As you can see, the problem is selected FPU does not support some instructions

Then I tried enabling FPU support using this thread (Enable FPU for STM32). But this is of no use. Please help me with this thing.

Does STM32F3 have FPU support or not?

here is my makefile for reference


TARGET = simpleserial-kyber
CRYPTO_TARGET = NONE
PLATFORM=CW308_STM32F3

# Source adds .c source files for build 
SRC += ${TARGET}.c
SRC+=$(wildcard pqm4/crypto_kem/kyber768/m4fstack/*.c)
SRC+=$(wildcard pqm4/common/*.c)
SRC+=pqm4/mupq/common/fips202.c


# Source adds .S source files for build 
ASRC+=$(wildcard pqm4/crypto_kem/kyber768/m4fstack/*.S)
ASRC+=$(wildcard pqm4/common/*.S)
ASRC+=$(wildcard pqm4/libopencm3/include/libopencm3/stm32/common/*.S)

EXTRAINCDIRS += pqm4/crypto_kem/kyber768/m4fstack/
EXTRAINCDIRS += pqm4/mupq/common
EXTRAINCDIRS += pqm4/libopencm3/include/
EXTRAINCDIRS += pqm4/libopencm3/lib/


# -----------------------------------------------------------------------------
EXTRA_OPTS = NO_EXTRA_OPTS
CFLAGS += -D$(EXTRA_OPTS) -DSTM32F3 -mfloat-abi=soft -mfpu=fpv4-sp-d16
FPUUSE = 0

${info Building for platform ${PLATFORM} with CRYPTO_TARGET=$(CRYPTO_TARGET)}

#Add simpleserial project to build
include ../simpleserial/Makefile.simpleserial

FIRMWAREPATH = ../.


include $(FIRMWAREPATH)/Makefile.inc

Thank you in advance

Yeah, the STM32F3 does have an FPU. Could the issue be that you have mfloat-abi=soft instead of hard? We don’t use the FPU on the F3, so I’m not familiar with the proper build flags for it or its exact capabilities.

1 Like