On Tue, Apr 21, 2015 at 12:47:24PM -0500, Felipe Balbi wrote: > On Tue, Apr 21, 2015 at 01:36:54PM -0400, Matt Porter wrote: > > On ARM v7M, the processor will return to ARM mode when executing > > a blx instruction with bit 0 of the address == 0. Always set it > > but that's what the 'x' is for, right ? eXchange the CPU mode.
Yes. > > to 1 to stay in thumb mode. > > > > Signed-off-by: Matt Porter <mpor...@konsulko.com> > > --- > > common/cmd_boot.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/common/cmd_boot.c b/common/cmd_boot.c > > index 8f2e070..20ce652 100644 > > --- a/common/cmd_boot.c > > +++ b/common/cmd_boot.c > > @@ -38,6 +38,10 @@ static int do_go(cmd_tbl_t *cmdtp, int flag, int argc, > > char * const argv[]) > > * pass address parameter as argv[0] (aka command name), > > * and all remaining args > > */ > > +#ifdef CONFIG_CPU_V7M > > + /* For ARM V7M, set bit zero to stay in Thumb mode */ > > + addr++; > > +#endif > > what if we were in ARM state when we reached this point ? You're now > telling CPU to always switch to Thumb. Is this really what we want ? We have no ARM state on this core so that's not possible. > From ARM's instruction manual: > > > > " > The BX and BLX instructions can change the processor state from ARM to > Thumb, or from Thumb to ARM. > > BLX label always changes the state. > > BX Rm and BLX Rm derive the target state from bit[0] of Rm: > > if bit[0] of Rm is 0, the processor changes to, or remains in, ARM > state > > if bit[0] of Rm is 1, the processor changes to, or remains in, Thumb > state. Correct. The last statement is why this patch exists. There is no ARM mode on M3, we immediately fault. Having bit[0]=0 for BX/BLX is not permitted on V7M...something not covered in the generic description of these instructions. Incidentally, I forgot to update this with Kamil's comment that it should be implemented as |1 and will address that now. -Matt
signature.asc
Description: Digital signature
_______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot