aboutsummaryrefslogtreecommitdiffstats
path: root/os/common/startup/ARMCAx-TZ/compilers/GCC/crt0.S
diff options
context:
space:
mode:
Diffstat (limited to 'os/common/startup/ARMCAx-TZ/compilers/GCC/crt0.S')
-rw-r--r--os/common/startup/ARMCAx-TZ/compilers/GCC/crt0.S42
1 files changed, 42 insertions, 0 deletions
diff --git a/os/common/startup/ARMCAx-TZ/compilers/GCC/crt0.S b/os/common/startup/ARMCAx-TZ/compilers/GCC/crt0.S
index 4810ea0f6..016e23c58 100644
--- a/os/common/startup/ARMCAx-TZ/compilers/GCC/crt0.S
+++ b/os/common/startup/ARMCAx-TZ/compilers/GCC/crt0.S
@@ -22,6 +22,20 @@
* @{
*/
+/**
+ * @brief Constructors invocation switch.
+ */
+#if !defined(CRT0_CALL_CONSTRUCTORS) || defined(__DOXYGEN__)
+#define CRT0_CALL_CONSTRUCTORS TRUE
+#endif
+
+/**
+ * @brief Destructors invocation switch.
+ */
+#if !defined(CRT0_CALL_DESTRUCTORS) || defined(__DOXYGEN__)
+#define CRT0_CALL_DESTRUCTORS TRUE
+#endif
+
#if !defined(__DOXYGEN__)
.set MODE_USR, 0x10
@@ -117,10 +131,38 @@ bssloop:
*/
bl __core_init
bl __late_init
+#if 0 /* Constructors initialized after halInit() */
+#if CRT0_CALL_CONSTRUCTORS == TRUE
+ /* Constructors invocation.*/
+ ldr r4, =__init_array_start
+ ldr r5, =__init_array_end
+initloop:
+ cmp r4, r5
+ bge endinitloop
+ ldr r1, [r4], #4
+ blx r1
+ b initloop
+endinitloop:
+#endif /* CRT0_CALL_CONSTRUCTORS */
+#endif /* if 0 */
/*
* Main program invocation.
*/
bl main
+
+#if CRT0_CALL_DESTRUCTORS == TRUE
+ /* Destructors invocation.*/
+ ldr r4, =__fini_array_start
+ ldr r5, =__fini_array_end
+finiloop:
+ cmp r4, r5
+ bge endfiniloop
+ ldr r1, [r4], #4
+ blx r1
+ b finiloop
+endfiniloop:
+#endif
+
b __default_exit
#endif /* !defined(__DOXYGEN__) */