]> git.gir.st - tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_KLXX/TARGET_KL46Z/TOOLCHAIN_ARM_STD/sys.cpp
Merge commit '1fe4406f374291ab2e86e95a97341fd9c475fcb8'
[tmk_keyboard.git] / tmk_core / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_Freescale / TARGET_KLXX / TARGET_KL46Z / TOOLCHAIN_ARM_STD / sys.cpp
1 /* mbed Microcontroller Library - stackheap
2 * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
3 *
4 * Setup a fixed single stack/heap memory model,
5 * between the top of the RW/ZI region and the stackpointer
6 */
7
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11
12 #include <rt_misc.h>
13 #include <stdint.h>
14
15 extern char Image$$RW_IRAM1$$ZI$$Limit[];
16
17 extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
18 uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
19 uint32_t sp_limit = __current_sp();
20
21 zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned
22
23 struct __initial_stackheap r;
24 r.heap_base = zi_limit;
25 r.heap_limit = sp_limit;
26 return r;
27 }
28
29 #ifdef __cplusplus
30 }
31 #endif
Imprint / Impressum