Time functions in newlib
Tue Jul 10 20:03:00 GMT 2001
----- Original Message -----
From: "Lewin A.R.W. Edwards" <email@example.com>
Sent: Wednesday, July 11, 2001 5:15 AM
Subject: Time functions in newlib
> I'm working with a custom ARM7 platform, and I'm basically linking with
> newlib only to get access to a few math functions that are inserted
> implicitly by gcc, as well as a couple of things that would be tedious to
> rewrite (like sprintf).
> Is there any guide on what I need to do to get the following two functions
> ported to my architecture:
> * time-based functions, e.g. clock()? Is there a global tick count
> I can just increment in an ISR?
For clock(),you need a libgloss function:times(),
That is dependent on your hardware.
> * memory allocation functions - I don't specifically want to use them, but
> occasionally some "kinda POSIX" code I want to test requires these
> functions. How do I tell newlib where its heap begins and ends? (In my
> architecture, RAM available for heap begins right after the BSS segment,
> and extends up to 4Mb beyond it).
Specify the heap begin and end in the linker script,
And you also need a libgloss funciton:sbrk,
That is the supporting stub for malloc,alloc.......
You may find some example code under newlib source codes.
> The first one of those is much more interesting to me, I can work around
> the second one.
> -- Lewin A.R.W. Edwards
> Embedded Engineer, Digi-Frame Inc.
> Work: http://www.digi-frame.com/
> Tel (914) 937-4090 9am-6:30pm M-F ET
> Personal: http://www.larwe.com/ http://www.zws.com/
> "Far better it is to dare mighty things, to win glorious triumphs, even
> though checkered by failure, than to rank with those poor spirits who
> neither enjoy much nor suffer much, because they live in the gray twilight
> that knows not victory nor defeat."
> (Theodore Roosevelt)
More information about the Newlib