mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Issue: External SDRAM


I couldn't use the external SDRAM on my LPC4088 platform because the _sbrk function is already defined in the file retarget.cpp.

Is it possible to add an #if !defined(...) or #ifndef ... to encapsulate the _sbrk function (line 474 in retarget.cpp) ?

For example :

new retarget.cpp for example

#ifdef !defined(EXTERNAL_RAM)
extern "C" caddr_t _sbrk(int incr) {
    static unsigned char* heap = (unsigned char*)&__end__;
    unsigned char*        prev_heap = heap;
    unsigned char*        new_heap = heap + incr;

#if defined(TARGET_ARM7)
    if (new_heap >= stack_ptr) {
#elif defined(TARGET_CORTEX_A)
    if (new_heap >= (unsigned char*)&__HeapLimit) {     /* __HeapLimit is end of heap section */
    if (new_heap >= (unsigned char*)__get_MSP()) {
        errno = ENOMEM;
        return (caddr_t)-1;

    heap = new_heap;
    return (caddr_t) prev_heap;

1 comment:

09 Mar 2016

Please report this to github, where we can tag some ppl who might answer this question or provide helpful messages at least.