I want to cause an ARM Cortex-M3 Undefined Instruction exception for the test of my test fixture. The IAR compiler supports this with inline assembly like this:
asm(
Building on Masta79's answer:
There is a "permanently undefined" encoding listed in the ARMv7-M architecture reference manual - ARM DDI 0403D (documentation placeholder, registration required). The encoding is 0xf7fXaXXX (where 'X' is ignored). Of course instruction fetches are little-endian, so (without testing):
asm volatile (".word 0xf7f0a000\n");
should yield a guaranteed undefined instruction on any ARMv7-M or later processor.