home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / gnu / gcc / help / 1931 < prev    next >
Encoding:
Text File  |  1992-08-18  |  2.5 KB  |  55 lines

  1. Newsgroups: gnu.gcc.help
  2. Path: sparky!uunet!munnari.oz.au!metro!mama!greyham
  3. From: greyham@research.canon.oz.au (Graham Stoney)
  4. Subject: Re: gcc for 68332 and Position Independent Code/data
  5. Message-ID: <Bt5oAB.4Bv@research.canon.oz.au>
  6. Keywords: 68332, PIC
  7. Sender: news@research.canon.oz.au
  8. Organization: Canon Information Systems Research Australia
  9. References: <113@benjii.UUCP>
  10. Date: Tue, 18 Aug 1992 01:32:34 GMT
  11. Lines: 42
  12.  
  13. suresh@pi.COM (Suresh Kumar) writes:
  14. >I am planning to use gcc to cross compile code for a Motorola
  15. >68332 based hardware.  It was not clear from the documentation
  16. >whether gcc-2.2.2  supports the following features.
  17.  
  18. I did this with gcc 1.40 and it worked really well, although I took a long
  19. time configuring it and working out what tools I needed (but that should be
  20. much easier in 2.2.2).
  21.  
  22. >1.  Has anybody on the net used gcc to generate Motorola 68332
  23. >    instructions? 68332 instruction set is a superset of 68010
  24. >    but a subset of 68020.
  25.  
  26. You just configure it to generate 68010 code in the config file, or pass
  27. -m68000 on the gcc command line every time you compile. I'm not sure if gcc
  28. uses any of the exotic 68020 addressing modes that the CPU32 doesn't have;
  29. I'd be interested to find out. Note that the CPU32 _won't_ give you an
  30. exception if it hits an unimplemented one, your code will just do the wrong
  31. thing. I stuck with the lowest common denominator to be safe.
  32.  
  33. >2.  Can gcc generate PIC (Position Independent Code/Data) such that
  34. >    all instructions are PC-relative with 32bit offset  and global/static
  35. >    data is Ax register indirect with 32 bit offset? (Ax is one of the
  36. >    address registers). Before I execute the code, I would set up the
  37. >    Ax register to the data segment and then jump to the first instruction
  38. >    in the text segment.
  39.  
  40. Consider whether you really need to do this. From what you go on to say, it
  41. sounds like all you want to do is use the -Ttext and -Tdata switches to the
  42. linker to relocate the code or data somewhere other than starting at 0.
  43. Unless your dynamically loading programs in and out at different locations
  44. each time (in a microcontroller? :-), you don't need PIC at all, and it's a
  45. liability because it slows you down. (Also I think the real answer to your Qn
  46. is "no" 2.2.2 doesn't support it [yet]).
  47.  
  48. Good luck,
  49. Graham
  50.  
  51. -- 
  52. Graham Stoney                    | "a Perl script is correct if it's halfway
  53. Flip Dibner fan club, "Hi Flip!" |  readable and gets the job done before your
  54. Ph: +61 2 805-2909  Fax: -2929   |  boss fires you." L. Wall & R. Schwartz
  55.