Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
21 years ago

how to find the source of newlib?

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

4 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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