Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12603 Discussions

how to find the source of newlib?

Altera_Forum
Honored Contributor II
1,001 Views

I need to use the function select() or sleep(). But they are not implemented in newlib after checking the 

doc of newlib. How could I do? 

 

Where can I find the source code of newlib? in HLA? 

 

Thanks 

Neo
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
304 Views

There is a usleep() function, included with the HAL. Regarding newlib, you can find it here: 

 

http://sources.redhat.com/newlib/ (http://sources.redhat.com/newlib/

 

I think there's also an option to add the sources during kit installation. 

 

Cheers, 

 

- slacker
0 Kudos
Altera_Forum
Honored Contributor II
304 Views

slacker, 

 

Is there a mmap() function in newlib? I found one in "libc/sys/linux/mmap.c". But I cannot find mman.h file from the newlib directory. Does it mean that I only could use that function when I am working on linux? 

 

Thanks, 

Neo
0 Kudos
Altera_Forum
Honored Contributor II
304 Views

The source for the newlib shipped with the HAL is in $NIOS2KIT/bin/nios2-gnutools/src/newlib/newlib. You'll need to search for the file you want below there. 

 

I wouldn't recommend using a different version of newlib since doing this can sometimes cause subtle bugs. 

 

But as slacker has pointed out, usleep is implemented in the HAL rather than in newlib. There is no mmap function in the HAL because we don't have different memory spaces for kernel and user so using just the standard read/write functions is just as efficient.
0 Kudos
Altera_Forum
Honored Contributor II
304 Views

Wombat, 

 

Thanks for your clarification. At the very beginning, I am going to use mmap to implement the virtual mm, how can I do it now? 

 

Thanks, 

Neo
0 Kudos
Reply