/*********************************************************************
*            (c) 1995 - 2018 SEGGER Microcontroller GmbH             *
*                        The Embedded Experts                        *
*                           www.segger.com                           *
**********************************************************************

-------------------------- END-OF-HEADER -----------------------------

File    : YTM32B1LE04.JLinkScript
Purpose : Handle SRAM ECC init for YTM32B1LE04 series
Literature:
  [1]  J-Link User Guide

Additional information:
  For more information about public functions that can be implemented in order to customize J-Link actions, please refer to [1]
*/

/*********************************************************************
*
*       Constants (similar to defines)
*
**********************************************************************
*/
__constant U32 SRAM_START_ADDRESS   = 0x20000000;   // SRAM Start address
__constant U32 SRAM_SIZE            = 0x2000;       // SRAM Size

//
// User-specified constants to be used by PCode
//

/*********************************************************************
*
*       ResetTarget
*/
void SetupTarget(void) {
    int status;
    status = 0;

    status = JLINK_MEM_Preserve(SRAM_START_ADDRESS, SRAM_SIZE);
    if(-2 == status){
        JLINK_SYS_Report("Init SRAM ECC.");
        JLINK_MEM_Fill(SRAM_START_ADDRESS, SRAM_SIZE, 0x0);
    }
}
