2

I would like to write a magic value into program memory on an ARM M3 embedded device. I can just define an arbitrary constant (other than 0xFFFFFFFF, which is blank flash!) and program that at some fixed address with the help of linker sections. However, I'd quite like the magic value to be an totally invalid ARM instruction, so that it's clearly not code.

Looking at the ARM M3/ARMv7 Instruction Set References, I can't see an obvious invalid/reserved opcode listed.

The M3 devices are actually limited to Thumb2 instructions, so a fallback would be a non-Thumb2 ARM instruction, but a canonical not-an-instruction opcode would be better.

Inductiveload
  • 6,094
  • 4
  • 29
  • 55
  • 1
    I'd recommend using the BKPT instruction, so if it is executed it should break into any attached debugger. – Ross Ridge Nov 24 '16 at 04:12

0 Answers0