├── .gitattributes
├── .gitignore
├── DWGui.sln
├── DWGui
├── App.config
├── DWGui.csproj
├── Form1.Designer.cs
├── Form1.cs
├── Form1.resx
├── Program.cs
└── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── DebugWire
├── Address.cs
├── DebugWire.cs
├── DebugWire.csproj
├── Instruction.cs
├── Properties
│ └── AssemblyInfo.cs
├── Signature.cs
└── TwoBytes.cs
├── LICENSE
└── README.md
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | project.fragment.lock.json
46 | artifacts/
47 |
48 | *_i.c
49 | *_p.c
50 | *_i.h
51 | *.ilk
52 | *.meta
53 | *.obj
54 | *.pch
55 | *.pdb
56 | *.pgc
57 | *.pgd
58 | *.rsp
59 | *.sbr
60 | *.tlb
61 | *.tli
62 | *.tlh
63 | *.tmp
64 | *.tmp_proj
65 | *.log
66 | *.vspscc
67 | *.vssscc
68 | .builds
69 | *.pidb
70 | *.svclog
71 | *.scc
72 |
73 | # Chutzpah Test files
74 | _Chutzpah*
75 |
76 | # Visual C++ cache files
77 | ipch/
78 | *.aps
79 | *.ncb
80 | *.opendb
81 | *.opensdf
82 | *.sdf
83 | *.cachefile
84 | *.VC.db
85 | *.VC.VC.opendb
86 |
87 | # Visual Studio profiler
88 | *.psess
89 | *.vsp
90 | *.vspx
91 | *.sap
92 |
93 | # TFS 2012 Local Workspace
94 | $tf/
95 |
96 | # Guidance Automation Toolkit
97 | *.gpState
98 |
99 | # ReSharper is a .NET coding add-in
100 | _ReSharper*/
101 | *.[Rr]e[Ss]harper
102 | *.DotSettings.user
103 |
104 | # JustCode is a .NET coding add-in
105 | .JustCode
106 |
107 | # TeamCity is a build add-in
108 | _TeamCity*
109 |
110 | # DotCover is a Code Coverage Tool
111 | *.dotCover
112 |
113 | # NCrunch
114 | _NCrunch_*
115 | .*crunch*.local.xml
116 | nCrunchTemp_*
117 |
118 | # MightyMoose
119 | *.mm.*
120 | AutoTest.Net/
121 |
122 | # Web workbench (sass)
123 | .sass-cache/
124 |
125 | # Installshield output folder
126 | [Ee]xpress/
127 |
128 | # DocProject is a documentation generator add-in
129 | DocProject/buildhelp/
130 | DocProject/Help/*.HxT
131 | DocProject/Help/*.HxC
132 | DocProject/Help/*.hhc
133 | DocProject/Help/*.hhk
134 | DocProject/Help/*.hhp
135 | DocProject/Help/Html2
136 | DocProject/Help/html
137 |
138 | # Click-Once directory
139 | publish/
140 |
141 | # Publish Web Output
142 | *.[Pp]ublish.xml
143 | *.azurePubxml
144 | # TODO: Comment the next line if you want to checkin your web deploy settings
145 | # but database connection strings (with potential passwords) will be unencrypted
146 | #*.pubxml
147 | *.publishproj
148 |
149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
150 | # checkin your Azure Web App publish settings, but sensitive information contained
151 | # in these scripts will be unencrypted
152 | PublishScripts/
153 |
154 | # NuGet Packages
155 | *.nupkg
156 | # The packages folder can be ignored because of Package Restore
157 | **/packages/*
158 | # except build/, which is used as an MSBuild target.
159 | !**/packages/build/
160 | # Uncomment if necessary however generally it will be regenerated when needed
161 | #!**/packages/repositories.config
162 | # NuGet v3's project.json files produces more ignoreable files
163 | *.nuget.props
164 | *.nuget.targets
165 |
166 | # Microsoft Azure Build Output
167 | csx/
168 | *.build.csdef
169 |
170 | # Microsoft Azure Emulator
171 | ecf/
172 | rcf/
173 |
174 | # Windows Store app package directories and files
175 | AppPackages/
176 | BundleArtifacts/
177 | Package.StoreAssociation.xml
178 | _pkginfo.txt
179 |
180 | # Visual Studio cache files
181 | # files ending in .cache can be ignored
182 | *.[Cc]ache
183 | # but keep track of directories ending in .cache
184 | !*.[Cc]ache/
185 |
186 | # Others
187 | ClientBin/
188 | ~$*
189 | *~
190 | *.dbmdl
191 | *.dbproj.schemaview
192 | *.jfm
193 | *.pfx
194 | *.publishsettings
195 | node_modules/
196 | orleans.codegen.cs
197 |
198 | # Since there are multiple workflows, uncomment next line to ignore bower_components
199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
200 | #bower_components/
201 |
202 | # RIA/Silverlight projects
203 | Generated_Code/
204 |
205 | # Backup & report files from converting an old project file
206 | # to a newer Visual Studio version. Backup files are not needed,
207 | # because we have git ;-)
208 | _UpgradeReport_Files/
209 | Backup*/
210 | UpgradeLog*.XML
211 | UpgradeLog*.htm
212 |
213 | # SQL Server files
214 | *.mdf
215 | *.ldf
216 |
217 | # Business Intelligence projects
218 | *.rdl.data
219 | *.bim.layout
220 | *.bim_*.settings
221 |
222 | # Microsoft Fakes
223 | FakesAssemblies/
224 |
225 | # GhostDoc plugin setting file
226 | *.GhostDoc.xml
227 |
228 | # Node.js Tools for Visual Studio
229 | .ntvs_analysis.dat
230 |
231 | # Visual Studio 6 build log
232 | *.plg
233 |
234 | # Visual Studio 6 workspace options file
235 | *.opt
236 |
237 | # Visual Studio LightSwitch build output
238 | **/*.HTMLClient/GeneratedArtifacts
239 | **/*.DesktopClient/GeneratedArtifacts
240 | **/*.DesktopClient/ModelManifest.xml
241 | **/*.Server/GeneratedArtifacts
242 | **/*.Server/ModelManifest.xml
243 | _Pvt_Extensions
244 |
245 | # Paket dependency manager
246 | .paket/paket.exe
247 | paket-files/
248 |
249 | # FAKE - F# Make
250 | .fake/
251 |
252 | # JetBrains Rider
253 | .idea/
254 | *.sln.iml
255 |
256 | # CodeRush
257 | .cr/
258 |
259 | # Python Tools for Visual Studio (PTVS)
260 | __pycache__/
261 | *.pyc
--------------------------------------------------------------------------------
/DWGui.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.26228.4
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DWGui", "DWGui\DWGui.csproj", "{63F28AE8-2CFE-46AE-996D-5533E1423D40}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DebugWire", "DebugWire\DebugWire.csproj", "{36F245C9-87F4-47A2-A47E-81AD440D2A8D}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {63F28AE8-2CFE-46AE-996D-5533E1423D40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {63F28AE8-2CFE-46AE-996D-5533E1423D40}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {63F28AE8-2CFE-46AE-996D-5533E1423D40}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {63F28AE8-2CFE-46AE-996D-5533E1423D40}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {36F245C9-87F4-47A2-A47E-81AD440D2A8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {36F245C9-87F4-47A2-A47E-81AD440D2A8D}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {36F245C9-87F4-47A2-A47E-81AD440D2A8D}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {36F245C9-87F4-47A2-A47E-81AD440D2A8D}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/DWGui/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/DWGui/DWGui.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {63F28AE8-2CFE-46AE-996D-5533E1423D40}
8 | WinExe
9 | DWGui
10 | DWGui
11 | v4.6.2
12 | 512
13 | true
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | Form
50 |
51 |
52 | Form1.cs
53 |
54 |
55 |
56 |
57 | Form1.cs
58 |
59 |
60 | ResXFileCodeGenerator
61 | Resources.Designer.cs
62 | Designer
63 |
64 |
65 | True
66 | Resources.resx
67 |
68 |
69 | SettingsSingleFileGenerator
70 | Settings.Designer.cs
71 |
72 |
73 | True
74 | Settings.settings
75 | True
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 | {36f245c9-87f4-47a2-a47e-81ad440d2a8d}
84 | DebugWire
85 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/DWGui/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace DWGui
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// Erforderliche Designervariable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Verwendete Ressourcen bereinigen.
12 | ///
13 | /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Vom Windows Form-Designer generierter Code
24 |
25 | ///
26 | /// Erforderliche Methode für die Designerunterstützung.
27 | /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.btn_stop = new System.Windows.Forms.Button();
32 | this.btn_start = new System.Windows.Forms.Button();
33 | this.combo_ports = new System.Windows.Forms.ComboBox();
34 | this.btn_connect = new System.Windows.Forms.Button();
35 | this.btn_signature = new System.Windows.Forms.Button();
36 | this.button2 = new System.Windows.Forms.Button();
37 | this.btn_ss = new System.Windows.Forms.Button();
38 | this.label1 = new System.Windows.Forms.Label();
39 | this.label2 = new System.Windows.Forms.Label();
40 | this.numeric_fcpu = new System.Windows.Forms.NumericUpDown();
41 | this.tabControl = new System.Windows.Forms.TabControl();
42 | this.tab_general = new System.Windows.Forms.TabPage();
43 | this.label6 = new System.Windows.Forms.Label();
44 | this.label5 = new System.Windows.Forms.Label();
45 | this.label4 = new System.Windows.Forms.Label();
46 | this.check_reset_restart = new System.Windows.Forms.CheckBox();
47 | this.btn_reset = new System.Windows.Forms.Button();
48 | this.label3 = new System.Windows.Forms.Label();
49 | this.label_sig_chip = new System.Windows.Forms.Label();
50 | this.txt_signature = new System.Windows.Forms.TextBox();
51 | this.label_signature = new System.Windows.Forms.Label();
52 | this.tab_infos = new System.Windows.Forms.TabPage();
53 | this.groupBox1 = new System.Windows.Forms.GroupBox();
54 | this.btn_instr_read = new System.Windows.Forms.Button();
55 | this.btn_instr_write = new System.Windows.Forms.Button();
56 | this.txt_instr = new System.Windows.Forms.TextBox();
57 | this.group_hwbp = new System.Windows.Forms.GroupBox();
58 | this.btn_bp_read = new System.Windows.Forms.Button();
59 | this.btn_bp_write = new System.Windows.Forms.Button();
60 | this.txt_BP = new System.Windows.Forms.TextBox();
61 | this.group_pc = new System.Windows.Forms.GroupBox();
62 | this.btn_pc_read = new System.Windows.Forms.Button();
63 | this.btn_pc_write = new System.Windows.Forms.Button();
64 | this.txt_pc = new System.Windows.Forms.TextBox();
65 | ((System.ComponentModel.ISupportInitialize)(this.numeric_fcpu)).BeginInit();
66 | this.tabControl.SuspendLayout();
67 | this.tab_general.SuspendLayout();
68 | this.tab_infos.SuspendLayout();
69 | this.groupBox1.SuspendLayout();
70 | this.group_hwbp.SuspendLayout();
71 | this.group_pc.SuspendLayout();
72 | this.SuspendLayout();
73 | //
74 | // btn_stop
75 | //
76 | this.btn_stop.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
77 | | System.Windows.Forms.AnchorStyles.Right)));
78 | this.btn_stop.Enabled = false;
79 | this.btn_stop.Location = new System.Drawing.Point(582, 12);
80 | this.btn_stop.Name = "btn_stop";
81 | this.btn_stop.Size = new System.Drawing.Size(75, 24);
82 | this.btn_stop.TabIndex = 0;
83 | this.btn_stop.Text = "RESUME";
84 | this.btn_stop.UseVisualStyleBackColor = true;
85 | this.btn_stop.Click += new System.EventHandler(this.btn_stop_Click);
86 | //
87 | // btn_start
88 | //
89 | this.btn_start.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
90 | | System.Windows.Forms.AnchorStyles.Right)));
91 | this.btn_start.Enabled = false;
92 | this.btn_start.Location = new System.Drawing.Point(501, 13);
93 | this.btn_start.Name = "btn_start";
94 | this.btn_start.Size = new System.Drawing.Size(75, 23);
95 | this.btn_start.TabIndex = 1;
96 | this.btn_start.Text = "BREAK";
97 | this.btn_start.UseVisualStyleBackColor = true;
98 | this.btn_start.Click += new System.EventHandler(this.btn_start_Click);
99 | //
100 | // combo_ports
101 | //
102 | this.combo_ports.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
103 | | System.Windows.Forms.AnchorStyles.Right)));
104 | this.combo_ports.FormattingEnabled = true;
105 | this.combo_ports.Location = new System.Drawing.Point(54, 15);
106 | this.combo_ports.Name = "combo_ports";
107 | this.combo_ports.Size = new System.Drawing.Size(117, 21);
108 | this.combo_ports.TabIndex = 2;
109 | this.combo_ports.Click += new System.EventHandler(this.combo_ports_Click);
110 | //
111 | // btn_connect
112 | //
113 | this.btn_connect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
114 | | System.Windows.Forms.AnchorStyles.Right)));
115 | this.btn_connect.Location = new System.Drawing.Point(394, 14);
116 | this.btn_connect.Name = "btn_connect";
117 | this.btn_connect.Size = new System.Drawing.Size(72, 22);
118 | this.btn_connect.TabIndex = 3;
119 | this.btn_connect.Text = "Connect";
120 | this.btn_connect.UseVisualStyleBackColor = true;
121 | this.btn_connect.Click += new System.EventHandler(this.btn_connect_Click);
122 | //
123 | // btn_signature
124 | //
125 | this.btn_signature.Location = new System.Drawing.Point(229, 12);
126 | this.btn_signature.Name = "btn_signature";
127 | this.btn_signature.Size = new System.Drawing.Size(92, 23);
128 | this.btn_signature.TabIndex = 5;
129 | this.btn_signature.Text = " Read Signature";
130 | this.btn_signature.UseVisualStyleBackColor = true;
131 | this.btn_signature.Click += new System.EventHandler(this.btn_signature_Click);
132 | //
133 | // button2
134 | //
135 | this.button2.Location = new System.Drawing.Point(229, 166);
136 | this.button2.Name = "button2";
137 | this.button2.Size = new System.Drawing.Size(92, 23);
138 | this.button2.TabIndex = 7;
139 | this.button2.Text = "Deactivate DW";
140 | this.button2.UseVisualStyleBackColor = true;
141 | this.button2.Click += new System.EventHandler(this.button2_Click);
142 | //
143 | // btn_ss
144 | //
145 | this.btn_ss.Location = new System.Drawing.Point(229, 116);
146 | this.btn_ss.Name = "btn_ss";
147 | this.btn_ss.Size = new System.Drawing.Size(92, 23);
148 | this.btn_ss.TabIndex = 8;
149 | this.btn_ss.Text = "Single Step";
150 | this.btn_ss.UseVisualStyleBackColor = true;
151 | this.btn_ss.Click += new System.EventHandler(this.button3_Click);
152 | //
153 | // label1
154 | //
155 | this.label1.AutoSize = true;
156 | this.label1.Location = new System.Drawing.Point(12, 18);
157 | this.label1.Name = "label1";
158 | this.label1.Size = new System.Drawing.Size(36, 13);
159 | this.label1.TabIndex = 9;
160 | this.label1.Text = "Serial:";
161 | //
162 | // label2
163 | //
164 | this.label2.AutoSize = true;
165 | this.label2.Location = new System.Drawing.Point(194, 18);
166 | this.label2.Name = "label2";
167 | this.label2.Size = new System.Drawing.Size(100, 13);
168 | this.label2.TabIndex = 10;
169 | this.label2.Text = "Target F_CPU (Hz):";
170 | //
171 | // numeric_fcpu
172 | //
173 | this.numeric_fcpu.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
174 | | System.Windows.Forms.AnchorStyles.Right)));
175 | this.numeric_fcpu.Increment = new decimal(new int[] {
176 | 100000,
177 | 0,
178 | 0,
179 | 0});
180 | this.numeric_fcpu.Location = new System.Drawing.Point(300, 16);
181 | this.numeric_fcpu.Maximum = new decimal(new int[] {
182 | 60000000,
183 | 0,
184 | 0,
185 | 0});
186 | this.numeric_fcpu.Name = "numeric_fcpu";
187 | this.numeric_fcpu.Size = new System.Drawing.Size(78, 20);
188 | this.numeric_fcpu.TabIndex = 11;
189 | this.numeric_fcpu.Value = new decimal(new int[] {
190 | 1200000,
191 | 0,
192 | 0,
193 | 0});
194 | //
195 | // tabControl
196 | //
197 | this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
198 | | System.Windows.Forms.AnchorStyles.Left)
199 | | System.Windows.Forms.AnchorStyles.Right)));
200 | this.tabControl.Controls.Add(this.tab_general);
201 | this.tabControl.Controls.Add(this.tab_infos);
202 | this.tabControl.Enabled = false;
203 | this.tabControl.Location = new System.Drawing.Point(12, 42);
204 | this.tabControl.Name = "tabControl";
205 | this.tabControl.SelectedIndex = 0;
206 | this.tabControl.Size = new System.Drawing.Size(645, 316);
207 | this.tabControl.TabIndex = 12;
208 | //
209 | // tab_general
210 | //
211 | this.tab_general.Controls.Add(this.label6);
212 | this.tab_general.Controls.Add(this.label5);
213 | this.tab_general.Controls.Add(this.label4);
214 | this.tab_general.Controls.Add(this.check_reset_restart);
215 | this.tab_general.Controls.Add(this.btn_reset);
216 | this.tab_general.Controls.Add(this.label3);
217 | this.tab_general.Controls.Add(this.label_sig_chip);
218 | this.tab_general.Controls.Add(this.txt_signature);
219 | this.tab_general.Controls.Add(this.label_signature);
220 | this.tab_general.Controls.Add(this.btn_signature);
221 | this.tab_general.Controls.Add(this.btn_ss);
222 | this.tab_general.Controls.Add(this.button2);
223 | this.tab_general.Location = new System.Drawing.Point(4, 22);
224 | this.tab_general.Name = "tab_general";
225 | this.tab_general.Padding = new System.Windows.Forms.Padding(3);
226 | this.tab_general.Size = new System.Drawing.Size(637, 290);
227 | this.tab_general.TabIndex = 0;
228 | this.tab_general.Text = "General";
229 | this.tab_general.UseVisualStyleBackColor = true;
230 | //
231 | // label6
232 | //
233 | this.label6.AutoSize = true;
234 | this.label6.Location = new System.Drawing.Point(349, 166);
235 | this.label6.Name = "label6";
236 | this.label6.Size = new System.Drawing.Size(257, 39);
237 | this.label6.TabIndex = 17;
238 | this.label6.Text = "Note: After DW was deactivated you can reflash the \r\ntarget via ISP again, but if" +
239 | " you want to use DW \r\nagain you has to recycle power!\r\n";
240 | //
241 | // label5
242 | //
243 | this.label5.AutoSize = true;
244 | this.label5.Location = new System.Drawing.Point(22, 166);
245 | this.label5.Name = "label5";
246 | this.label5.Size = new System.Drawing.Size(116, 13);
247 | this.label5.TabIndex = 16;
248 | this.label5.Text = "Deactivate Debugwire:";
249 | //
250 | // label4
251 | //
252 | this.label4.AutoSize = true;
253 | this.label4.Location = new System.Drawing.Point(26, 121);
254 | this.label4.Name = "label4";
255 | this.label4.Size = new System.Drawing.Size(64, 13);
256 | this.label4.TabIndex = 15;
257 | this.label4.Text = "Single Step:";
258 | //
259 | // check_reset_restart
260 | //
261 | this.check_reset_restart.AutoSize = true;
262 | this.check_reset_restart.Checked = true;
263 | this.check_reset_restart.CheckState = System.Windows.Forms.CheckState.Checked;
264 | this.check_reset_restart.Location = new System.Drawing.Point(352, 72);
265 | this.check_reset_restart.Name = "check_reset_restart";
266 | this.check_reset_restart.Size = new System.Drawing.Size(121, 17);
267 | this.check_reset_restart.TabIndex = 14;
268 | this.check_reset_restart.Text = "Restart after Reset?";
269 | this.check_reset_restart.UseVisualStyleBackColor = true;
270 | //
271 | // btn_reset
272 | //
273 | this.btn_reset.Location = new System.Drawing.Point(229, 68);
274 | this.btn_reset.Name = "btn_reset";
275 | this.btn_reset.Size = new System.Drawing.Size(92, 23);
276 | this.btn_reset.TabIndex = 13;
277 | this.btn_reset.Text = "Reset Target";
278 | this.btn_reset.UseVisualStyleBackColor = true;
279 | this.btn_reset.Click += new System.EventHandler(this.btn_reset_Click);
280 | //
281 | // label3
282 | //
283 | this.label3.AutoSize = true;
284 | this.label3.Location = new System.Drawing.Point(22, 73);
285 | this.label3.Name = "label3";
286 | this.label3.Size = new System.Drawing.Size(68, 13);
287 | this.label3.TabIndex = 12;
288 | this.label3.Text = "Reset target:";
289 | //
290 | // label_sig_chip
291 | //
292 | this.label_sig_chip.AutoSize = true;
293 | this.label_sig_chip.Location = new System.Drawing.Point(349, 17);
294 | this.label_sig_chip.Name = "label_sig_chip";
295 | this.label_sig_chip.Size = new System.Drawing.Size(31, 13);
296 | this.label_sig_chip.TabIndex = 11;
297 | this.label_sig_chip.Text = "Chip:";
298 | //
299 | // txt_signature
300 | //
301 | this.txt_signature.Location = new System.Drawing.Point(112, 14);
302 | this.txt_signature.Name = "txt_signature";
303 | this.txt_signature.ReadOnly = true;
304 | this.txt_signature.Size = new System.Drawing.Size(100, 20);
305 | this.txt_signature.TabIndex = 10;
306 | //
307 | // label_signature
308 | //
309 | this.label_signature.AutoSize = true;
310 | this.label_signature.Location = new System.Drawing.Point(35, 17);
311 | this.label_signature.Name = "label_signature";
312 | this.label_signature.Size = new System.Drawing.Size(55, 13);
313 | this.label_signature.TabIndex = 9;
314 | this.label_signature.Text = "Signature:";
315 | //
316 | // tab_infos
317 | //
318 | this.tab_infos.Controls.Add(this.groupBox1);
319 | this.tab_infos.Controls.Add(this.group_hwbp);
320 | this.tab_infos.Controls.Add(this.group_pc);
321 | this.tab_infos.Location = new System.Drawing.Point(4, 22);
322 | this.tab_infos.Name = "tab_infos";
323 | this.tab_infos.Padding = new System.Windows.Forms.Padding(3);
324 | this.tab_infos.Size = new System.Drawing.Size(637, 290);
325 | this.tab_infos.TabIndex = 1;
326 | this.tab_infos.Text = "Data";
327 | this.tab_infos.UseVisualStyleBackColor = true;
328 | //
329 | // groupBox1
330 | //
331 | this.groupBox1.Controls.Add(this.btn_instr_read);
332 | this.groupBox1.Controls.Add(this.btn_instr_write);
333 | this.groupBox1.Controls.Add(this.txt_instr);
334 | this.groupBox1.Location = new System.Drawing.Point(6, 118);
335 | this.groupBox1.Name = "groupBox1";
336 | this.groupBox1.Size = new System.Drawing.Size(625, 50);
337 | this.groupBox1.TabIndex = 2;
338 | this.groupBox1.TabStop = false;
339 | this.groupBox1.Text = "Instruction";
340 | //
341 | // btn_instr_read
342 | //
343 | this.btn_instr_read.Location = new System.Drawing.Point(175, 17);
344 | this.btn_instr_read.Name = "btn_instr_read";
345 | this.btn_instr_read.Size = new System.Drawing.Size(75, 23);
346 | this.btn_instr_read.TabIndex = 7;
347 | this.btn_instr_read.Text = "Read Instr.";
348 | this.btn_instr_read.UseVisualStyleBackColor = true;
349 | this.btn_instr_read.Click += new System.EventHandler(this.btn_instr_read_Click);
350 | //
351 | // btn_instr_write
352 | //
353 | this.btn_instr_write.Location = new System.Drawing.Point(278, 17);
354 | this.btn_instr_write.Name = "btn_instr_write";
355 | this.btn_instr_write.Size = new System.Drawing.Size(75, 23);
356 | this.btn_instr_write.TabIndex = 1;
357 | this.btn_instr_write.Text = "Run Instr.";
358 | this.btn_instr_write.UseVisualStyleBackColor = true;
359 | this.btn_instr_write.Click += new System.EventHandler(this.btn_instr_write_Click);
360 | //
361 | // txt_instr
362 | //
363 | this.txt_instr.Location = new System.Drawing.Point(6, 19);
364 | this.txt_instr.Name = "txt_instr";
365 | this.txt_instr.Size = new System.Drawing.Size(143, 20);
366 | this.txt_instr.TabIndex = 0;
367 | //
368 | // group_hwbp
369 | //
370 | this.group_hwbp.Controls.Add(this.btn_bp_read);
371 | this.group_hwbp.Controls.Add(this.btn_bp_write);
372 | this.group_hwbp.Controls.Add(this.txt_BP);
373 | this.group_hwbp.Location = new System.Drawing.Point(6, 62);
374 | this.group_hwbp.Name = "group_hwbp";
375 | this.group_hwbp.Size = new System.Drawing.Size(625, 50);
376 | this.group_hwbp.TabIndex = 1;
377 | this.group_hwbp.TabStop = false;
378 | this.group_hwbp.Text = "Hardware Breakpoint";
379 | //
380 | // btn_bp_read
381 | //
382 | this.btn_bp_read.Location = new System.Drawing.Point(175, 17);
383 | this.btn_bp_read.Name = "btn_bp_read";
384 | this.btn_bp_read.Size = new System.Drawing.Size(75, 23);
385 | this.btn_bp_read.TabIndex = 7;
386 | this.btn_bp_read.Text = "Read BP";
387 | this.btn_bp_read.UseVisualStyleBackColor = true;
388 | this.btn_bp_read.Click += new System.EventHandler(this.btn_bp_read_Click);
389 | //
390 | // btn_bp_write
391 | //
392 | this.btn_bp_write.Location = new System.Drawing.Point(278, 17);
393 | this.btn_bp_write.Name = "btn_bp_write";
394 | this.btn_bp_write.Size = new System.Drawing.Size(75, 23);
395 | this.btn_bp_write.TabIndex = 1;
396 | this.btn_bp_write.Text = "Write BP";
397 | this.btn_bp_write.UseVisualStyleBackColor = true;
398 | this.btn_bp_write.Click += new System.EventHandler(this.btn_bp_write_Click);
399 | //
400 | // txt_BP
401 | //
402 | this.txt_BP.Location = new System.Drawing.Point(6, 19);
403 | this.txt_BP.Name = "txt_BP";
404 | this.txt_BP.Size = new System.Drawing.Size(143, 20);
405 | this.txt_BP.TabIndex = 0;
406 | //
407 | // group_pc
408 | //
409 | this.group_pc.Controls.Add(this.btn_pc_read);
410 | this.group_pc.Controls.Add(this.btn_pc_write);
411 | this.group_pc.Controls.Add(this.txt_pc);
412 | this.group_pc.Location = new System.Drawing.Point(6, 6);
413 | this.group_pc.Name = "group_pc";
414 | this.group_pc.Size = new System.Drawing.Size(625, 50);
415 | this.group_pc.TabIndex = 0;
416 | this.group_pc.TabStop = false;
417 | this.group_pc.Text = "Program Counter";
418 | //
419 | // btn_pc_read
420 | //
421 | this.btn_pc_read.Location = new System.Drawing.Point(175, 17);
422 | this.btn_pc_read.Name = "btn_pc_read";
423 | this.btn_pc_read.Size = new System.Drawing.Size(75, 23);
424 | this.btn_pc_read.TabIndex = 7;
425 | this.btn_pc_read.Text = "Read PC";
426 | this.btn_pc_read.UseVisualStyleBackColor = true;
427 | this.btn_pc_read.Click += new System.EventHandler(this.btn_pc_read_Click);
428 | //
429 | // btn_pc_write
430 | //
431 | this.btn_pc_write.Location = new System.Drawing.Point(278, 17);
432 | this.btn_pc_write.Name = "btn_pc_write";
433 | this.btn_pc_write.Size = new System.Drawing.Size(75, 23);
434 | this.btn_pc_write.TabIndex = 1;
435 | this.btn_pc_write.Text = "Write PC";
436 | this.btn_pc_write.UseVisualStyleBackColor = true;
437 | this.btn_pc_write.Click += new System.EventHandler(this.btn_pc_write_Click);
438 | //
439 | // txt_pc
440 | //
441 | this.txt_pc.Location = new System.Drawing.Point(6, 19);
442 | this.txt_pc.Name = "txt_pc";
443 | this.txt_pc.Size = new System.Drawing.Size(143, 20);
444 | this.txt_pc.TabIndex = 0;
445 | //
446 | // Form1
447 | //
448 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
449 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
450 | this.ClientSize = new System.Drawing.Size(669, 370);
451 | this.Controls.Add(this.tabControl);
452 | this.Controls.Add(this.numeric_fcpu);
453 | this.Controls.Add(this.label2);
454 | this.Controls.Add(this.label1);
455 | this.Controls.Add(this.btn_connect);
456 | this.Controls.Add(this.combo_ports);
457 | this.Controls.Add(this.btn_start);
458 | this.Controls.Add(this.btn_stop);
459 | this.Name = "Form1";
460 | this.Text = "DebugWire GUI";
461 | this.Load += new System.EventHandler(this.Form1_Load);
462 | ((System.ComponentModel.ISupportInitialize)(this.numeric_fcpu)).EndInit();
463 | this.tabControl.ResumeLayout(false);
464 | this.tab_general.ResumeLayout(false);
465 | this.tab_general.PerformLayout();
466 | this.tab_infos.ResumeLayout(false);
467 | this.groupBox1.ResumeLayout(false);
468 | this.groupBox1.PerformLayout();
469 | this.group_hwbp.ResumeLayout(false);
470 | this.group_hwbp.PerformLayout();
471 | this.group_pc.ResumeLayout(false);
472 | this.group_pc.PerformLayout();
473 | this.ResumeLayout(false);
474 | this.PerformLayout();
475 |
476 | }
477 |
478 | #endregion
479 |
480 | private System.Windows.Forms.Button btn_stop;
481 | private System.Windows.Forms.Button btn_start;
482 | private System.Windows.Forms.ComboBox combo_ports;
483 | private System.Windows.Forms.Button btn_connect;
484 | private System.Windows.Forms.Button btn_signature;
485 | private System.Windows.Forms.Button button2;
486 | private System.Windows.Forms.Button btn_ss;
487 | private System.Windows.Forms.Label label1;
488 | private System.Windows.Forms.Label label2;
489 | private System.Windows.Forms.NumericUpDown numeric_fcpu;
490 | private System.Windows.Forms.TabControl tabControl;
491 | private System.Windows.Forms.TabPage tab_general;
492 | private System.Windows.Forms.TabPage tab_infos;
493 | private System.Windows.Forms.TextBox txt_signature;
494 | private System.Windows.Forms.Label label_signature;
495 | private System.Windows.Forms.Label label_sig_chip;
496 | private System.Windows.Forms.CheckBox check_reset_restart;
497 | private System.Windows.Forms.Button btn_reset;
498 | private System.Windows.Forms.Label label3;
499 | private System.Windows.Forms.Label label4;
500 | private System.Windows.Forms.Label label6;
501 | private System.Windows.Forms.Label label5;
502 | private System.Windows.Forms.GroupBox group_pc;
503 | private System.Windows.Forms.TextBox txt_pc;
504 | private System.Windows.Forms.Button btn_pc_read;
505 | private System.Windows.Forms.Button btn_pc_write;
506 | private System.Windows.Forms.GroupBox group_hwbp;
507 | private System.Windows.Forms.Button btn_bp_read;
508 | private System.Windows.Forms.Button btn_bp_write;
509 | private System.Windows.Forms.TextBox txt_BP;
510 | private System.Windows.Forms.GroupBox groupBox1;
511 | private System.Windows.Forms.Button btn_instr_read;
512 | private System.Windows.Forms.Button btn_instr_write;
513 | private System.Windows.Forms.TextBox txt_instr;
514 | }
515 | }
516 |
517 |
--------------------------------------------------------------------------------
/DWGui/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | using System.IO.Ports;
11 |
12 |
13 | namespace DWGui
14 | {
15 | public partial class Form1 : Form
16 | {
17 |
18 | DebugWire.DebugWire dw;
19 |
20 | public Form1()
21 | {
22 | InitializeComponent();
23 | }
24 |
25 | private void update_ports()
26 | {
27 | combo_ports.Items.Clear();
28 | foreach (string port in SerialPort.GetPortNames())
29 | {
30 | combo_ports.Items.Add(port);
31 | }
32 | }
33 |
34 |
35 | private void combo_ports_Click(object sender, EventArgs e)
36 | {
37 | update_ports();
38 | }
39 |
40 | private void btn_connect_Click(object sender, EventArgs e)
41 | {
42 | if(dw == null)
43 | {
44 | dw = new DebugWire.DebugWire(combo_ports.SelectedItem.ToString(), Convert.ToInt32(numeric_fcpu.Value));
45 | btn_connect.Text = "Disconnect";
46 | tabControl.Enabled = true;
47 | btn_start.Enabled = true;
48 | btn_stop.Enabled = true;
49 | }
50 |
51 | }
52 |
53 | private void btn_stop_Click(object sender, EventArgs e)
54 | {
55 | dw.halt();
56 | }
57 |
58 | private void btn_start_Click(object sender, EventArgs e)
59 | {
60 | dw.resume();
61 | }
62 |
63 | private async void btn_signature_Click(object sender, EventArgs e)
64 | {
65 | var r = await dw.getSignature();
66 | txt_signature.Text = r.ToString();
67 | label_sig_chip.Text = "Chip: " + r.Name;
68 | }
69 |
70 |
71 | private void button2_Click(object sender, EventArgs e)
72 | {
73 | dw.disableDW();
74 | }
75 |
76 | private void button3_Click(object sender, EventArgs e)
77 | {
78 | dw.singleStep();
79 | }
80 |
81 | private void Form1_Load(object sender, EventArgs e)
82 | {
83 | update_ports();
84 | if (combo_ports.Items.Count > 0)
85 | combo_ports.SelectedIndex = 0;
86 | }
87 |
88 | private async void btn_reset_Click(object sender, EventArgs e)
89 | {
90 | await dw.reset(check_reset_restart.Checked);
91 | }
92 |
93 |
94 | private async void btn_pc_read_Click(object sender, EventArgs e)
95 | {
96 | var res = await dw.getPC();
97 | txt_pc.Text = res.ToString();
98 | }
99 |
100 | private async void btn_bp_read_Click(object sender, EventArgs e)
101 | {
102 | var res = await dw.getHWBP();
103 | txt_BP.Text = res.ToString();
104 | }
105 |
106 | private async void btn_instr_read_Click(object sender, EventArgs e)
107 | {
108 | var res = await dw.getInstruction();
109 | txt_instr.Text = res.ToString();
110 | }
111 |
112 | private async void btn_pc_write_Click(object sender, EventArgs e)
113 | {
114 | await dw.setPC(new DebugWire.Address(txt_pc.Text));
115 | }
116 |
117 | private async void btn_bp_write_Click(object sender, EventArgs e)
118 | {
119 | await dw.setHWBP(new DebugWire.Address(txt_BP.Text));
120 | }
121 |
122 | private async void btn_instr_write_Click(object sender, EventArgs e)
123 | {
124 | await dw.runInstruction(new DebugWire.Instruction(txt_instr.Text));
125 | }
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/DWGui/Form1.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/DWGui/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace DWGui
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// Der Haupteinstiegspunkt für die Anwendung.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new Form1());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/DWGui/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Allgemeine Informationen über eine Assembly werden über die folgenden
6 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
7 | // die einer Assembly zugeordnet sind.
8 | [assembly: AssemblyTitle("DWGui")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("DWGui")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
18 | // für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
19 | // COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
20 | [assembly: ComVisible(false)]
21 |
22 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
23 | [assembly: Guid("63f28ae8-2cfe-46ae-996d-5533e1423d40")]
24 |
25 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
26 | //
27 | // Hauptversion
28 | // Nebenversion
29 | // Buildnummer
30 | // Revision
31 | //
32 | // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
33 | // übernehmen, indem Sie "*" eingeben:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/DWGui/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Dieser Code wurde von einem Tool generiert.
4 | // Laufzeitversion: 4.0.30319.42000
5 | //
6 | // Änderungen an dieser Datei können fehlerhaftes Verhalten verursachen und gehen verloren, wenn
7 | // der Code neu generiert wird.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace DWGui.Properties
12 | {
13 |
14 |
15 | ///
16 | /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
17 | ///
18 | // Diese Klasse wurde von der StronglyTypedResourceBuilder-Klasse
19 | // über ein Tool wie ResGen oder Visual Studio automatisch generiert.
20 | // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
21 | // mit der Option /str erneut aus, oder erstellen Sie Ihr VS-Projekt neu.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DWGui.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
56 | /// Ressourcenlookups, die diese stark typisierte Ressourcenklasse verwenden.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/DWGui/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/DWGui/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace DWGui.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/DWGui/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/DebugWire/Address.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace DebugWire
8 | {
9 | public class Address : TwoBytes
10 | {
11 | public Address(byte[] data) : base(data)
12 | {
13 | }
14 |
15 | public Address(string data) : base(data)
16 | {
17 | }
18 |
19 | public Address(ushort data) : base(data)
20 | { }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/DebugWire/DebugWire.cs:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2017 Jan Böhmer
2 | *
3 | * This program is free software; you can redistribute it and/or modify
4 | * it under the terms of the GNU General Public License as published by
5 | * the Free Software Foundation; either version 2 of the License, or
6 | * (at your option) any later version.
7 | *
8 | * This program is distributed in the hope that it will be useful,
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | * GNU General Public License for more details.
12 | *
13 | * You should have received a copy of the GNU General Public License along
14 | * with this program; if not, write to the Free Software Foundation, Inc.,
15 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 | */
17 |
18 | using System;
19 | using System.Collections.Generic;
20 | using System.Linq;
21 | using System.Text;
22 | using System.Threading.Tasks;
23 | using System.IO.Ports;
24 | using System.Threading;
25 |
26 | namespace DebugWire
27 | {
28 | public class DebugWire
29 | {
30 | int _fcpu;
31 | SerialPort _port;
32 | int _sleeptime;
33 |
34 | private object serialincoming = new Object();
35 |
36 | //DebugWire Command bytes
37 | //Basic commands
38 | const byte CMD_BREAK = 0x00;
39 | const byte CMD_RESUME = 0x30;
40 | const byte CMD_RESET = 0x07;
41 | const byte CMD_DISABLE_DW = 0x06;
42 | const byte CMD_SS = 0x31;
43 | const byte CMD_SS_INSTR = 0x23;
44 | //Read Data
45 | const byte CMD_GET_PC = 0xf0;
46 | const byte CMD_GET_HWBP = 0xf1;
47 | const byte CMD_GET_INSTR = 0xf2;
48 | const byte CMD_GET_SIG = 0xf3;
49 | //Write Data
50 | const byte CMD_SET_PC = 0xd0;
51 | const byte CMD_SET_HWBP = 0xd1;
52 | const byte CMD_SET_INSTR = 0xd2;
53 | //Results
54 | const byte RESULT_OK = 0x55;
55 |
56 | ///
57 | /// Creates and opens an new debugwire connection
58 | ///
59 | /// The serial port the MCU is connected to.
60 | /// The CPU frequency in Hz.
61 | public DebugWire(string portname, int F_CPU)
62 | {
63 | _sleeptime = 20;
64 | if(F_CPU <= 0)
65 | {
66 | throw new ArgumentException("F_CPU has to be greater 0.");
67 | }
68 | _fcpu = F_CPU;
69 | var baud = get_baud();
70 |
71 | _port = new SerialPort(portname, baud);
72 | _port.Open();
73 | }
74 |
75 | ///
76 | /// Halts the target with a break.
77 | ///
78 | /// true if the halt was successful, false if not.
79 | public async Task halt()
80 | {
81 | var b = await write_cmd(CMD_BREAK, 1);
82 | if(b[0] == RESULT_OK)
83 | {
84 | return true;
85 | }
86 | else
87 | {
88 | return false;
89 | }
90 | }
91 |
92 |
93 | ///
94 | /// Resume the execution on the target after a break;
95 | ///
96 | ///
97 | public async Task resume()
98 | {
99 | await write_cmd(CMD_RESUME, 0);
100 | }
101 |
102 | ///
103 | /// Resets the target and restart it.
104 | ///
105 | /// true if the reset was successful.
106 | public async Task reset()
107 | {
108 | return await reset(true);
109 | }
110 |
111 | ///
112 | /// Disables DebugWire on the target and reactivate ISP.
113 | /// After this command you can not use DebuWire until deactivate and activate power.
114 | ///
115 | /// true if the disabling was successful.
116 | public async Task disableDW()
117 | {
118 | var result = await write_cmd(CMD_DISABLE_DW, 2);
119 | if (result[2] == RESULT_OK)
120 | return true;
121 | else
122 | return false;
123 | }
124 |
125 | ///
126 | /// Resets the target and restart it if desired.
127 | ///
128 | /// true if the target should be restart after reset. If set to false the target must be restarted manually with call of halt()
129 | ///
130 | public async Task reset(bool start)
131 | {
132 | var a = await write_cmd(CMD_RESET, 3);
133 | if (a[2] != RESULT_OK)
134 | return false;
135 |
136 | if (start) // The MCU is stopped, send 0x00 to restart it
137 | {
138 | var b = await write_cmd(0x00, 1);
139 | if (b[0] != RESULT_OK)
140 | return false;
141 | }
142 |
143 | return true;
144 | }
145 |
146 | ///
147 | /// Performs only the next instructions on the target. (Single Stepping).
148 | ///
149 | /// true if the single step was successful.
150 | public async Task singleStep()
151 | {
152 | var result = await write_cmd(CMD_SS, 3);
153 | if (result[2] == RESULT_OK)
154 | return true;
155 | else
156 | return false;
157 | }
158 |
159 | ///
160 | /// Reads the signataure of the target and returns it as a byte array.
161 | ///
162 | /// A byte array containing the target signature.
163 | public async Task getSignatureRaw()
164 | {
165 | return await write_cmd(CMD_GET_SIG, 2);
166 | }
167 |
168 | ///
169 | /// Reads the signature of the target and returns it as Signature object.
170 | ///
171 | /// A Signature object describing the target signature
172 | public async Task getSignature()
173 | {
174 | return new Signature(await getSignatureRaw());
175 | }
176 |
177 |
178 | ///
179 | /// Reads the value of the Programm Counter (PC) from the target.
180 | /// It contains the current address, which is executed.
181 | ///
182 | /// The value of the PC.
183 | public async Task getPC()
184 | {
185 | var result = await write_cmd(CMD_GET_PC, 2);
186 | return new Address(result);
187 | }
188 |
189 | ///
190 | /// Reads the value of the Programm Counter (PC) from the target and return it as byte array.
191 | /// It contains the current address, which is executed.
192 | ///
193 | /// A byte array containing the address.
194 | public async Task getPCRaw()
195 | {
196 | var addr = await write_cmd(CMD_GET_PC, 2);
197 | return addr;
198 | }
199 |
200 | ///
201 | /// Reads the value of the Hardware Breakpoint from target and returns it as byte array.
202 | ///
203 | /// A byte array containing the read address.
204 | public async Task getHWBPRaw()
205 | {
206 | return await write_cmd(CMD_GET_HWBP, 2);
207 | }
208 |
209 | ///
210 | /// Reads the value of the Hardware Breakpoint from target and returns it as Address object.
211 | ///
212 | /// A Address object describing the address of the Hardware Breakpoint.
213 | public async Task getHWBP()
214 | {
215 | return new Address(await getHWBPRaw());
216 | }
217 |
218 | ///
219 | /// Reads the the opcode of the last set instruction and returns it as byte array.
220 | ///
221 | /// A byte array containing the opcode.
222 | public async Task getInstructionRaw()
223 | {
224 | return await write_cmd(CMD_GET_INSTR, 2);
225 | }
226 |
227 | ///
228 | /// Reads the opcode of the last set instruction and returns it as Instruction array.
229 | ///
230 | ///
231 | public async Task getInstruction()
232 | {
233 | return new Instruction(await getInstructionRaw());
234 | }
235 |
236 | ///
237 | /// Sets the Progress Counter to the given Address.
238 | ///
239 | /// A Address object.
240 | public async Task setPC(Address addr)
241 | {
242 | var bytes = merge_command_argument(CMD_SET_PC, addr.Bytes);
243 | await write_cmd(bytes, 0);
244 | }
245 |
246 | ///
247 | /// Sets the Hardware Breakpoint to the given Address.
248 | ///
249 | /// An Address object.
250 | public async Task setHWBP(Address addr)
251 | {
252 | var bytes = merge_command_argument(CMD_SET_HWBP, addr.Bytes);
253 | await write_cmd(bytes, 0);
254 | }
255 |
256 | ///
257 | /// Runs the given Instruction on the target.
258 | ///
259 | /// The instruction which should be run.
260 | public async Task runInstruction(Instruction instr)
261 | {
262 | var bytes = merge_command_argument(CMD_SET_INSTR, instr.Bytes);
263 | await write_cmd(bytes, 0); //Load Instruction
264 |
265 | await write_cmd(CMD_SS_INSTR, 0); //Run Instruction
266 |
267 | }
268 |
269 | ///
270 | /// Calculates a suitable baudrate for the DebugWire port.
271 | ///
272 | /// The calculated baudrate.
273 | private int get_baud()
274 | {
275 | return _fcpu / 128;
276 | }
277 |
278 | ///
279 | /// Merges a cmd byte and an argument byte array into one byte array.
280 | ///
281 | /// The command byte.
282 | /// The arguments for the command.
283 | /// A byte array containing command and arguments.
284 | private byte[] merge_command_argument(byte cmd, byte[] arg)
285 | {
286 | byte[] arr = new byte[arg.Length + 1];
287 | arr[0] = cmd;
288 | for(int i=0;i
297 | /// Outputs the given cmds and data to the MCU and receive the given amount of bytes. Waits the given time before reading the
298 | ///
299 | /// The commands and the data, which should be sent, as byte array.
300 | /// How many bytes should be received, after transmission of the command.
301 | /// Time in ms, how long should be waited before read targets answer.
302 | /// A byte array with the targets answer
303 | private async Task write_cmd(byte[] cmd, int expected_bytes, int sleeptime)
304 | {
305 | if (cmd.Length == 0)
306 | throw new ArgumentException("cmd must contain at least one command byte!");
307 | if (expected_bytes < 0)
308 | throw new ArgumentException("expected_bytes must be greater 0!");
309 | if (sleeptime < 0)
310 | throw new ArgumentException("sleeptime must be greater 0!");
311 |
312 | _port.DiscardInBuffer(); // Discard all existing bytes, so we dont get results from the last one
313 | _port.Write(cmd, 0, cmd.Length);
314 | byte[] buffer = new byte[cmd.Length + expected_bytes];
315 | if (expected_bytes > 0) // Sleep only if we really want to receive data
316 | {
317 | Thread.Sleep(sleeptime); // We need this, because SerialPort reads faster, than the MCU can answer
318 | }
319 | await _port.BaseStream.ReadAsync(buffer, 0, cmd.Length + expected_bytes);
320 | byte[] result = new byte[expected_bytes];
321 | for(int i = cmd.Length;i
329 | /// Outputs the given cmds and data to the MCU and receive the given amount of bytes.
330 | ///
331 | /// The commands and the data, which should be sent, as byte array.
332 | /// How many bytes should be received, after transmission of the command.
333 | /// A byte array with the targets answer
334 | private async Task write_cmd(byte[] cmd, int expected_bytes)
335 | {
336 | return await write_cmd(cmd, expected_bytes, _sleeptime);
337 | }
338 |
339 | ///
340 | /// Outputs the given cmd to the MCU and receive the given amount of bytes.
341 | ///
342 | /// The command which should be sent.
343 | /// How many bytes should be received, after transmission of the command.
344 | /// A byte array with the targets answer
345 | private async Task write_cmd(byte cmd, int expected_bytes)
346 | {
347 | byte[] b = { cmd };
348 | return await write_cmd(b, expected_bytes);
349 | }
350 |
351 | ///
352 | /// Outputs the given cmd to the MCU and receive the given amount of bytes. Waits the given time before reading the
353 | ///
354 | /// The command which should be sent.
355 | /// How many bytes should be received, after transmission of the command.
356 | /// Time in ms, how long should be waited before read targets answer.
357 | /// A byte array with the targets answer
358 | private async Task write_cmd(byte cmd, int expected_bytes, int sleeptime)
359 | {
360 | byte[] b = { cmd };
361 | return await write_cmd(b, expected_bytes, sleeptime);
362 | }
363 |
364 |
365 | }
366 |
367 | }
368 |
--------------------------------------------------------------------------------
/DebugWire/DebugWire.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {36F245C9-87F4-47A2-A47E-81AD440D2A8D}
8 | Library
9 | Properties
10 | DebugWire
11 | DebugWire
12 | v4.6.2
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | bin\Release\
28 | TRACE
29 | prompt
30 | 4
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/DebugWire/Instruction.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace DebugWire
8 | {
9 | public class Instruction : TwoBytes
10 | {
11 | public Instruction(byte[] data) : base(data)
12 | {
13 | }
14 |
15 | public Instruction(string data) : base(data)
16 | {
17 |
18 | }
19 |
20 | public Instruction(ushort data) : base(data)
21 | { }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/DebugWire/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Allgemeine Informationen über eine Assembly werden über die folgenden
6 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
7 | // die einer Assembly zugeordnet sind.
8 | [assembly: AssemblyTitle("DebugWire")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("DebugWire")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
18 | // für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
19 | // COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
20 | [assembly: ComVisible(false)]
21 |
22 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
23 | [assembly: Guid("36f245c9-87f4-47a2-a47e-81ad440d2a8d")]
24 |
25 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
26 | //
27 | // Hauptversion
28 | // Nebenversion
29 | // Buildnummer
30 | // Revision
31 | //
32 | // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
33 | // indem Sie "*" wie unten gezeigt eingeben:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/DebugWire/Signature.cs:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2017 Jan Böhmer
2 | *
3 | * This program is free software; you can redistribute it and/or modify
4 | * it under the terms of the GNU General Public License as published by
5 | * the Free Software Foundation; either version 2 of the License, or
6 | * (at your option) any later version.
7 | *
8 | * This program is distributed in the hope that it will be useful,
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | * GNU General Public License for more details.
12 | *
13 | * You should have received a copy of the GNU General Public License along
14 | * with this program; if not, write to the Free Software Foundation, Inc.,
15 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 | */
17 |
18 |
19 | using System;
20 | using System.Collections.Generic;
21 | using System.Linq;
22 | using System.Text;
23 | using System.Threading.Tasks;
24 |
25 | namespace DebugWire
26 | {
27 | public class Signature
28 | {
29 | byte[] _sig;
30 |
31 | ///
32 | /// Creates a Signature object with the given signature.
33 | ///
34 | /// A byte array containing a devices signature.
35 | public Signature(byte[] sigbytes)
36 | {
37 | if (sigbytes.Length != 2)
38 | throw new ArgumentException("The sigbytes array has to contain 2 bytes.");
39 | _sig = sigbytes;
40 | }
41 |
42 | ///
43 | /// Convert the signature to a hexadecimal string in the format "0xZZZZ"
44 | ///
45 | /// A string representation of the signature bytes.
46 | public override string ToString()
47 | {
48 | return "0x" + BitConverter.ToString(_sig).Replace("-", String.Empty);
49 | }
50 |
51 | ///
52 | /// Convert the signature to a hexadecimal string.
53 | ///
54 | /// true if no trailing "0x" should be added to the signature.
55 | /// A string representation of the signature bytes.
56 | public string ToString(bool no_0x)
57 | {
58 | if (no_0x)
59 | return BitConverter.ToString(_sig).Replace("-", String.Empty);
60 | else
61 | return ToString();
62 | }
63 |
64 | ///
65 | /// Convert the signature bytes to the full device signature in the form "0x1EZZZZ"
66 | ///
67 | /// A hexadecimal string representation of the signature bytes.
68 | public string ToFullString()
69 | {
70 | return "0x1E" + BitConverter.ToString(_sig).Replace("-", String.Empty);
71 | }
72 |
73 | ///
74 | /// The name of the MCU with this signature.
75 | ///
76 | public string Name
77 | {
78 | get
79 | {
80 | switch (ToString())
81 | {
82 | case "0x9007":
83 | return "ATTiny13";
84 | case "0x950f":
85 | return "ATmega328P";
86 | case "0x9514":
87 | return "ATmega328";
88 |
89 | default:
90 | return "Unknown AVR";
91 | }
92 | }
93 | }
94 |
95 | ///
96 | /// A byte array containing the bytes of the device Signature
97 | ///
98 | public byte[] SignatureBytes{
99 | get
100 | {
101 | return _sig;
102 | }
103 | }
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/DebugWire/TwoBytes.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace DebugWire
8 | {
9 | public class TwoBytes
10 | {
11 | private byte[] _data;
12 |
13 | ///
14 | /// Creates a new TwoBytes object from the given bytes.
15 | ///
16 | /// A byte array containing the two bytes.
17 | public TwoBytes(byte[] data)
18 | {
19 | if (data.Length != 2)
20 | throw new ArgumentException("The data array has to contain two bytes!");
21 |
22 | _data = data;
23 | }
24 |
25 | ///
26 | /// Creates a new TwoBytes object from the given hexadecimal string in the format "0xZZZZ"
27 | ///
28 | /// A string in the format "0xZZZZ"
29 | public TwoBytes(string data)
30 | {
31 | if (data.StartsWith("0x", StringComparison.CurrentCultureIgnoreCase) ||
32 | data.StartsWith("&H", StringComparison.CurrentCultureIgnoreCase))
33 | {
34 | data = data.Substring(2);
35 | }
36 | var s = ushort.Parse(data, System.Globalization.NumberStyles.HexNumber);
37 | _data = reverseBytes(BitConverter.GetBytes(s));
38 | }
39 |
40 | public TwoBytes(ushort data)
41 | {
42 | _data = reverseBytes(BitConverter.GetBytes(data));
43 | }
44 |
45 | ///
46 | /// Returns the two bytes as a unsigned short.
47 | ///
48 | /// A ushort containing the two bytes.
49 | public ushort ToShort()
50 | {
51 | return BitConverter.ToUInt16(_data, 0);
52 | }
53 |
54 | public byte[] Bytes
55 | {
56 | get
57 | {
58 | return _data;
59 | }
60 | }
61 |
62 | private byte[] reverseBytes(byte[] data)
63 | {
64 | byte[] b = { data[1], data[0] };
65 | return b;
66 |
67 | }
68 |
69 | ///
70 | /// Returns a string representation of the two bytes in the format "0xZZZZ"
71 | ///
72 | /// A string with the two bytes in hexadecimal.
73 | public override string ToString()
74 | {
75 | return "0x" + BitConverter.ToString(_data).Replace("-", string.Empty);
76 | }
77 |
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 | How to Apply These Terms to Your New Programs
283 |
284 | If you develop a new program, and you want it to be of the greatest
285 | possible use to the public, the best way to achieve this is to make it
286 | free software which everyone can redistribute and change under these terms.
287 |
288 | To do so, attach the following notices to the program. It is safest
289 | to attach them to the start of each source file to most effectively
290 | convey the exclusion of warranty; and each file should have at least
291 | the "copyright" line and a pointer to where the full notice is found.
292 |
293 | {description}
294 | Copyright (C) {year} {fullname}
295 |
296 | This program is free software; you can redistribute it and/or modify
297 | it under the terms of the GNU General Public License as published by
298 | the Free Software Foundation; either version 2 of the License, or
299 | (at your option) any later version.
300 |
301 | This program is distributed in the hope that it will be useful,
302 | but WITHOUT ANY WARRANTY; without even the implied warranty of
303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 | GNU General Public License for more details.
305 |
306 | You should have received a copy of the GNU General Public License along
307 | with this program; if not, write to the Free Software Foundation, Inc.,
308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309 |
310 | Also add information on how to contact you by electronic and paper mail.
311 |
312 | If the program is interactive, make it output a short notice like this
313 | when it starts in an interactive mode:
314 |
315 | Gnomovision version 69, Copyright (C) year name of author
316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 | This is free software, and you are welcome to redistribute it
318 | under certain conditions; type `show c' for details.
319 |
320 | The hypothetical commands `show w' and `show c' should show the appropriate
321 | parts of the General Public License. Of course, the commands you use may
322 | be called something other than `show w' and `show c'; they could even be
323 | mouse-clicks or menu items--whatever suits your program.
324 |
325 | You should also get your employer (if you work as a programmer) or your
326 | school, if any, to sign a "copyright disclaimer" for the program, if
327 | necessary. Here is a sample; alter the names:
328 |
329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 | `Gnomovision' (which makes passes at compilers) written by James Hacker.
331 |
332 | {signature of Ty Coon}, 1 April 1989
333 | Ty Coon, President of Vice
334 |
335 | This General Public License does not permit incorporating your program into
336 | proprietary programs. If your program is a subroutine library, you may
337 | consider it more useful to permit linking proprietary applications with the
338 | library. If this is what you want to do, use the GNU Lesser General
339 | Public License instead of this License.
340 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # WireDebugger
2 | Debug AVRs with DebugWire via SerialPort
3 |
--------------------------------------------------------------------------------