mirror of https://github.com/ARMmbed/mbed-os.git
ISR_STACK_START/ HEAP_START defines not used by GCC_ARM toolchain
parent
9ed7e4dc83
commit
9d1ce66b14
|
@ -1241,15 +1241,8 @@ extern "C" WEAK void __cxa_pure_virtual(void)
|
||||||
// SP. This make it compatible with RTX RTOS thread stacks.
|
// SP. This make it compatible with RTX RTOS thread stacks.
|
||||||
#if defined(TOOLCHAIN_GCC_ARM)
|
#if defined(TOOLCHAIN_GCC_ARM)
|
||||||
|
|
||||||
#if !defined(HEAP_START)
|
|
||||||
/* Defined by linker script */
|
|
||||||
extern "C" uint32_t __end__;
|
extern "C" uint32_t __end__;
|
||||||
extern "C" uint32_t __HeapLimit;
|
extern "C" uint32_t __HeapLimit;
|
||||||
#define HEAP_START __end__
|
|
||||||
#define HEAP_LIMIT __HeapLimit
|
|
||||||
#else
|
|
||||||
#define HEAP_LIMIT ((uint32_t)(HEAP_START + HEAP_SIZE))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Turn off the errno macro and use actual global variable instead.
|
// Turn off the errno macro and use actual global variable instead.
|
||||||
#undef errno
|
#undef errno
|
||||||
|
@ -1258,12 +1251,12 @@ extern "C" int errno;
|
||||||
// Weak attribute allows user to override, e.g. to use external RAM for dynamic memory.
|
// Weak attribute allows user to override, e.g. to use external RAM for dynamic memory.
|
||||||
extern "C" WEAK caddr_t _sbrk(int incr)
|
extern "C" WEAK caddr_t _sbrk(int incr)
|
||||||
{
|
{
|
||||||
static unsigned char *heap = (unsigned char *) &HEAP_START;
|
static unsigned char *heap = (unsigned char *) &__end__;
|
||||||
unsigned char *prev_heap = heap;
|
unsigned char *prev_heap = heap;
|
||||||
unsigned char *new_heap = heap + incr;
|
unsigned char *new_heap = heap + incr;
|
||||||
|
|
||||||
/* __HeapLimit is end of heap section */
|
/* __HeapLimit is end of heap section */
|
||||||
if (new_heap >= (unsigned char *) &HEAP_LIMIT) {
|
if (new_heap >= (unsigned char *) &__HeapLimit) {
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
return (caddr_t) -1;
|
return (caddr_t) -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,21 +29,10 @@ static osMutexId_t env_mutex_id;
|
||||||
static mbed_rtos_storage_mutex_t env_mutex_obj;
|
static mbed_rtos_storage_mutex_t env_mutex_obj;
|
||||||
static osMutexAttr_t env_mutex_attr;
|
static osMutexAttr_t env_mutex_attr;
|
||||||
|
|
||||||
#if !defined(ISR_STACK_SIZE)
|
extern uint32_t __StackLimit;
|
||||||
extern uint32_t __StackLimit;
|
extern uint32_t __StackTop;
|
||||||
extern uint32_t __StackTop;
|
|
||||||
#define ISR_STACK_START __StackLimit
|
|
||||||
#define ISR_STACK_SIZE ((uint32_t)((uint32_t)__StackTop - (uint32_t)__StackLimit))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(HEAP_START)
|
|
||||||
/* Defined by linker script */
|
|
||||||
extern uint32_t __end__;
|
extern uint32_t __end__;
|
||||||
extern uint32_t __HeapLimit;
|
extern uint32_t __HeapLimit;
|
||||||
#define HEAP_START __end__
|
|
||||||
#define HEAP_LIMIT __HeapLimit
|
|
||||||
#define HEAP_SIZE ((uint32_t)((uint32_t)HEAP_LIMIT - (uint32_t)HEAP_START))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern void __libc_init_array(void);
|
extern void __libc_init_array(void);
|
||||||
|
|
||||||
|
@ -54,10 +43,10 @@ extern void __libc_init_array(void);
|
||||||
*/
|
*/
|
||||||
void software_init_hook(void)
|
void software_init_hook(void)
|
||||||
{
|
{
|
||||||
mbed_stack_isr_start = (unsigned char *)ISR_STACK_START;
|
mbed_stack_isr_start = (unsigned char *) &__StackLimit;
|
||||||
mbed_stack_isr_size = (uint32_t) ISR_STACK_SIZE;
|
mbed_stack_isr_size = ((uint32_t)((uint32_t) &__StackTop - (uint32_t) &__StackLimit));
|
||||||
mbed_heap_start = (unsigned char *) HEAP_START;
|
mbed_heap_start = (unsigned char *) &__end__;
|
||||||
mbed_heap_size = (uint32_t) HEAP_SIZE;
|
mbed_heap_size = ((uint32_t)((uint32_t) &__HeapLimit - (uint32_t) &__end__));
|
||||||
|
|
||||||
mbed_init();
|
mbed_init();
|
||||||
mbed_rtos_start();
|
mbed_rtos_start();
|
||||||
|
|
Loading…
Reference in New Issue