To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 2652
2651  |  2653
Subject: 
Re: Linux, Cygwin, DJGPP: what is it all about?
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Tue, 18 Jun 2002 02:56:35 GMT
Viewed: 
2129 times
  
Michael,

I agree with you up to ...

legOS runs user programs written in C and compiled to the machine language
of the Brick. The brick has a Hitachi processor, so the C code has to be
compiled to Hitachi machine code.
legOS itself has to be compiled to the Hitachi machine code, too. So even • if
we provide a downloadable legOS image in the distribution, everyone • wanting
to write a user program must have a C compiler that can translate to
Hitachi machine code.

The only free compiler I know of is the H8 GNU C crosscompiler.

here.

And this
compiler is Unix software.

And I quote from the section "A stark moral choice" in the document The GNU
Project (http://www.gnu.org/gnu/thegnuproject.html)

"So I looked for a way that a programmer could do something for the good. I
asked myself, was there a program or programs that I could write, so as to
make a community possible once again?

The answer was clear: what was needed first was an operating system. That is
the crucial software for starting to use a computer. With an operating
system, you can do many things; without one, you cannot run the computer at
all. With a free operating system, we could again have a community of
cooperating hackers--and invite anyone to join. And anyone would be able to
use a computer without starting out by conspiring to deprive his or her
friends.

As an operating system developer, I had the right skills for this job. So
even though I could not take success for granted, I realized that I was
elected to do the job. I chose to make the system compatible with Unix so
that it would be portable, and so that Unix users could easily switch to it.
The name GNU was chosen following a hacker tradition, as a recursive acronym
for "GNU's Not Unix." "

This is a GNU compiler and thus technically it is not Unix. But what I see
is more important is that a generic compiler in its simplist form is a
program which translate a high level code into machine code. So any program
that correctly translates code into the target machine code no matter what
operating system it runs under is doing its job.

You _must_ have a unix system to run it. If you
are running Linux, you are lucky because the GNU compiler runs on native
Linux.

You don't have Linux? Bad. But not too bad. There is cygwin. Cygwin can be
seen as a layer between DOS (yes, you Windows users: you are running DOS
under your windows system, even if you never saw it in action).
If for example the GNU C compiler opens a file, it calls the needed Linux
system routines. Cygwin sits between and translates this calls to DOS
system calls. The GNU compiler never knows that it does not run on Unix • and
the DOS system does not know that it is called by a software not aware of
its existance.

Now quoting from the section "The History of DJGPP" in the document "The
DJGPP project" (http://www.delorie.com//djgpp/doc/eli-m17n99.html)

"Like every other human endeavor, DJGPP also started with a Word. And like
it happens with almost everything else in the free software world, that word
belonged to Richard Stallman. Here's how DJ Delorie himself describes the
genesis of DJGPP2:

DJGPP was born around 1989 [...], when Richard Stallman spoke at a meeting
of the Northern New England Unix Users Group (NNEUUG) at Data General, where
I then worked. I asked if the FSF ever planned on porting gcc to MS-DOS
[...], and he said it couldn't be done because gcc was too big and MS-DOS
was a 16-bit operating system. Challenge in hand, I began.
Consequently, we should consider Richard Stallman a progenitor of DJGPP, or
at least its godfather. Had it not be for his scepticism, it's possible that
DJGPP would not have existed....

The first version of GCC ported by DJ was 1.35. It was compiled on a 386
machine running ISC Unix, linked with a hacked libc.a taken from that
machine which had DOS-compatible replacements for system calls such as open,
read, stat, etc. and converted to a DOS executable format with a custom
program written by DJ: a first version of DJGPP, originally called djgcc,
was born. It required Phar Lap's DOS Extender to run protected-mode code on
top of real-mode DOS. See DJGPP Programs and MS-DOS, for more about DOS
extender's role."

or in short from the section "Introduction" from the same document

"DJGPP, an acronym for DJ's GNU Programming Platform1, is a project which
brings the GNU development tools to MS-DOS and MS-Windows systems. Its
originator and principal maintainer is DJ Delorie; that's where the "DJ" in
DJGPP comes from."



Now to DJGPP. DJGPP is a port of the GNU C compiler to DOS. Where is the
difference between this and the cygwin / H8-GNU C compiler? DJGPP will
compile a C program to an exe file that could be run on DOS. Thats all. • You
can't tell DJGPP to make Hitachi code. And you can't run the GNU H8
compiler on the DJGPP system because the whole DJGPP system is a DOS
system. There are bash, make and all things a GNU C compiler wants to see.
But all these programs have been changed in a way that they can run on • DOS.
They don't know about unix. Cygwin and DJGPP may be similar in the actual
handling. GNU-C needs a fair amount of support programs both systems must
include. But cygwin runs Unix programs and DJGPP runs DOS programs. With
cygwin you can use a Linux progam to get Hitachi machine code. With DJGPP
this Linux program won't work at all.

- legOS runs user Hitachi machine language programs
- you need the H8 crosscompiler to compile these programs
- this crosscompiler only exists for the Unix system

Ok, I can go along with you here.  But there is an alternative to this ...

- so you have to run cygwin to run the compiler to compile your program

If you don't want to do that, the only chance is not to use legOS.

What needs to be done is to compile or create a H8 compiler that can run
under DOS or work with DJGPP.  AND THIS HAD BEEN DONE.  The following link,
http://legos.sourceforge.net/files/windows/djgpp, is an set of files which I
believe does thisor did it.  Now this was used for legOS version pre 0.2.4
and as I stated before have no experience with it.  So if we can repeat this
or do what needs to be done to get it to work then good.


What could we do for the new Windows user? Not much, I fear. We could try • to
make a better documentation for Windows. We could even try to make an
installation cookbook. But you _must_ have some knowledge of "make" to
compile a user program. You _must_ learn the unix way to do your work. • Even
if you use a good editor to resemble an IDE, you first must set up some
batch files and in the end you first have to know what has to be done on
the command line level and then resemble it for your editor.


Now finally I want to address the term "we" as in "What could we do for the
new Windows user?" or "So if we can repeat this...". The beauty (IMHO) of
this is that this is an Open Source project or a project that individuals
volunteer to work on.  Thus if you are interested in some part of it you
work on it.  If you are not, you don't.  It is not anyone's "job" to work on
something they are not interested in working on.  So the idea of creating a
better windows development tools is only up to those who choose to do
something about it.  I commonly use the term "we" when I mean "I" because it
gets me out of trouble; for example "Look honey, WE ate all the ice cream"!
I believe that a DJGPP version is possible or at least worth investigating.

I have added this investigation to my personal list of things I would be
interested in doing.  Yes, I have many personal things I would like to do so
I am not taking a volunteer leadership position here.  But I am willing to
join others in this investigation if others so choose to investigate it.

Ed



Message has 1 Reply:
  Re: Linux, Cygwin, DJGPP: what is it all about?
 
Hello Ed, problems, problems, problems :) <sigh> Never knew your DOS life is so complicated. Seems urgent to handle this for the new release (easy to say this because I don't have a DOS based legOS system...) (...) Never saw this link. (...) Really? (...) (22 years ago, 18-Jun-02, to lugnet.robotics.rcx.legos)

Message is in Reply To:
  Linux, Cygwin, DJGPP: what is it all about?
 
Ok, lets try to fiddle some things out. There seems to be a confusion about the software needed for running legOS and why. And there seems to be some confusion about what cygwin and DJGPP are. legOS runs user programs written in C and compiled to (...) (22 years ago, 17-Jun-02, to lugnet.robotics.rcx.legos)

4 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR