Target_UNO_91H: Remove custom _sbrk, update heap limits

pull/9571/head
Deepika 2019-02-07 09:45:44 -06:00 committed by deepikabhavnani
parent 73f4a52361
commit a814078f0c
4 changed files with 5 additions and 88 deletions

View File

@ -1,36 +0,0 @@
/* mbed Microcontroller Library - stackheap
* Copyright (C) 2009-2018 ARM Limited. All rights reserved.
*
* Setup a fixed single stack/heap memory model,
* between the top of the RW/ZI region and the stackpointer
*/
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
#include <arm_compat.h>
#endif
#include <rt_misc.h>
#include <stdint.h>
extern char Image$$ARM_LIB_HEAP$$ZI$$Base[];
extern char Image$$ARM_LIB_HEAP$$ZI$$Length[];
extern __value_in_regs struct __initial_stackheap _mbed_user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3)
{
uint32_t hp_base = (uint32_t)Image$$ARM_LIB_HEAP$$ZI$$Base;
uint32_t hp_limit = (uint32_t)Image$$ARM_LIB_HEAP$$ZI$$Length + hp_base;
struct __initial_stackheap r;
hp_base = (hp_base + 7) & ~0x7; // ensure hp_base is 8-byte aligned
r.heap_base = hp_base;
r.heap_limit = hp_limit;
return r;
}
#ifdef __cplusplus
}
#endif

View File

@ -166,6 +166,7 @@ SECTIONS
__end__ = .; __end__ = .;
end = __end__; end = __end__;
*(.heap*) *(.heap*)
. = ORIGIN(DRAM) + LENGTH(DRAM);
__HeapLimit = .; __HeapLimit = .;
} > DRAM } > DRAM
PROVIDE(__sbrk_start = ADDR(.heap)); PROVIDE(__sbrk_start = ADDR(.heap));

View File

@ -1,37 +0,0 @@
/* mbed Microcontroller Library
* Copyright (c) 2009-2018 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined(TWO_RAM_REGIONS)
#include <stdint.h>
#include <errno.h>
extern uint32_t __sbrk_start;
extern uint32_t __krbs_start;
/* Overide _sbrk() to support two region model */
void *__wrap__sbrk(int incr)
{
static uint32_t heap_ind = (uint32_t)(&__sbrk_start);
uint32_t heap_ind_pre = heap_ind;
uint32_t heap_ind_new = (heap_ind_pre + incr + 0x07) & ~0x07;
if (heap_ind_new > (uint32_t)(&__krbs_start)) {
errno = ENOMEM;
return (void *)(-1);
}
heap_ind = heap_ind_new;
return (void *) heap_ind_pre;
}
#endif

View File

@ -29,24 +29,13 @@
#define OS_CLOCK 160000000 #define OS_CLOCK 160000000
#endif #endif
#if defined(__CC_ARM) #if defined(__ARMCC_VERSION)
extern uint32_t Image$$ARM_LIB_HEAP$$ZI$$Base[]; extern uint32_t Image$$ARM_LIB_HEAP$$ZI$$Base[];
extern uint32_t Image$$ARM_LIB_HEAP$$ZI$$Length[]; extern uint32_t Image$$ARM_LIB_HEAP$$ZI$$Length[];
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Base[]; #define HEAP_START Image$$ARM_LIB_HEAP$$ZI$$Base
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Length[]; #define HEAP_SIZE Image$$ARM_LIB_HEAP$$ZI$$Length
#define HEAP_START ((unsigned char*) Image$$ARM_LIB_HEAP$$ZI$$Base)
#define HEAP_SIZE ((uint32_t) Image$$ARM_LIB_HEAP$$ZI$$Length)
#define ISR_STACK_START ((unsigned char*)Image$$ARM_LIB_STACK$$ZI$$Base)
#define ISR_STACK_SIZE ((uint32_t)Image$$ARM_LIB_STACK$$ZI$$Length)
#elif defined(__GNUC__) #elif defined(__GNUC__)
extern uint32_t __StackTop[]; /* No region declarations needed */
extern uint32_t __StackLimit[];
extern uint32_t __end__[];
extern uint32_t __HeapLimit[];
#define HEAP_START ((unsigned char*)__end__)
#define HEAP_SIZE ((uint32_t)((uint32_t)__HeapLimit - (uint32_t)HEAP_START))
#define ISR_STACK_START ((unsigned char*)__StackLimit)
#define ISR_STACK_SIZE ((uint32_t)((uint32_t)__StackTop - (uint32_t)__StackLimit))
#elif defined(__ICCARM__) #elif defined(__ICCARM__)
/* No region declarations needed */ /* No region declarations needed */
#else #else