Morpheus / target-mcu-k64f

Fork of target-mcu-k64f by -deleted-

Committer:
screamer
Date:
Wed Mar 23 21:24:48 2016 +0000
Revision:
0:c5e2f793b59a
Initial revision

Who changed what in which revision?

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