mbed library sources

Dependents:   Marvino mbot

Fork of mbed-src by mbed official

Committer:
bogdanm
Date:
Mon Aug 19 18:17:02 2013 +0300
Revision:
19:398f4c622e1b
Sync with official mbed library release 66

Who changed what in which revision?

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