/*********************************************************************
*            (c) 1995 - 2018 SEGGER Microcontroller GmbH             *
*                        The Embedded Experts                        *
*                           www.segger.com                           *
**********************************************************************

-------------------------- END-OF-HEADER -----------------------------
*/

/*********************************************************************
*
*       ResetTarget
*/
void ResetTarget(void) {
  // In case cores 1-3 are reset, we do nothing, 
  //  as we would lose connection to these cores, when resetting the device
  //  as a reset disables the clock to them.
}

/*********************************************************************
*
*       InitTarget
*/
void InitTarget(void) { 
  Report("*************************************************");
  Report("J-Link script: iMX7D Cortex-M4 core J-Link script");
  Report("*************************************************");
  JLINK_CORESIGHT_Configure("IRPre=0;DRPre=0;IRPost=0;DRPost=0;IRLenDevice=4");
  CPU = CORTEX_M4;                                                              // Pre-select that we have a Cortex-M4 connected
  JTAG_AllowTAPReset = 1;                                                       // J-Link is allowed to use a TAP reset for JTAG-chain auto-detection
  JTAG_SetDeviceId(0, 0x4BA00477);  // 4-bits IRLen
  CORESIGHT_AddAP(0, CORESIGHT_AHB_AP);
  CORESIGHT_AddAP(1, CORESIGHT_APB_AP);
  CORESIGHT_AddAP(2, CORESIGHT_CUSTOM_AP);
  CORESIGHT_AddAP(3, CORESIGHT_CUSTOM_AP);
  CORESIGHT_AddAP(4, CORESIGHT_AHB_AP);
  CORESIGHT_IndexAHBAPToUse = 4;
}