title: Soft reset on a Cortex-M using GDB
body: <p>I'm working on a set of debugging tools for some in-house Cortex-M4 cores. I'm building embedded (no OS) ELF images using a gcc/binutils toolchain and simulating them using a modified version of QEMU. I'm creating the interrupt vector tables at the start (i.e. 0) of my images, and correctly initialising the stack pointer, and start address (i.e. the address of main).</p>
  
  <p>The target programs are running as expected, and the debug tools which are built using the GDB remote protocol are working correctly.</p>
  
  <p>What I'm currently trying to understand is how to initiate a soft-reset from GDB. That is, arrange for the target program to be reinitialised with the stack pointer reset to the initial value in the vector table, and the PC back at the start address.</p>
  
  <p>I have already demonstrated to myself that the action of setting the PC value to 0, and running the core is not appropriate, and the result was that my "UsageFault" exception handler was invoked. (I assume that the core is in the wrong mode to execute this kind of action).</p>
  
  <p>Is there a technique, i.e. by register writes using GDB remote protocol that I can soft-reset the simulated core, that is without having to power-cycle the QEMU session?</p>