mbed library sources

Dependents:   frdm_kl05z_gpio_test

Fork of mbed-src by mbed official

Revision:
67:78dfdb5b4d9e
Parent:
20:4263a77256ae
Child:
256:76fd9a263045
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC43XX/TOOLCHAIN_GCC_CR/startup_LPC43xx.cpp	Fri Dec 20 15:00:06 2013 +0000
+++ b/targets/cmsis/TARGET_NXP/TARGET_LPC43XX/TOOLCHAIN_GCC_CR/startup_LPC43xx.cpp	Tue Dec 24 21:15:05 2013 +0000
@@ -312,6 +312,9 @@
 // library.
 //
 // *****************************************************************************
+
+extern "C" void software_init_hook(void) __attribute__((weak));
+
 void
 ResetISR(void) {
 
@@ -342,20 +345,23 @@
 		bss_init(ExeAddr, SectionLen);
 	}
 
-	#if defined(__cplusplus)
-	//
-	// Call C++ library initialisation
-	//
-	__libc_init_array();
-	#endif
+  if (software_init_hook) // give control to the RTOS
+    software_init_hook(); // this will also call __libc_init_array
+  else {
+    #if defined(__cplusplus)
+    //
+    // Call C++ library initialisation
+    //
+    __libc_init_array();
+    #endif
 
-	#if defined(__REDLIB__)
-	// Call the Redlib library, which in turn calls main()
-	__main();
-	#else
-	main();
-	#endif
-
+    #if defined(__REDLIB__)
+    // Call the Redlib library, which in turn calls main()
+    __main();
+    #else
+    main();
+    #endif
+  }
 	//
 	// main() shouldn't return, but if it does, we'll just enter an infinite loop
 	//