Re: Data to fill into unused program space on ARM7.



Op Fri, 30 May 2008 12:33:05 +0200 schreef DanishGuy <mij@xxxxxxxxx>:
Greetings.

I'm trying to find some genious data to fill into the unused FLASH space
in my project, so that a stray program counter would get caught and my
system would reset.
I'm thinking one of multiple solutions:

:o) Loop to current position and get caught by the watchdog

:o) Jump to reset vector

:o) An illegal opcode, that will generate an interrupt

:o) A software interrupt instruction

One problem with most of the solutions is that I'm using ARM and THUMB
instructions. A THUMB jump to the reset vector might mean something else in
ARM. The best solution would be to find some data that is illegal in both
ARM and THUMB. If for instance 0xDEAD is illegal for THUMB, and 0xDEADDEAD
is illegal for ARM, them my problem would be solved.

Does anybody have a suggestion?

I'm assuming ARMv4T here.

All Thumb instructions start with a 4..7 bit opcode identifier; all ARM instructions start with a 4-bit condition code. In ARM mode, you have to use the "always"-code because the CC-bits are unknown (and no CC is illegal in principle). The "always"-code is 0xE, which in Thumb means the unconditional branch (B).

You can use this to make a NOP (branch to next instruction). The encoding for this NOP is 0xE000. In ARM mode, this means AND, MUL, STRH or an illegal sequence. Then it is straightforward to find a 32-bit sequence that will trigger an illegal opcode exception in all cases.

You can also use the unconditional branch to make a single-instruction loop. The encoding for this is 0xE7FF. In ARM mode, this means LDRB or an illegal sequence. So there is no pattern for this option.

You can also use the unconditional branch to jump back one instruction. But that would still give you an LDRB in ARM.


--
Gemaakt met Opera's revolutionaire e-mailprogramma: http://www.opera.com/mail/
.



Relevant Pages

  • Re: ARm Thumb ISA
    ... sufficent bandwith ARM will always be faster than Thumb 1. ... require more than one Thumb instruction. ... In the general the choice of ISA dictates the requirements for memory ...
    (comp.arch.embedded)
  • Re: word size.
    ... between Arm and thumb for the processor mode. ... now I am running in Arm mode so I am assuming that a word is 32-bits. ... If I switch to thumb mode then 16-bits will be used per instruction. ...
    (comp.arch.embedded)
  • Re: non load/store architecture?
    ... because the pipelining masks the latency. ... get in there to write a decent instruction schedule. ... familiar with the ARM, and its Thumb mode? ... These Thumb instructions are translated into ...
    (comp.arch.embedded)
  • Re: Barring and guitar neck shape
    ... Hello Steve-I've been playing for 35 years and I use barred positions ... The thumb supplies leverage for whatever position your LH ... Use of gravity or arm weight ... To get the "feel" of using arm weight for barring, ...
    (rec.music.makers.guitar.jazz)
  • Re: IBM 45nm -- new or licensed from Intel?
    ... constant table would be used while in cache, ... that much of the code in an instruction block is likely to be used. ... Yes constant loads can be scheduled freely, ... number of registers (which is not the case between x86-64 and ARM), ...
    (comp.arch)