This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problems with port to Hitex HiCO.SH-4 board.


On Mon, 2003-07-21 at 12:24, Nick Garnett wrote:
> "Gary D. Thomas" <gary.thomas@mind.be> writes:
> 
> > On Mon, 2003-07-21 at 11:27, Francois Retief wrote:
> > 
> > >     /* construct digits into buffer in reverse order */
> > >     if( n == 0 ) buf[bpos++] = '0';
> > > 8002797a:	00 ea       	mov	#0,r10
> > > 8002797c:	b8 2b       	tst	r11,r11
> > > 8002797e:	2f 8f       	bf.s	800279e0 <_diag_write_long_num+0xa0>
> > > 80027980:	30 e1       	mov	#48,r1
> > > 80027982:	01 ea       	mov	#1,r10
> > > 80027984:	10 2e       	mov.b	r1,@r14
> > >     else while( n != 0 )
> > >     {
> > >         cyg_ucount8 d = n % base;
> > >         buf[bpos++] = digits[d];                  
> > >         n /= base;                     <<<--- Expecting a DIV opcode here
> > >     }
> > > 
> > 
> > Odd.  It looks like this whole 'while' loop has vanished!  This could
> > certainly cause you problems later on.  Try commenting out the 'else'
> > to make it look like this:
> >     if( n == 0 ) buf[bpos++] = '0';
> >     /*else*/ while( n != 0 )
> >     { 
> >         cyg_ucount8 d = n % base;
> >         buf[bpos++] = digits[d];
> >         n /= base;
> >     }
> > 
> > You might also try changing the optimization level from -O2 to be -O1.
> 
> That bf.s 800279e0 jumps beyond the listed end of the function. It
> looks like the compiler has moved the whole while loop out of the main
> body of the routine. It is in an else clause after all.
> 

Indeed.  Too bad it was off the end of what Francois sent, so we
can't tell what it's doing nonetheless.

-- 
Gary D. Thomas <gary.thomas@mind.be>


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]