function Reset()
{
  TargetInterface.trst();
  TargetInterface.beginDebugAccess();
  /* Perform a soft reset of the target */
  TargetInterface.setICEBreakerBreakpoint(0, 0x00000000, 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF, 0x100, 0xF7);
  TargetInterface.pokeWord(0xFFFE200C, 0xDEAD);
  TargetInterface.endDebugAccess(true);
  TargetInterface.waitForDebugState(1000);
  TargetInterface.trst();
}

function SDRAMReset()
{
  Reset();
  TargetInterface.pokeWord(0xffff1000, 0x100034c0);
  TargetInterface.pokeWord(0xFFFE2008, 1); /* RCPCRemapCtrl: Locate external SDRAM at 0x00000000 */

}

function FLASHReset()
{
  Reset();
  TargetInterface.pokeWord(0xffff1000, 0x100034c0);
  TargetInterface.pokeWord(0xFFFE2008, 0); /* RCPCRemapCtrl: Locate external static memory at 0x00000000 */
}

function SRAMReset()
{
  Reset();
  TargetInterface.pokeWord(0xffff1000, 0x100034c0);
  TargetInterface.pokeWord(0xFFFE2008, 2); /* RCPCRemapCtrl: Locate internal static memory at 0x00000000 */
}

