示例#1
0
        public override bool OpenDebugger()
        {
            bool status = false;

            if (cb_log == null & CallbackLog != null)
            {
                cb_log = new CallbackLogDelegate(CallbackLog);
            }
            if (cb_err == null & CallbackError != null)
            {
                cb_err = new CallbackLogDelegate(CallbackError);
            }

            cb_log?.Invoke("Open Debugger ...");
            try
            {
                string err = JLinkARM.JLINKARM_OpenEx(cb_log, cb_err);

                if (err != null)
                {
                    status = false;
                    cb_err?.Invoke("JLINKARM_OpenEx Error!");
                    return(status);
                }
                //JLinkARM.JLINKARM_SetSpeed(TIFSpeed);
                JLinkARM.JLINKARM_SetSpeed(1000);
                JLinkARM.JLINKARM_TIF_Select(TIFType);
                JLinkARM.JLINKARM_SelectDeviceFamily(JLink_Device_Family.Cortex_M3);
                //JLinkARM.JLINKARM_SetResetType(JLink_Reset_Type.Reset_Pin);
                //JLinkARM.JLINKARM_ExecCommand("endian little", IntPtr.Zero, 0);
                //JLinkARM.JLINKARM_SetResetDelay(2);
                JLinkARM.JLINKARM_Reset();

                status = true;
            }
            catch (Exception ex)
            {
                cb_err?.Invoke(ex.Message);
            }

            IsOpen = status;
            return(status);
        }