compiling 68000 code on a Sun 3

Byron A Jeff byron at cc.gatech.edu
Fri Dec 7 09:40:29 AEST 1990


In article <wgstuken.660513920 at faui4n> wgstuken at faui4n.informatik.uni-erlangen.de (Wolfgang Stukenbrock (Dipl. Zugangssystem Inf4)) writes:
>rg at uunet!unhd (Roger Gonzalez ) writes:
>
>>I need to be able to compile plain 68000 code on a Sun 3 to be prommed
>>into an embedded system.  It looks like as and gas can assemble 68020
>>and 68010 code (or, if you prefer, gcc and cc can *produce* 680[12]0 code.)
>>I need to be able to do the whole thing; from compilation to assembly to
>>link.  Am I in trouble?
>
>Yes you are!
>
>There are two main problems.
>[1. Sun wants to sell cross development system and ...
> 2. GNU doesn't work properly]

Well while it's true it won't work straight up and down it is possible
to get the Sun development environment for generate code for
vanilla 68000 systems.

What I did was to generate a sed script to change the few 68020
specific assembler items the cc compiler generated into 68010 eqivalents.
The ones in particular are:

1. Changing extbl to an extw followed by an extl
2. Hand scaling the automatic scaling that the 68020 uses.

I can't even parse what I dd anymore. Find a copy of the script below.

So the process I use:

1. Compile C programs with SUN cc producing assembler.
2. Run the assembler code through the script below generating
   code with only 68000 directives.
3. Run the assembler code through as with the -mc68010 switch on to
   catch any bad directives.

Note that the best you can do is generate 68010 code. You'll need additional
code to catch 68010 directives but I don't think the cc compiler generates
any.

Anyway this has worked on both a 68008 and a 68010 system I've built.

Feel free to write if you have any questions.

BAJ
------ CUT HERE -------
# Conversion script for 68020 assembler directives to 68000 assembler
# directives.
#
# Copyright 1990 - Byron A. Jeff
#
# Feel free to distribute under the following conditions:
#
# 1. The header accompany all copies
# 2. Source is not used in any commercial ventures
#

/extbl/ {
s/extbl/extw/
p
s/extw/extl/
p
d
}
/,.*:.*:.*)/ {
s/^\(.*:.*\):2)\(.*\)$/\1:1)\2/
s/^\(.*:.*\):4)\(.*\)$/\1:2)\2/
s/^\(.*:.*\):8)\(.*\)$/\1:3)\2/
h
s/^.*,\(.*\):\([^,)]*\):\(.*\)).*$/	lsl\2	#\3,\1/
t x1
b cont1
:x1
p
:cont1
g
s/,\(.*\):\([^,)]*\):\(.*\))/,\1:\2)/
t x2
b cont2
:x2
p
:cont2
g
s/^.*,\(.*\):\([^,)]*\):\(.*\)).*$/	lsr\2	#\3,\1/
}
--------- End of included text --------
---
Another random extraction from the mental bit stream of...
Byron A. Jeff - PhD student operating in parallel!
Georgia Tech, Atlanta GA 30332   Internet: byron at cc.gatech.edu



More information about the Comp.unix.questions mailing list