|
楼主 |
发表于 2022-9-12 11:11:36
|
显示全部楼层
经过两天的摸索,终于搞定了,RTT确实很快,好用。最主要的就4个接口 打开 关闭,读,写 已经满足目前的需求。 导入.axf文件暂时没空折腾了。
private int jLink_Recv(uint ch,out string rxStr)
{
byte[] tempBuffer = new byte[1024];
rxStr = "";
int size = JLinkHandler.JLINK_RTTERMINAL_Read(ch, tempBuffer, 1024);
if (size > 0)
{
byte[] rxBytes = new byte[size];
Array.Copy(tempBuffer, rxBytes, rxBytes.Length);
for (int i = 0; i < rxBytes.Length; i++)
{
if (rxBytes[i] == 0xff) rxBytes[i] = (byte)('|');
if (rxBytes[i] == 0x1b) rxBytes[i] = (byte)('^');
}
rxStr = System.Text.Encoding.UTF8.GetString(rxBytes);
Console.Write(rxStr);
}
return size;
} |
|