Hello everybody,
We have received our SPARCclassic one week ago. The machine is
running the new operating system Solaris 2.1. Unfortunately, we
forgot to order a C compiler (we didn't know that they were no more
delivered with the system :-(. Because my primary task is to develop
data acquisition software with VxWorks, I had first to build a
cross-environment to 68k target. This message describes the
procedure that I have followed.
Note: The installations instructions are mine. They certainly don't fit
your own architecture; they are just given as indications.
1. If you don't have one, get a compiler. You can download, from ftp.uu.net,
the gcc binaries pre-compiled by cygnus. The file is:
vendor/cygnus/cygnus-sol2-1.0.bin.tar.Z (5851617 bytes)
Just follow the instruction in INSTALL.
Hints : - add /opt/cygnus/bin and /usr/ccs/bin in your path
- install everything (or symlinks) in /opt/cygnus
2. Now, you are ready to build a cross-compiler for your VME targets;
in my case: Motorola 68030, 68040 CPUs.
a) Get gcc-2.3.2 from your preferred gnu source.
b) configure --host=sparc-solaris --target=m68k-sun-sunos \
-- with-gnu-ld --with-gnu-as --nfp
c) Modify the Makefile to remove the `-g' option (otherwise some
files will not compile).
d) Optional. In c-decl.c, initialize int flag_no_builtin = 1.
e) make LANGUAGES=c
f) installation
gcc-cross -> /usr/local/bin/cc68k
cc1 -> /usr/local/lib/gcc-lib/m68k-sun-sunos/2.3.2/cc1
cpp -> /usr/local/lib/gcc-lib/m68k-sun-sunos/2.3.2/cpp
3. You will need also a cross assembler. Get gas-1.38.
a) ln -s m-sun3.h m68k.h
b) configure the makefile for a system V machine.
c) make a68
d) installation
a68 -> /usr/local/bin/as68k
in /usr/local/lib/gcc-lib/m68k-sun-sunos/2.3.2/, make a symlink
`as' to /usr/local/bin/as68k
4. binutils-1.9 provides you some other cross-tools. I'm interested only
by some of them (ar68k, ld68k, nm68k, size68k, strip68k).
CFLAGS in the Makefile must be modified. I have used:
CFLAGS=-I. -traditional -DVPRINTF_MISSING -Dm68k -DPORTAR \
-DCROSS_LINKER -DUSG -Usparc
make ar ld nm size strip
install the tools in /usr/local/bin/...68k
5. To compile a VxWorks kernel, you will also need a program to extract
the symbol table. It's easy to do:
Note: a.out.h comes from binutils-1.9
<---------------------- xsym.c -------------------------------->
#include <stdio.h>
#include <unistd.h>
#define m68k
#define PORTAR
#include "a.out.h"
main()
{ struct exec exec;
off_t offset;
char data;
if( read(0,&exec,sizeof(struct exec)) != sizeof(struct exec) )
{ fprintf(stderr,"struct exec read error\n");
exit(1);
}
offset = N_SYMOFF(exec);
lseek(0,offset,SEEK_SET);
exec.a_text = 0;
exec.a_data = 0;
exec.a_bss = 0;
exec.a_entry = 0;
write(1,&exec,sizeof(struct exec));
while( read(0,&data,1) > 0 )
write(1,&data,1);
_exit(0);
<---------------------- END ----------------------------------->Quote:}
6. Have fun. Because I never use de*s or other VxWorks tools, I have
not ported them to solaris. My purpose was to be able to compile and load
my VxWorks software on the new SPARCclassic.
Alain
-----------
Dr. Alain H. Ninane | Tel : +32-10-47.32.32 - Fax: +32-10-45.21.83
Nuclear Physics Dept. | Ch. du Cyclotron, 2
B-1348 Louvain-la-Neuve | BELGIUM
--
Dr. Alain H. Ninane | Tel : +32-10-47.32.32 - Fax: +32-10-45.21.83
Nuclear Physics Dept. | Ch. du Cyclotron, 2
B-1348 Louvain-la-Neuve | BELGIUM