gcc - Programmatically cause Undefined Instruction exception -
i want cause arm cortex-m3 undefined instruction exception test of test fixture. iar compiler supports inline assembly this:
asm("udf.w #0");
unfortunately gnu cc inline assembler not know opcode nxp lpc177x8x. writes diagnostic:
ccw3kz46.s:404: error: bad instruction `udf.w #0'
how can create function causes undefined instruction exception?
building on masta79's answer:
there "permanently undefined" encoding listed in armv7-m architecture reference manual - arm ddi 0403d (documentation placeholder, registration required). encoding 0xf7fxaxxx (where 'x' ignored). of course instruction fetches little-endian, (without testing):
asm volatile (".word 0xf7f0a000\n");
should yield guaranteed undefined instruction on armv7-m or later processor.
Comments
Post a Comment