pw_boot_armv7m: Add barriers for enabling the FPU

The barriers (as recommended per the STM32 programming manual) ensure
that the FPU is correctly enabled before continuing and potentially
executing any FPU instructions, however rare that may be during startup.

Change-Id: I846c87c5fd72ac297ed6556e57cb7ca672d6d83a
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/13360
Commit-Queue: Ian Tessier <itessier@google.com>
Commit-Queue: Keir Mierle <keir@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
diff --git a/targets/stm32f429i-disc1/boot.cc b/targets/stm32f429i-disc1/boot.cc
index 439d0a9..a0d0fc2 100644
--- a/targets/stm32f429i-disc1/boot.cc
+++ b/targets/stm32f429i-disc1/boot.cc
@@ -35,6 +35,19 @@
   volatile uint32_t& arm_v7m_cpacr =
       *reinterpret_cast<volatile uint32_t*>(0xE000ED88u);
   arm_v7m_cpacr |= kFpuEnableMask;
+
+  // Ensure the FPU configuration is committed and enabled before continuing and
+  // potentially executing any FPU instructions, however rare that may be during
+  // startup.
+  asm volatile(
+      " dsb \n"
+      " isb \n"
+      // clang-format off
+      : /*output=*/
+      : /*input=*/
+      : /*clobbers=*/"memory"
+      // clang-format on
+  );
 #endif  // PW_ARMV7M_ENABLE_FPU
 }