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.