-
Notifications
You must be signed in to change notification settings - Fork 243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example of advanced decoder #104
Comments
I do have one on my side, will try to package it up and document it on the wiki soon. |
Could you please provide any example? I am not javascript pro and reverse engineering what should decoder class look like is quite difficult for me... |
I'll try to write up one of my examples that I have later this week.
It uses data transferred in a protocol buffer format.
…On Mon, Apr 6, 2020 at 6:50 AM Patrik Bachan ***@***.***> wrote:
Hi @Marus @haneefdm, do you have some working advanced decoder or Docs for it? I'd really love to decode some traces.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
--
Marcel Ball <[email protected]>
-----------------------------------------------
The purpose of writing is to inflate weak ideas,
obscure pure reasoning, and inhibit clarity.
With a little practice, writing can be an intimidating
and impenetrable fog!
- Calvin
|
@Marus any chance to get some example? 😊 |
Hi @Marus, that sounds really useful, I'd be very interested in this as well. Anything we can do to help? |
Hope to be answered |
This is what I see... |
Hint for (me) writing the documentation for this. The Advanced decoder must implement the interface defined in cortex-debug/src/frontend/swo/common.ts Line 87 in eda3058
"decoder" option + setting the "ports" option. "config" can be used to send a JSON object into init function for custom config properties.
|
Hello, this topic is still actual for me, do you have any template for this? |
Hi for me is this topic still important,
premise:
launch.json ...
"rttConfig": {
"enabled": true,
"address": "auto",
"decoders": [
{
"port": 0,
"type": "console",
"label": "RTT Channel 0"
},
{
"ports":[0],
"type": "advanced",
"decoder": "${workspaceFolder}/extern/debug_rtt/advancedecoder/decoder.js",
"config":{
"ports":[0],
"type": "advanced",
"var1":"this is var 1.",
"graphid":"id"
},
},
]
},
... decoder.ts import * as vscode from 'vscode';
import { SWOAdvancedDecoderConfig } from './common';
import { AdvancedDecoder } from '../common';
import * as fs from 'fs';
class MYAdvancedDecoder implements AdvancedDecoder {
private output:(output: string)=>void;
private cc:number;
private count:number;
private graphId: string;
init(
config: SWOAdvancedDecoderConfig,
outputData: (output: string) => void,
graphData: (data: number, id: string) => void):void
{
this.output=outputData;
this.count=0;
this.cc=10;
this.graphId=config.graphId;
}
public softwareEvent(port:number,data: Buffer) {
this.count++;
this.output(`${this.count},${data.length}: ${data.buffer}\n`);
}
public synchronized() {}
public lostSynchronization() {}
public typeName():string{return "advanced";};
public outputLabel(): string{return "rtt";}
}
export default MYAdvancedDecoder; remarks
but
|
@e-sr Would you mind editing the Wiki and adding a section for this topic. Thnaks btw. https://github.com/Marus/cortex-debug/wiki/SWO-Output Question though, you have references to items from I have never looked at this area myself, but some comments
Not sure what you mean. Do you have a screenshot? What is an OUTPUT terminal. It appears it is going to an OutputChannel (one of the items in the OUTPUT tab) which is not a terminal. This was written in the days when Terminals were not flexible. When I ported almost everything to start using Terminals, I did not touch this part as I did not have an example project. The idea I think is that you are given callbacks/functions to either
Depends on the version of the TS compiler. It is getting stricter and stricter. I would have a constructor or declare things like this if you want to avoid a constructor. I believe this was written when Typescript did not allow constructors on interfaces private output: (output: string)=>void | undefined;
private cc = 0;
private count = 0 ;
private graphId = ''; And then you might get a warning/error on the following line, you can change it to the following
I believe you are supposed to use the
|
I will look into redirecting the OUTPUT to a terminal if you are willing to test it. Yes, opening new windows is also problematic. What I might do is to create the terminal on your first output to that terminal in case you never use it. Once created, it will be cleared for every new use and will just stay there until closed. |
@haneefdm will try to get it working properly and then if the case i will update the documentation. But i will need some time... |
I recently made a TraceDecoder that can parse a variety of mixed data types from one or more channels and display it on real time graph. You can take a look at the decoder implementation as an example. The repository is also based on TypeScript and complies to JS. This can be a good example for those who wants to setup a more complex project. Also, I encountered an issue in the base Hopefully this helps. |
Hi,
could you provide some small example of "advanced" decoder?
Can such decoder send output only to plots or even to console?
The text was updated successfully, but these errors were encountered: