LPC2368 [GCC_ARM]: Fixed: Compilation and link errors in case "SD" example.

pull/66/head
dinau 2013-09-13 21:59:11 +09:00
parent b9d52bda50
commit 43acaa4166
2 changed files with 8 additions and 0 deletions

View File

@ -439,13 +439,20 @@ extern "C" int __end__;
#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;
}

View File

@ -143,6 +143,7 @@ SECTIONS
. = ALIGN( 8 ) ;
__heap_start__ = . ;
end = . ;
__end__ = . ;
.stab 0 (NOLOAD) : { *(.stab) }
.stabstr 0 (NOLOAD) : { *(.stabstr) }