Xref: utzoo comp.sys.m68k:2015 comp.realtime:1040 comp.unix.questions:27416 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!sol.ctr.columbia.edu!emory!gatech!prism!cc.gatech.edu!byron From: byron@cc.gatech.edu (Byron A Jeff) Newsgroups: comp.sys.m68k,comp.realtime,comp.unix.questions Subject: Re: compiling 68000 code on a Sun 3 Message-ID: <18262@hydra.gatech.EDU> Date: 6 Dec 90 22:40:29 GMT References: <1990Dec5.031024.5958@uunet!unhd> Sender: gt8566a@prism.gatech.EDU Reply-To: byron@cc.gatech.edu (Byron A Jeff) Followup-To: comp.sys.m68k Organization: Georgia Institute of Technology Lines: 90 In article wgstuken@faui4n.informatik.uni-erlangen.de (Wolfgang Stukenbrock (Dipl. Zugangssystem Inf4)) writes: >rg@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@cc.gatech.edu Brought to you by Super Global Mega Corp .com