[ECOS] printf does not work in user mode on Arm E7T

Pierre Habraken Pierre.Habraken@imag.fr
Mon Mar 31 13:11:00 GMT 2003


I just compiled and ran the test program (sources below) on the E7T
board, using this time Angel and RDI instead of Redboot: the Arm BL
instructions (and thus the call to printf) executes perfectly when the
processor is in user mode. As BL fails to execute when the program is
run against Redboot, I understand that something in the latter goes
wrong as regards user mode execution.
Can someone tell me where I could look in Redboot code in order to
understand the problem ???

Pierre


Pierre Habraken wrote:
> 
> Jonathan Larmour wrote:
> > [...]
> > > Actually, it seems that it is the 'branch to subroutine' (Arm BL)
> > > instruction which hangs when executed in user mode: I wrote a
> > > small C program the main function of which merely switches to
> > > usr mode and then call a dummy subprogram, and could observe the
> > > same behavior, ie the BL instruction hangs.
> > > I fear that the problem is related neither to printf nor to newlib
> > > or redboot but to the Arm (Samsung implementation) processor...
> >
> > Theoretically it could be RedBoot since it's up to RedBoot to set
> > the next breakpoint to implement the single stepping, although that
> > functionality itself is known to work fine elsewhere. It could also
> > be some problem with RedBoot's ability to restore state back to user
> > mode, although it's not clear why it would work for other
> > instructions, but not prior to a BL. What age is this RedBoot?
> > There were some significant patches from Mark Salter in this area
> > a while back - April 2002.
> 
> I re-built Redboot from CVS sources on last March 3rd.
> I attach below the test program I mentioned in my previous message.
> 
> > A hardware problem is always possible, but seems improbable really.
> 
> I agree. BTW, both programs (the one with printf's and the test
> program) work fine and behave as expected when compiled/linked without
> Redboot support and run on target sim...
> 
> Pierre
> 
> ============================================================
> // tryusermode.c
> 
> #include <stdio.h>
> 
> extern void toUsr();
> 
> int dummy() { return 0x1234; }
> 
> int main()
> {
>    int i, j;
> 
>    toUsr();     // go to user mode
> 
>    j = dummy(); // dummy() never entered if Redboot active
> 
>    for (i = 0; i < 10; i++) printf("%d\n", i);
> }
> ============================================================
> // tousr.S
>          .global  toUsr
> toUsr:
>          mov      r0, sp
>          stmfd    sp!, {r0, lr} // make sp_usr = sp_svc
>          ldmfd    sp, {sp, lr}^ // and  lr_usr = lr_svc
>          mov      r0, #0x10
>          msr      cpsr, r0      // go to usr mode
>          mov      pc, lr
> ============================================================
> --
> ________________________________________________________________________
> Pierre HABRAKEN - mailto:Pierre.Habraken@imag.fr
> Tél: 04 76 82 72 83 - Fax: 04 76 82 72 87
> IMAG-LSR BP72 38402 SAINT MARTIN D'HERES Cedex
> ________________________________________________________________________

-- 
________________________________________________________________________
Pierre HABRAKEN - mailto:Pierre.Habraken@imag.fr
Tél: 04 76 82 72 83 - Fax: 04 76 82 72 87
IMAG-LSR BP72 38402 SAINT MARTIN D'HERES Cedex
________________________________________________________________________

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



More information about the Ecos-discuss mailing list