Modified mbed library sources only for STM32F030K6, LQFP32 (0.8mm pitch) package, 32K Flash, 4K SRAM. Compiler target: Nucleo 32F030R8

Fork of mbed-src by mbed official

Revision:
23:8d50de55f208
Parent:
20:4263a77256ae
Child:
24:75304dd5f5fb
diff -r dbd009839d5e -r 8d50de55f208 common/retarget.cpp
--- a/common/retarget.cpp	Fri Sep 13 14:22:58 2013 +0100
+++ b/common/retarget.cpp	Mon Sep 16 16:15:04 2013 +0100
@@ -439,13 +439,20 @@
 #undef errno
 extern "C" int errno;
 
+// For ARM7 only
+register unsigned char * stack_ptr __asm ("sp");
+
 // Dynamic memory allocation related syscall.
 extern "C" caddr_t _sbrk(int incr) {
     static unsigned char* heap = (unsigned char*)&__end__;
     unsigned char*        prev_heap = heap;
     unsigned char*        new_heap = heap + incr;
 
+#ifdef __get_MSP
     if (new_heap >= (unsigned char*)__get_MSP()) {
+#else
+    if (new_heap >= stack_ptr) {
+#endif
         errno = ENOMEM;
         return (caddr_t)-1;
     }