mirror of
https://github.com/danbulant/Cosmos
synced 2026-06-12 11:11:45 +00:00
Progress on edison.
This commit is contained in:
parent
41f6442896
commit
2a0de71240
9 changed files with 134 additions and 8 deletions
|
|
@ -1,5 +1,5 @@
|
|||
; Do NOT change this next line in Dev Kit
|
||||
#define ChangeSetVersion "105955"
|
||||
#define ChangeSetVersion "20150130"
|
||||
|
||||
#ifndef BuildConfiguration
|
||||
; Currently we dont use "UserKit" but this allows us to test/compile from Inno
|
||||
|
|
|
|||
|
|
@ -56,13 +56,20 @@ namespace Cosmos.Debug.Common
|
|||
Connected = handler;
|
||||
}
|
||||
|
||||
protected void DoDebugMsg(string aMsg)
|
||||
protected virtual void DoDebugMsg(string aMsg)
|
||||
{
|
||||
mDebugWriter.WriteLine(aMsg);
|
||||
mDebugWriter.Flush();
|
||||
mOut.WriteLine(aMsg);
|
||||
mOut.Flush();
|
||||
DoDebugMsg(aMsg, true);
|
||||
}
|
||||
|
||||
private static StreamWriter mOut = new StreamWriter(@"c:\data\sources\dcoutput.txt", false)
|
||||
{
|
||||
AutoFlush = true
|
||||
};
|
||||
|
||||
protected void DoDebugMsg(string aMsg, bool aOnlyIfConnected)
|
||||
{
|
||||
if (IsConnected || aOnlyIfConnected == false)
|
||||
|
|
@ -92,6 +99,11 @@ namespace Cosmos.Debug.Common
|
|||
SendCmd(aCmd, aData, true);
|
||||
}
|
||||
|
||||
protected virtual void BeforeSendCmd()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected void SendCmd(byte aCmd, byte[] aData, bool aWait)
|
||||
{
|
||||
//System.Windows.Forms.MessageBox.Show(xSB.ToString());
|
||||
|
|
@ -115,10 +127,12 @@ namespace Cosmos.Debug.Common
|
|||
// xSB.AppendLine(x.ToString("X2"));
|
||||
//}
|
||||
//System.Windows.Forms.MessageBox.Show(xSB.ToString());
|
||||
DoDebugMsg("DC Send: " + aCmd.ToString());
|
||||
DoDebugMsg("DC Send: " + aCmd.ToString() + ", data.Length = " + aData.Length + ", aWait = " + aWait);
|
||||
|
||||
DoDebugMsg("Send locked...");
|
||||
|
||||
BeforeSendCmd();
|
||||
|
||||
if (aCmd == Vs2Ds.Noop)
|
||||
{
|
||||
// Noops dont have any data.
|
||||
|
|
@ -526,6 +540,7 @@ namespace Cosmos.Debug.Common
|
|||
{
|
||||
// Sig found, wait for messages
|
||||
mSigReceived = true;
|
||||
SendTextToConsole("SigReceived!");
|
||||
WaitForMessage();
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -14,12 +14,29 @@ namespace Cosmos.Debug.Common
|
|||
public DebugConnectorEdison(string aPort, string kernelFile) : base(aPort)
|
||||
{
|
||||
mKernelFile = kernelFile;
|
||||
// mKernelFile = @"c:\Data\Sources\OpenSource\Edison\CosmosEdison\TestKernel\WriteLineViaUBootApi\kernel";
|
||||
}
|
||||
|
||||
// "boot > "
|
||||
private byte[] mBootPrompt = new byte[7] { 98, 111, 111, 116, 32, 62, 32 };
|
||||
private byte[] mBootPromptCheck = new byte[7];
|
||||
|
||||
protected override void BeforeSendCmd()
|
||||
{
|
||||
SendRawData(new byte[1]
|
||||
{
|
||||
Vs2Ds.Noop
|
||||
});
|
||||
SendRawData(new byte[1]
|
||||
{
|
||||
Vs2Ds.Noop
|
||||
});
|
||||
SendRawData(new byte[1]
|
||||
{
|
||||
Vs2Ds.Noop
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private int mBootStage = 0;
|
||||
|
||||
|
|
@ -65,6 +82,10 @@ namespace Cosmos.Debug.Common
|
|||
}
|
||||
break;
|
||||
case 4:
|
||||
//if (WaitForBootPrompt(aPacket))
|
||||
//{
|
||||
// SendRawData("\0A");
|
||||
//}
|
||||
base.WaitForSignature(aPacket);
|
||||
return;
|
||||
}
|
||||
|
|
@ -75,6 +96,12 @@ namespace Cosmos.Debug.Common
|
|||
Next(1, WaitForSignature);
|
||||
}
|
||||
|
||||
protected override void DoDebugMsg(string aMsg)
|
||||
{
|
||||
base.DoDebugMsg(aMsg);
|
||||
|
||||
}
|
||||
|
||||
private bool WaitForBootPrompt(byte[] aPacket)
|
||||
{
|
||||
// wait for "boot > "
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ namespace Cosmos.Debug.Common
|
|||
xIncoming.Stream = mStream;
|
||||
|
||||
System.Diagnostics.Debug.WriteLine(String.Format("DC - Next: Expecting: {0}", aPacketSize));
|
||||
DoDebugMsg(String.Format("DC - Next: Expecting: {0}", aPacketSize) + "\r\n");
|
||||
|
||||
Read(xIncoming);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
; Generated at 13-1-2015 19:09:16
|
||||
|
||||
DebugStub_DebugBPs TIMES 256 dd 0
|
||||
DebugStub_MaxBPId dd 0
|
||||
|
||||
|
|
@ -10,6 +12,7 @@ Call DebugStub_InitSerial
|
|||
Call DebugStub_WaitForDbgHandshake
|
||||
Call DebugStub_Cls
|
||||
DebugStub_Init_Exit:
|
||||
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_Init_Exit
|
||||
Ret
|
||||
|
||||
DebugStub_WaitForSignature:
|
||||
|
|
@ -23,11 +26,16 @@ ROR EBX, 8
|
|||
jmp DebugStub_WaitForSignature_Block1_Begin
|
||||
DebugStub_WaitForSignature_Block1_End:
|
||||
DebugStub_WaitForSignature_Exit:
|
||||
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_WaitForSignature_Exit
|
||||
Ret
|
||||
|
||||
DebugStub_WaitForDbgHandshake:
|
||||
Mov AL, 0
|
||||
Call DebugStub_ComWriteAL
|
||||
Mov AL, 0
|
||||
Call DebugStub_ComWriteAL
|
||||
Mov AL, 0
|
||||
Call DebugStub_ComWriteAL
|
||||
|
||||
Push dword DebugStub_Const_Signature
|
||||
Mov ESI, ESP
|
||||
|
|
@ -41,8 +49,16 @@ Mov AL, DebugStub_Const_Ds2Vs_Started
|
|||
Call DebugStub_ComWriteAL
|
||||
|
||||
Call DebugStub_WaitForSignature
|
||||
Call DebugStub_Hook_OnHandshakeCompleted
|
||||
Call DebugStub_ProcessCommandBatch
|
||||
DebugStub_WaitForDbgHandshake_Exit:
|
||||
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_WaitForDbgHandshake_Exit
|
||||
Ret
|
||||
|
||||
%ifndef Exclude_Dummy_Hooks
|
||||
DebugStub_Hook_OnHandshakeCompleted:
|
||||
DebugStub_Hook_OnHandshakeCompleted_Exit:
|
||||
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_Hook_OnHandshakeCompleted_Exit
|
||||
Ret
|
||||
%endif
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,10 @@ function WaitForSignature {
|
|||
function WaitForDbgHandshake {
|
||||
// "Clear" the UART out
|
||||
AL = 0
|
||||
ComWriteAL()
|
||||
AL = 0
|
||||
ComWriteAL()
|
||||
AL = 0
|
||||
ComWriteAL()
|
||||
|
||||
// Cosmos.Debug.Consts.Consts.SerialSignature
|
||||
|
|
@ -50,6 +54,11 @@ function WaitForDbgHandshake {
|
|||
ComWriteAL()
|
||||
|
||||
WaitForSignature()
|
||||
Hook_OnHandshakeCompleted()
|
||||
ProcessCommandBatch()
|
||||
}
|
||||
|
||||
! %ifndef Exclude_Dummy_Hooks
|
||||
function Hook_OnHandshakeCompleted {
|
||||
}
|
||||
! %endif
|
||||
|
|
@ -1,3 +1,48 @@
|
|||
; Generated at 11-1-2015 15:42:05
|
||||
|
||||
DebugWaitMsg db `Waiting for debugger connection...`, 0
|
||||
|
||||
|
||||
Line 1, Parsing error: namespace DebugStub
|
||||
|
||||
%ifndef Exclude_Memory_Based_Console
|
||||
|
||||
DebugStub_Const_VidBase equ 0xB8000
|
||||
|
||||
DebugStub_Cls:
|
||||
Mov ESI, DebugStub_Const_VidBase
|
||||
|
||||
DebugStub_Cls_Block1_Begin:
|
||||
Cmp ESI, 0xB8FA0
|
||||
JAE DebugStub_Cls_Block1_End
|
||||
Mov dword [ESI + 0], 0x00
|
||||
Inc ESI
|
||||
|
||||
Mov dword [ESI + 0], 0x0A
|
||||
Inc ESI
|
||||
jmp DebugStub_Cls_Block1_Begin
|
||||
DebugStub_Cls_Block1_End:
|
||||
DebugStub_Cls_Exit:
|
||||
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_Cls_Exit
|
||||
Ret
|
||||
|
||||
DebugStub_DisplayWaitMsg:
|
||||
Mov ESI, DebugWaitMsg
|
||||
|
||||
Mov EDI, DebugStub_Const_VidBase
|
||||
Add EDI, 1640
|
||||
|
||||
DebugStub_DisplayWaitMsg_Block1_Begin:
|
||||
Cmp byte [ESI + 0], 0
|
||||
JE DebugStub_DisplayWaitMsg_Block1_End
|
||||
Mov AL, [ESI + 0]
|
||||
Mov [EDI + 0], AL
|
||||
Inc ESI
|
||||
Add EDI, 2
|
||||
jmp DebugStub_DisplayWaitMsg_Block1_Begin
|
||||
DebugStub_DisplayWaitMsg_Block1_End:
|
||||
DebugStub_DisplayWaitMsg_Exit:
|
||||
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_DisplayWaitMsg_Exit
|
||||
Ret
|
||||
|
||||
%endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
namespace DebugStub
|
||||
|
||||
const VidBase = $B8000
|
||||
var .DebugWaitMsg = 'Waiting for debugger connection...'
|
||||
|
||||
! %ifndef Exclude_Memory_Based_Console
|
||||
|
||||
const VidBase = $B8000
|
||||
|
||||
function Cls {
|
||||
ESI = #VidBase
|
||||
|
||||
|
|
@ -34,3 +37,5 @@ function DisplayWaitMsg {
|
|||
EDI + 2
|
||||
}
|
||||
}
|
||||
|
||||
! %endif
|
||||
|
|
@ -32,6 +32,11 @@ namespace Cosmos.VS.Windows
|
|||
InitializeComponent();
|
||||
}
|
||||
|
||||
private StreamWriter mOut = new StreamWriter(@"c:\data\sources\output.txt", false)
|
||||
{
|
||||
AutoFlush = true
|
||||
};
|
||||
|
||||
protected override void HandleChannelMessage(byte aChannel, byte aCommand, byte[] aData)
|
||||
{
|
||||
if (aChannel != ConsoleConsts.Channel)
|
||||
|
|
@ -41,13 +46,16 @@ namespace Cosmos.VS.Windows
|
|||
|
||||
if (aCommand == ConsoleConsts.Command_WriteText)
|
||||
{
|
||||
textBox.Text += Encoding.ASCII.GetString(aData).Replace("\t", " ");
|
||||
mOut.Write(Encoding.ASCII.GetString(aData).Replace("\t", " "));
|
||||
// textBox.Text += Encoding.ASCII.GetString(aData).Replace("\t", " ");
|
||||
}
|
||||
else
|
||||
{
|
||||
textBox.Text += ("Command '" + aCommand + "' not recognized!\r\n");
|
||||
mOut.WriteLine("Command '" + aCommand + "' not recognized");
|
||||
// textBox.Text += ("Command '" + aCommand + "' not recognized!\r\n");
|
||||
}
|
||||
textBox.ScrollToEnd();
|
||||
//textBox.ScrollToEnd();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue