This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Using External Memory for Heap

How do I configure the HEAP to be placed within the external memory?

I'm using an LPC1778 with 2MB external memory. I want the controller to calculate an a*-algorithm on a bitmap (loaded from sd-card). Thus, i need lots of dynamically allocated memory (by malloc/realloc).

While searching the forum i only found this: http://www.keil.com/support/man/docs/armlib/armlib_CHDJHFGB.htm .

Can anybody tell me how and where to set the __heap_base to 0x80000000 and the __heap_size to 0x100000?

Parents
  • The heap and stack are initialized in the startup file.
    since the external memory is initialized in a C function, this will never work on that way. because the C function tries to use the stack and heap (on the external memory) which isn't initialized yet.

    I've had the same problem with my EA lpc1788 dev board.
    I've added the C function initialization of the external memory to the startup file (in assembly)
    The startup code will initialize the external memory and after that, still in startup file, the Heap and Stack are placed in the external memory.
    when the program jumps to the C code functions, it will use the heap and stack on the initialized external memory.

Reply
  • The heap and stack are initialized in the startup file.
    since the external memory is initialized in a C function, this will never work on that way. because the C function tries to use the stack and heap (on the external memory) which isn't initialized yet.

    I've had the same problem with my EA lpc1788 dev board.
    I've added the C function initialization of the external memory to the startup file (in assembly)
    The startup code will initialize the external memory and after that, still in startup file, the Heap and Stack are placed in the external memory.
    when the program jumps to the C code functions, it will use the heap and stack on the initialized external memory.

Children
No data