Ver Fonte

RXT5: add Floating-point initialization for Arm C Library (#1421)

Robert Rostohar há 4 anos atrás
pai
commit
28d54ba19e
2 ficheiros alterados com 29 adições e 1 exclusões
  1. 1 0
      CMSIS/DoxyGen/RTOS2/src/history.txt
  2. 28 1
      CMSIS/RTOS2/RTX/Source/rtx_lib.c

+ 1 - 0
CMSIS/DoxyGen/RTOS2/src/history.txt

@@ -103,6 +103,7 @@
       <td>
        - Fixed potential register R1 corruption when calling OS functions from threads multiple times with same arguments (when using high level compiler optimizations).
        - Minor code optimizations in osMessageQueuePut/Get
+       - Added Floating-point initialization for Arm C Library
       </td>
     </tr>
     <tr>

+ 28 - 1
CMSIS/RTOS2/RTX/Source/rtx_lib.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2021 Arm Limited. All rights reserved.
+ * Copyright (c) 2013-2022 Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -26,6 +26,10 @@
 #include "cmsis_compiler.h"
 #include "rtx_os.h"
 
+#ifdef    CMSIS_device_header
+#include  CMSIS_device_header
+#endif
+
 #ifdef    RTE_Compiler_EventRecorder
 #include "EventRecorder.h"
 #include "EventRecorderConf.h"
@@ -656,6 +660,29 @@ void osRtxKernelPreInit (void) {
 #endif
 
 
+// C/C++ Standard Library Floating-point Initialization
+// ====================================================
+
+#if ( !defined(RTX_NO_FP_INIT_CLIB) && \
+     ( defined(__CC_ARM) || \
+      (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))) && \
+      !defined(__MICROLIB))
+
+#if  ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
+      (defined(__FPU_USED   ) && (__FPU_USED    == 1U)))
+
+extern void $Super$$_fp_init (void);
+
+void $Sub$$_fp_init (void) {
+  $Super$$_fp_init();
+  FPU->FPDSCR = __get_FPSCR();
+}
+
+#endif
+
+#endif
+
+
 // C/C++ Standard Library Multithreading Interface
 // ===============================================