This fork captures the mbed lib v125 for ease of integration into older projects.
Fork of mbed-dev by
targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_ARM_STD/sys.cpp@187:92cbb9eec47b, 2018-07-20 (annotated)
- Committer:
- apluscw
- Date:
- Fri Jul 20 21:24:42 2018 +0000
- Revision:
- 187:92cbb9eec47b
Mbed library with source code from mbed lib v125. Posted to ease integration with some older projects.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
apluscw | 187:92cbb9eec47b | 1 | /* mbed Microcontroller Library - stackheap |
apluscw | 187:92cbb9eec47b | 2 | * Copyright (C) 2009-2011 ARM Limited. All rights reserved. |
apluscw | 187:92cbb9eec47b | 3 | * |
apluscw | 187:92cbb9eec47b | 4 | * Setup a fixed single stack/heap memory model, |
apluscw | 187:92cbb9eec47b | 5 | * between the top of the RW/ZI region and the stackpointer |
apluscw | 187:92cbb9eec47b | 6 | */ |
apluscw | 187:92cbb9eec47b | 7 | |
apluscw | 187:92cbb9eec47b | 8 | #ifdef __cplusplus |
apluscw | 187:92cbb9eec47b | 9 | extern "C" { |
apluscw | 187:92cbb9eec47b | 10 | #endif |
apluscw | 187:92cbb9eec47b | 11 | |
apluscw | 187:92cbb9eec47b | 12 | #include <rt_misc.h> |
apluscw | 187:92cbb9eec47b | 13 | #include <stdint.h> |
apluscw | 187:92cbb9eec47b | 14 | |
apluscw | 187:92cbb9eec47b | 15 | extern char Image$$RW_IRAM1$$ZI$$Limit[]; |
apluscw | 187:92cbb9eec47b | 16 | |
apluscw | 187:92cbb9eec47b | 17 | extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { |
apluscw | 187:92cbb9eec47b | 18 | uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; |
apluscw | 187:92cbb9eec47b | 19 | uint32_t sp_limit = __current_sp(); |
apluscw | 187:92cbb9eec47b | 20 | |
apluscw | 187:92cbb9eec47b | 21 | zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned |
apluscw | 187:92cbb9eec47b | 22 | |
apluscw | 187:92cbb9eec47b | 23 | struct __initial_stackheap r; |
apluscw | 187:92cbb9eec47b | 24 | r.heap_base = zi_limit; |
apluscw | 187:92cbb9eec47b | 25 | r.heap_limit = sp_limit; |
apluscw | 187:92cbb9eec47b | 26 | return r; |
apluscw | 187:92cbb9eec47b | 27 | } |
apluscw | 187:92cbb9eec47b | 28 | |
apluscw | 187:92cbb9eec47b | 29 | #ifdef __cplusplus |
apluscw | 187:92cbb9eec47b | 30 | } |
apluscw | 187:92cbb9eec47b | 31 | #endif |