2021-10-20 11:27 PM
We are using the STM32G474 MCU in dual-bank mode. In the options registers we have DBANK=1 and BFB2=0 or 1 depending on which bank we are booting from at the moment (we swap banks during firmware updates). We have found that when booting and BFB2=0 the FPU is initially disabled (CPACR=0), but when BFB2=1 then FPU is initially enabled (CPACR=0x00F00000). Is this expected behavior? I couldn't find any mention of it in RM0440, ES0430 or AN2606. We'd prefer for the FPU to be disabled out of boot and only be enabled if our firmware requires it.
This was tested by halting the CPU at the reset vector using DEMCR.VC_CORERESET=1 and then reading CPACR using a debugger probe.
2021-10-21 06:44 PM
I should clarify. When using DEMCR.VC_COREREST=1 to halt the CPU at the reset vector, the PC will be in the bootloader instead of my reset handler if BFB2=1 and the FPU will still be disabled. I then placed a hardware breakpoint on the first instruction of my reset handler and allowed the CPU to continue executing from the bootloader. The FPU was then enabled at the time that my breakpoint triggered, so the bootloader must have enabled it and left it on.