delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/29/11:10:10

From: Leendert Combee <combeel AT oslo DOT geco-prakla DOT slb DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: gcc as crosscompiler
Date: Tue, 29 Dec 1998 16:45:50 +0100
Organization: Geco-Prakla
Lines: 51
Message-ID: <3688F92E.7F88990@oslo.geco-prakla.slb.com>
NNTP-Posting-Host: sunw220.oslo.geco-prakla.slb.com
Mime-Version: 1.0
X-Mailer: Mozilla 4.04j2 [en] (X11; I; SunOS 5.5.1 sun4u)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

<HTML>
I use gcc/djgpp all the time, now I need to ask something&nbsp; offtopic
but related to using gcc as
<BR>cross-compiler.&nbsp; I tried to find appropriate resources on the
web/newsgroups&nbsp; to resolve my
<BR>compiling problem but could not find them sofar.&nbsp; Any help will
be much approeciated - otherwise
<BR>please ignore my message below.
<BR>-----------------------------------------------------------

<P>&nbsp;I am using gcc as a cross-compiler for (Hitachi) SH70xx type microcontroller.
(gcc 2.7.2.1)
<BR>(I use unix gcc binaries as well as dos binaries; both were created
by 'Cygnus' for free distribution
<BR>, the dos version is based on the older djgpp version 1.12m4 etc.,
but that's not the issue&nbsp; here - I
<BR>obviously use the latest djgpp for normal compiling etc.)
<BR><B>Problem: I can't get gcc to produce the (SH) MAC.W instruction</B>
(multiply and accumulate).
<BR>Whatever optimisation switches I use (typically gcc -m1 -O2 ....),
it always breaks a loop like

<P>&nbsp; for (i=0; i&lt;n; i++)&nbsp; mac&nbsp; += a[i]*b[i];

<P>up into seperate&nbsp; MOV.W's for a[i] and b[i] and&nbsp; then a MUL(tiply)
and an ADD(ition)... This
<BR>takes a lot of cycles while it can be done with a simple single MAC.W
instruction.&nbsp; Then I tried
<BR>inline assembly or - alternatively - modifying the assembler output.
This is fine, <I>e</I><B>xcept then</B>
<BR><B>gdb (with target sim) chokes on the MAC instruction</B> (SIGSEGV
- it plainly aborts). I am pretty
<BR>sure I have the MAC instruction correct etc., so following this my
conclusion is that :

<P>&nbsp;&nbsp;&nbsp;&nbsp; - either I am missing something fundamental
here,
<BR>&nbsp;&nbsp;&nbsp;&nbsp; - or gcc output for SH processor doesn't know
about the MAC instruction and neither does
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gdb. Strangely, the
assembler does know about (and complains when I do not specify
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the instruction arguments
correctly).

<P>&nbsp;Any SH/gcc programmers out there that can help?! any ideas/help/etc
is *much* appreciated.

<P>-Leendert Combee
<BR>&nbsp;&nbsp; email: combeel AT oslo DOT geco-prakla DOT slb DOT com
<BR>------------------------------------------------------------------</HTML>

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019