mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
AnnaBridge
Date:
Wed Jun 21 17:46:44 2017 +0100
Revision:
167:e84263d55307
Child:
173:e131a1973e81
This updates the lib to the mbed lib v 145

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AnnaBridge 167:e84263d55307 1 /******************************************************************************
AnnaBridge 167:e84263d55307 2 * Copyright (c) 2013-2016 Realtek Semiconductor Corp.
AnnaBridge 167:e84263d55307 3 *
AnnaBridge 167:e84263d55307 4 * Licensed under the Apache License, Version 2.0 (the "License");
AnnaBridge 167:e84263d55307 5 * you may not use this file except in compliance with the License.
AnnaBridge 167:e84263d55307 6 * You may obtain a copy of the License at
AnnaBridge 167:e84263d55307 7 *
AnnaBridge 167:e84263d55307 8 * http://www.apache.org/licenses/LICENSE-2.0
AnnaBridge 167:e84263d55307 9 *
AnnaBridge 167:e84263d55307 10 * Unless required by applicable law or agreed to in writing, software
AnnaBridge 167:e84263d55307 11 * distributed under the License is distributed on an "AS IS" BASIS,
AnnaBridge 167:e84263d55307 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
AnnaBridge 167:e84263d55307 13 * See the License for the specific language governing permissions and
AnnaBridge 167:e84263d55307 14 * limitations under the License.
AnnaBridge 167:e84263d55307 15 *
AnnaBridge 167:e84263d55307 16 ******************************************************************************
AnnaBridge 167:e84263d55307 17 * mbed Microcontroller Library - stackheap
AnnaBridge 167:e84263d55307 18 * Setup a fixed single stack/heap memory model,
AnnaBridge 167:e84263d55307 19 * between the top of the RW/ZI region and the stackpointer
AnnaBridge 167:e84263d55307 20 ******************************************************************************/
AnnaBridge 167:e84263d55307 21
AnnaBridge 167:e84263d55307 22 #ifdef __cplusplus
AnnaBridge 167:e84263d55307 23 extern "C" {
AnnaBridge 167:e84263d55307 24 #endif
AnnaBridge 167:e84263d55307 25
AnnaBridge 167:e84263d55307 26 #include <rt_misc.h>
AnnaBridge 167:e84263d55307 27 #include <stdint.h>
AnnaBridge 167:e84263d55307 28
AnnaBridge 167:e84263d55307 29 extern char Image$$RW_IRAM1$$ZI$$Limit[];
AnnaBridge 167:e84263d55307 30 extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
AnnaBridge 167:e84263d55307 31 uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
AnnaBridge 167:e84263d55307 32 uint32_t sp_limit = __current_sp();
AnnaBridge 167:e84263d55307 33
AnnaBridge 167:e84263d55307 34 zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned
AnnaBridge 167:e84263d55307 35
AnnaBridge 167:e84263d55307 36 //push down stack pointer to recycle some of the stack space that are not use in future
AnnaBridge 167:e84263d55307 37 __asm volatile
AnnaBridge 167:e84263d55307 38 (
AnnaBridge 167:e84263d55307 39 "MRS IP, MSP \n"
AnnaBridge 167:e84263d55307 40 "ADD IP, #64 \n"
AnnaBridge 167:e84263d55307 41 "BIC IP, IP, #7 \n"
AnnaBridge 167:e84263d55307 42 "MSR MSP, IP \n"
AnnaBridge 167:e84263d55307 43 );
AnnaBridge 167:e84263d55307 44 struct __initial_stackheap r;
AnnaBridge 167:e84263d55307 45 r.heap_base = zi_limit;
AnnaBridge 167:e84263d55307 46 r.heap_limit = sp_limit;
AnnaBridge 167:e84263d55307 47 return r;
AnnaBridge 167:e84263d55307 48 }
AnnaBridge 167:e84263d55307 49
AnnaBridge 167:e84263d55307 50 #ifdef __cplusplus
AnnaBridge 167:e84263d55307 51 }
AnnaBridge 167:e84263d55307 52 #endif