[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: rescue code / partition table bugs



Hi!

>I'm working in conjunction with Andrey Filippov of Elphel, Inc.  on
>software for his Elphel cameras using the 100LX chip.

Say hi to Andrey from me! Elphel is one of my favorite customers
because you really know your stuff.

>This code is what the rescue code jumps to.  Note that NOP is
>correctly coded (0x050f ... this is little endian), but the bytes of
>DI are backwards.

You are absolutely correct. I am amazed that this has not caused any
problems for other people or at Axis. I hate that the this code is 
hardcoded in mkptable. I would prefer if mkptable generated assembler
instead that was compiled. At Axis mkptable currently handles three
architectures and is starting to get messy.

I actually discovered the problem with the swapped opcodes when
porting the code to an upcoming CRIS architecture but never
reflected that the code might also be incorrect for ETRAX 100LX...

>to find the actual address one would have to add PTABLE_START to it,
>however this doesn't happen. 

I agree. In most cases the bootable partition is the first partition.
In that case the following sequence is executed (close to ploop in
head.S):

   moveq -1, $r7
   move.d [$r3], $r1
   bne
   nop
   move.d $r8, $r1
   move.d [$r3+], $r2
   sub.d $r8, $r2
   ba
   nop
   move.d [$r3+], $r5
   move.d [$r3+], $r4
   addq 16, $r3
   btstq 16, $r4
   bpl
   nop
   btstq 17, $r4
   bpl 1f
   nop
   add PTABLE_START, $r1

The interresting part is that $r7 is never set for this case so later
this happens (at flash_ok):

	cmp.d	-1, $r7
      bne 1f
      nop
      move.d PTABLE_START, $r7
      move.d RAM_INIT_MAGIC, $r8
      jump $r7

and this takes us to the first partition.

Thank you very much for debugging this! It would be interesting to hear
if someone else has experienced similar problems. I have never heard
of such problems at Axis. I will certainly fix the code ASAP and it
will be available in 2.4.26 (and ~2.6.4 if Linus is in good mood)

I can only apologize that this piece of shit made it into the
distribution. I will tell the person who wrote the code what
I think of it...

>p.s. Is there any easy way to search the contents of the archives of
>this dev-etrax mailing list? It would be acceptable to me if there was
>a way to easily download the entire archive to my computer where i
>could do the search...

I don't think so but it would be nice. I hope that it can be fixed
during the upcomming switch of the dev-etrax mail server software.

Best Regards
/Mikael