File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_GCC_ARM Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -439,13 +439,20 @@ extern "C" int __end__;
439
439
#undef errno
440
440
extern " C" int errno;
441
441
442
+ // For ARM7 only
443
+ register unsigned char * stack_ptr __asm (" sp" );
444
+
442
445
// Dynamic memory allocation related syscall.
443
446
extern " C" caddr_t _sbrk (int incr) {
444
447
static unsigned char * heap = (unsigned char *)&__end__;
445
448
unsigned char * prev_heap = heap;
446
449
unsigned char * new_heap = heap + incr;
447
450
451
+ #ifdef __get_MSP
448
452
if (new_heap >= (unsigned char *)__get_MSP ()) {
453
+ #else
454
+ if (new_heap >= stack_ptr) {
455
+ #endif
449
456
errno = ENOMEM;
450
457
return (caddr_t )-1 ;
451
458
}
Original file line number Diff line number Diff line change @@ -143,6 +143,7 @@ SECTIONS
143
143
. = ALIGN ( 8 ) ;
144
144
__heap_start__ = . ;
145
145
end = . ;
146
+ __end__ = . ;
146
147
147
148
.stab 0 (NOLOAD) : { *(.stab) }
148
149
.stabstr 0 (NOLOAD) : { *(.stabstr) }
You can’t perform that action at this time.
0 commit comments