Yahoo Groups archive

Lpc2000

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

Message

Re: [lpc2000] Questions about librarys

2004-11-05 by Robert Adsett

At 07:15 PM 11/5/04 +0000, you wrote:


>I'm a beginner in LPC2000 and I'm developing a program for lpc2210. I
>have
>these questions:
>
>1) Is newlib the best library option for memory allocation usage?

Define best.  It depends on what you are doing.  I believe it is a general 
purpose allocator and so subject to all the usual concerns.  Personally for 
an embedded system I wouldn't use mallac and company except at startup to 
provide memory blocks.  On going uses would either use fixed preallocated 
blocks or allocate out of a pool to avoid fragmentation issues.


>2) Does anyone have expecience with uclibc or diet libc? what's the
>best?

No experience with either, make sure the license is compatible with your use.



>3) Does memory allocation with newlib need sbrk implementation with
>the
>compiler arm-elf-gcc? Does anybody have any examples? Is there any
>fragmentation problem?
It does need an sbrk implementation (newlib-lpc provides one), but they are 
not difficult.



>4) How can I determine my program stack size? I tried avrora and
>stacktool, but both are for atmel.

Count :)

Actually, I'm at least half serious about that.  If you are not doing 
recursive calls it's relatively straightforward, if a little tedious, to 
simple count up the stack usage.

The other obvious approach is to mark the stack and see how far down it 
descends by looking for the stack end while running,  Not as foolproof 
against rarely executed paths but more robust against arithmetic errors.

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,
be they legal, genetic, or physical.  If you don't believe me, try to
chew a radio signal. "

                         Kelvin Throop, III

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.