Now compare the disassembly from the two main() functions, and you can see they are different the first output has 16-bit instructions (known as Thumb mode on the Cortex-M CPU) and the second output consists of 32-bit “standard” ARM instructions.

The ARM Cortex-M3 only supports the Thumb instruction set, so what happens if we try to run this code on the QEMU virtual machine.

At this point we can see the program is now in the usage_handler() exception code.

This is what we expect as an unknown instruction causes a usage fault.In this case it’s because we intentionally modified the build to produce incorrect machine instructions, but another cause could be a branch to memory location containing data rather than code.