Page 2 of 2
Re: How to use newlib
Posted: Mon Dec 08, 2008 7:41 am
by JamesM
LoseThos wrote:I take it you're making a linux clone?
No, I'm not. The OS I'm making has pluggable syscall subsystems, one of which happens to be POSIX so GNU apps can be run, however the native syscall subsystem is completely different from POSIX.
Re: How to use newlib
Posted: Mon Dec 08, 2008 8:07 am
by LoseThos
Any decent programmer knows it's quicker and more pleasant writing from scratch and only bosses and programmers without skills spout-off "Not invented here."
I am so frustrated with the state of sound on PC's. All i need is a pair of buffered digital to analog converters. I made a A-to-D/D-to-A ISA card years ago. I'm not kidding when I say I could make a sound card faster then figure-out how to program existing ones without documentation.
Re: How to use newlib
Posted: Mon Dec 08, 2008 8:10 am
by JamesM
LoseThos wrote:Any decent programmer knows it's quicker and more pleasant writing from scratch
Did you really just say that?
Re: How to use newlib
Posted: Mon Dec 08, 2008 8:13 am
by LoseThos
It's an exaduration, but sometimes true. I find it more pleasant doing my own stuff and generally hate those who suggest every little widget should be off-the-shelf.
Re: How to use newlib
Posted: Mon Dec 08, 2008 8:28 am
by AJ
LoseThos wrote:Any decent programmer knows it's quicker and more pleasant writing from scratch
IMO, this only applies when components and existing code are poorly written and maintained.
LoseThos wrote:only bosses and programmers without skills spout-off "Not invented here."
What about programmers who want to use well tried and tested code, or compatibility with existing solutions?
Cheers,
Adam
Re: How to use newlib
Posted: Mon Dec 08, 2008 8:34 am
by LoseThos
You know what you want to do better than I do. If you know anything about old formats, they tend to be "crufty", like FAT32 with the 8.3 names. I would hate to see a new operating system begin with a executable format dating to 32-bit days instead of 64-bit. Look-up on wikipedia the formats of .WAV files to .SND. The .WAV files are a monstrocity. Imagine trying to use MS Word documents as source files. That would be cool, but you just know the format of .DOC files is crufty. I think it takes thousands of pages to describe. Formats which have been around for a while grow ugly over time.
Re: How to use newlib
Posted: Mon Dec 08, 2008 9:33 am
by DeletedAccount
hi ,
Although I do not agree much with you . There are lots of library and code available that its simply better to reuse them than reinvent the wheel . But it sometimes make me look like an idiot . when I proudly say that "I have implemented XYZ() ;", Someone else might say there is a method in some super namespace that does it . Yes C# has a good reputation of making me look like a moron
Regards
Shrek
Re: How to use newlib
Posted: Mon Dec 08, 2008 1:31 pm
by AntiRush
LoseThos wrote:...only bosses and programmers without skills spout-off "Not invented here."
I believe you are using a pejorative term completely backwards.
Not Invented Here is a term used to describe the very methodology you are espousing.
Re: How to use newlib
Posted: Wed Dec 10, 2008 4:44 am
by quanganht
I found out that Newlib has provided syscalls in /libc/syscalls. But I don't understand. For example, 'write' function was implemented in syswrite.c, which then call _write or _write_r, and '_write' and '_write_r' is defined external. So what do I have to implement? write or _write or _write_r or all? And how to do that?
Re: How to use newlib
Posted: Wed Dec 10, 2008 4:57 am
by JamesM
quanganht wrote:I found out that Newlib has provided syscalls in /libc/syscalls. But I don't understand. For example, 'write' function was implemented in syswrite.c, which then call _write or _write_r, and '_write' and '_write_r' is defined external. So what do I have to implement? write or _write or _write_r or all? And how to do that?
RTFM. Also, look at the header file newlib/libc/include/reent.h:
Code: Select all
/* This header file provides the reentrancy. */
/* The reentrant system calls here serve two purposes:
1) Provide reentrant versions of the system calls the ANSI C library
requires.
2) Provide these system calls in a namespace clean way.
It is intended that *all* system calls that the ANSI C library needs
be declared here. It documents them all in one place. All library access
to the system is via some form of these functions.
There are three ways a target may provide the needed syscalls.
1) Define the reentrant versions of the syscalls directly.
(eg: _open_r, _close_r, etc.). Please keep the namespace clean.
When you do this, set "syscall_dir" to "syscalls" and add
-DREENTRANT_SYSCALLS_PROVIDED to newlib_cflags in configure.host.
2) Define namespace clean versions of the system calls by prefixing
them with '_' (eg: _open, _close, etc.). Technically, there won't be
true reentrancy at the syscall level, but the library will be namespace
clean.
When you do this, set "syscall_dir" to "syscalls" in configure.host.
3) Define or otherwise provide the regular versions of the syscalls
(eg: open, close, etc.). The library won't be reentrant nor namespace
clean, but at least it will work.
When you do this, add -DMISSING_SYSCALL_NAMES to newlib_cflags in
configure.host.
Stubs of the reentrant versions of the syscalls exist in the libc/reent
source directory and are used if REENTRANT_SYSCALLS_PROVIDED isn't defined.
They use the native system calls: _open, _close, etc. if they're available
(MISSING_SYSCALL_NAMES is *not* defined), otherwise open, close, etc.
(MISSING_SYSCALL_NAMES *is* defined). */
/* WARNING: All identifiers here must begin with an underscore. This file is
included by stdio.h and others and we therefore must only use identifiers
in the namespace allotted to us. */
James
Re: How to use newlib
Posted: Wed Dec 10, 2008 6:09 pm
by quanganht
Oh, I see...
Re: How to use newlib
Posted: Wed Dec 10, 2008 6:58 pm
by LoseThos
It's silly to argue over "Not invented here..." If I say "Do unto others...", you know the saying, right? My usage was completely clear since I clearly was arguing against those who mention "Not invented here syndrome".
"Pejoritive"? Aren't you a fancy pants.
Have to break-out some Godtalk on your butt. He uses high falootin words.
God says...
The moderators want LoseThos to SHUT UP.
I have a saying "Chess nuts boasting in an open foyer."