Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: malloc external memory

2005-09-16 by Ken Wada

If you are using the GNU tools then in general, you need to do the 
following:

1.  Modify the malloc_init() code that is located with your GNU 
development kit.

2.  Make any necessary modifications to the malloc_memory code that is 
also included.

3.  Make sure that your heap is properly located, (do this in the 
linker descriptor file, that is the ASCII script file that tells the 
linker/locator how to properly link/locate your project)

Since I am not using the GNU tools for the Philips LPC2xxx, I cannot 
give you much more information than this. I have extensively used the 
GNU tools for other processors though...and what I am describing is 
pretty common for the GNU tool chain.

oh...By the way, there are other things you can do. Sometimes, my 
clients tell me that they will not approve of anything I do if it 
incorporates malloc() and free(). In this case, I create my own static 
memory allocator...this usually solution works very well, plus, I can 
customize the allocator to look for heap/memory corruption, memory 
leaks and a bunch of other stuff!

Ken Wada

--- In lpc2000@yahoogroups.com, "szemzoandras" <a.szemzo@k...> wrote:
> hi,
> 
> 
> I'm using winarm package, so gcc is the compiler.
> I would like to use internal SRAM for the local variables, etc..
> but I need some relative big blocks of memory stored in the external
> memory.
> I can read/write external memory "by hand", but I think I don't need
> to write a memory manager, I can simply use malloc. (I hope)
> I have one question, how? :)
> 
> sa@m
> 
> 
> 
> > > 
> > > How it is possible to allocate memory in the external ram?
> > > I'd try this 
> > > "-Wl,--defsym=__heap_start=0x81000000,
> > --defsym=__heap_end=0x81ffffff"
> > > 
> > > Is it ok?
> > In general, you need to call some kind of subroutine to properly 
> > initialize your heap/memory manager. Since I do not know which 
tool 
> > you are using, I cannot give you more information here.
> > 
> > 
> > > How can I mix internal sram with external space?
> > Absolutely, I do this all the time. What exactly do you want to 
do?
> > 
> > Ken Wada
> > > 
> > > Thanks!!
> > > 
> > > Andrew

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.