mbed library sources modified for open wear

Dependents:   openwear-lifelogger-example

Fork of mbed-src by mbed official

Committer:
janekm
Date:
Tue Sep 16 22:42:01 2014 +0000
Revision:
310:6188e0254baa
Parent:
71:ca88dd32f209
N/A

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 15:4892fe388435 1 /* mbed Microcontroller Library - stackheap
bogdanm 15:4892fe388435 2 * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
bogdanm 15:4892fe388435 3 *
bogdanm 15:4892fe388435 4 * Setup a fixed single stack/heap memory model,
bogdanm 15:4892fe388435 5 * between the top of the RW/ZI region and the stackpointer
bogdanm 15:4892fe388435 6 */
bogdanm 15:4892fe388435 7
bogdanm 15:4892fe388435 8 #ifdef __cplusplus
bogdanm 15:4892fe388435 9 extern "C" {
bogdanm 15:4892fe388435 10 #endif
bogdanm 15:4892fe388435 11
bogdanm 15:4892fe388435 12 #include <rt_misc.h>
bogdanm 15:4892fe388435 13 #include <stdint.h>
mbed_official 71:ca88dd32f209 14 #include "sys_helper.h"
bogdanm 15:4892fe388435 15
bogdanm 15:4892fe388435 16 extern char Image$$RW_IRAM1$$ZI$$Limit[];
bogdanm 15:4892fe388435 17
bogdanm 15:4892fe388435 18 extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
bogdanm 15:4892fe388435 19 uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
bogdanm 15:4892fe388435 20 uint32_t sp_limit = __current_sp();
bogdanm 15:4892fe388435 21
bogdanm 15:4892fe388435 22 zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned
bogdanm 15:4892fe388435 23
bogdanm 15:4892fe388435 24 struct __initial_stackheap r;
bogdanm 15:4892fe388435 25 r.heap_base = zi_limit;
mbed_official 71:ca88dd32f209 26 r.heap_limit = sp_limit - __reserved_stack_size();
bogdanm 15:4892fe388435 27 return r;
bogdanm 15:4892fe388435 28 }
bogdanm 15:4892fe388435 29
bogdanm 15:4892fe388435 30 #ifdef __cplusplus
bogdanm 15:4892fe388435 31 }
bogdanm 15:4892fe388435 32 #endif