fix for mbed lib issue 3 (i2c problem) see also https://mbed.org/users/mbed_official/code/mbed/issues/3 affected implementations: LPC812, LPC11U24, LPC1768, LPC2368, LPC4088

Fork of mbed-src by mbed official

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers sys.cpp Source File

sys.cpp

00001 /* mbed Microcontroller Library - stackheap
00002  * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
00003  * 
00004  * Setup a fixed single stack/heap memory model, 
00005  *  between the top of the RW/ZI region and the stackpointer
00006  */
00007 
00008 #ifdef __cplusplus
00009 extern "C" {
00010 #endif 
00011 
00012 #include <rt_misc.h>
00013 #include <stdint.h>
00014 
00015 extern char Image$$RW_IRAM1$$ZI$$Limit[];
00016 
00017 extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
00018     uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
00019     uint32_t sp_limit = __current_sp();
00020 
00021     zi_limit = (zi_limit + 7) & ~0x7;    // ensure zi_limit is 8-byte aligned
00022 
00023     struct __initial_stackheap r;
00024     r.heap_base = zi_limit;
00025     r.heap_limit = sp_limit;
00026     return r;
00027 }
00028 
00029 #ifdef __cplusplus
00030 }
00031 #endif