STM32L5 hard FPU support compile error

Report here problems in any of ChibiOS components. This forum is NOT for support.
User avatar
Cesare
Posts: 36
Joined: Tue Jul 11, 2017 11:51 am
Location: Milan, Italy
Has thanked: 3 times
Been thanked: 3 times

STM32L5 hard FPU support compile error

Postby Cesare » Mon Nov 06, 2023 10:03 am

Good morning Giovanni,
I am working on demo STM32L552ZE-NUCLEO144 (without TZ support). I am developing with STM32CubeIde.
If I compile the demo without the FPU support

Code: Select all

ifeq ($(USE_FPU),)
  USE_FPU = no
endif

there are no errors, but if I add the FPU support

Code: Select all

ifeq ($(USE_FPU),)
  USE_FPU = hard
endif

I get the following error:
Compiling chthreads.c
./rtos/os/rt/src/chthreads.c: In function 'chThdCreateSuspendedI':
./rtos/os/rt/src/chthreads.c:197:251: error: 'struct port_intctx' has no member named 'fpscr'
197 | PORT_SETUP_CONTEXT(tp, tdp->wbase, tp, tdp->funcp, tdp->arg);
| ^
./rtos/os/rt/src/chthreads.c: In function 'chThdCreateStatic':
./rtos/os/rt/src/chthreads.c:367:238: error: 'struct port_intctx' has no member named 'fpscr'
367 | PORT_SETUP_CONTEXT(tp, wsp, tp, pf, arg);
| ^
make: *** [rtos/os/common/startup/ARMCMx/compilers/GCC/mk/rules.mk:194: build/obj/chthreads.o] Error 1
"make all" terminated with exit code 2. Build might be incomplete.


This is because the macro PORT_SETUP_CONTEXT contains PORT_SETUP_CONTEXT_FPU(tp) which writes to fpscr when FPU support is added:

Code: Select all

#define PORT_SETUP_CONTEXT_FPU(tp)      (tp)->ctx.sp->fpscr = (uint32_t)0


If I check the struct representing the context (port_intctx) effectively the member fpscr is missing.

If I add fpscr to port_intctx I can compile without errors but once I start a debug session, when chSysSwitch(ntp, otp) is executed, the program counter jumps to the _unhandled_exception vector.

Are there any suggestion? Thank you in advance.

User avatar
Giovanni
Site Admin
Posts: 14458
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: STM32L5 hard FPU support compile error

Postby Giovanni » Mon Nov 06, 2023 10:07 am

Hi,

It is a bug, the M33 port is not yet fully validated, will look into this as soon as possible, apparently part of the FPU-related code is not yet there for v8-M architecture.

Giovanni

User avatar
Cesare
Posts: 36
Joined: Tue Jul 11, 2017 11:51 am
Location: Milan, Italy
Has thanked: 3 times
Been thanked: 3 times

Re: STM32L5 hard FPU support compile error

Postby Cesare » Mon Nov 06, 2023 12:39 pm

Thank you Giovanni for your prompt reply.
I apologize I can't help you in solving the bug, I took a look at the code but it is too much at "low level".

Looking forward for a review of Cortex-M33 port.


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 2 guests