]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC82X/TOOLCHAIN_ARM_MICRO/sys.cpp
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_NXP / TARGET_LPC82X / TOOLCHAIN_ARM_MICRO / 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