├── .classpath
├── .gradle
├── 5.0
│ ├── fileChanges
│ │ └── last-build.bin
│ ├── fileContent
│ │ └── fileContent.lock
│ ├── fileHashes
│ │ ├── fileHashes.bin
│ │ ├── fileHashes.lock
│ │ └── resourceHashesCache.bin
│ ├── gc.properties
│ ├── javaCompile
│ │ ├── classAnalysis.bin
│ │ ├── jarAnalysis.bin
│ │ ├── javaCompile.lock
│ │ └── taskHistory.bin
│ └── taskHistory
│ │ ├── taskHistory.bin
│ │ └── taskHistory.lock
├── buildOutputCleanup
│ ├── buildOutputCleanup.lock
│ ├── cache.properties
│ └── outputFiles.bin
└── vcs-1
│ └── gc.properties
├── .project
├── .settings
└── org.eclipse.jdt.core.prefs
├── LICENSE
├── Module.manifest
├── README.md
├── bin
├── README.txt
├── help
│ ├── TOC_Source.xml
│ ├── shared
│ │ └── Frontpage.css
│ └── topics
│ │ └── stm32
│ │ └── help.html
├── images
│ └── README.txt
└── stm32
│ ├── stm32Loader$RegLabel.class
│ ├── stm32Loader$STM32InterruptVector.class
│ ├── stm32Loader$STM32MemRegion.class
│ └── stm32Loader.class
├── build.gradle
├── build
├── classes
│ └── java
│ │ └── main
│ │ └── stm32
│ │ ├── stm32Loader$RegLabel.class
│ │ ├── stm32Loader$STM32InterruptVector.class
│ │ ├── stm32Loader$STM32MemRegion.class
│ │ └── stm32Loader.class
├── help
│ └── main
│ │ └── help
│ │ ├── stm32_HelpSet.hs
│ │ ├── stm32_JavaHelpSearch
│ │ ├── DOCS
│ │ ├── DOCS.TAB
│ │ ├── OFFSETS
│ │ ├── POSITIONS
│ │ ├── SCHEMA
│ │ └── TMAP
│ │ ├── stm32_TOC.xml
│ │ └── stm32_map.xml
├── helpconfig
├── libs
│ └── stm32.jar
├── resources
│ └── main
│ │ └── images
│ │ └── README.txt
└── tmp
│ ├── jar
│ └── MANIFEST.MF
│ └── src
│ └── stm32-src.zip
├── data
└── README.txt
├── dist
└── ghidra_9.1.2_PUBLIC_20200222_stm32.zip
├── extension.properties
├── ghidra_scripts
└── README.txt
├── lib
└── README.txt
├── os
├── linux64
│ └── README.txt
├── osx64
│ └── README.txt
└── win64
│ └── README.txt
└── src
├── main
├── help
│ └── help
│ │ ├── TOC_Source.xml
│ │ ├── shared
│ │ └── Frontpage.css
│ │ └── topics
│ │ └── stm32
│ │ └── help.html
├── java
│ └── stm32
│ │ └── stm32Loader.java
└── resources
│ └── images
│ └── README.txt
└── test
└── java
└── README.test.txt
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
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 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
--------------------------------------------------------------------------------
/.gradle/5.0/fileChanges/last-build.bin:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.gradle/5.0/fileContent/fileContent.lock:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/.gradle/5.0/fileContent/fileContent.lock
--------------------------------------------------------------------------------
/.gradle/5.0/fileHashes/fileHashes.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/.gradle/5.0/fileHashes/fileHashes.bin
--------------------------------------------------------------------------------
/.gradle/5.0/fileHashes/fileHashes.lock:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/.gradle/5.0/fileHashes/fileHashes.lock
--------------------------------------------------------------------------------
/.gradle/5.0/fileHashes/resourceHashesCache.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/.gradle/5.0/fileHashes/resourceHashesCache.bin
--------------------------------------------------------------------------------
/.gradle/5.0/gc.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/.gradle/5.0/gc.properties
--------------------------------------------------------------------------------
/.gradle/5.0/javaCompile/classAnalysis.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/.gradle/5.0/javaCompile/classAnalysis.bin
--------------------------------------------------------------------------------
/.gradle/5.0/javaCompile/jarAnalysis.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/.gradle/5.0/javaCompile/jarAnalysis.bin
--------------------------------------------------------------------------------
/.gradle/5.0/javaCompile/javaCompile.lock:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/.gradle/5.0/javaCompile/javaCompile.lock
--------------------------------------------------------------------------------
/.gradle/5.0/javaCompile/taskHistory.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/.gradle/5.0/javaCompile/taskHistory.bin
--------------------------------------------------------------------------------
/.gradle/5.0/taskHistory/taskHistory.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/.gradle/5.0/taskHistory/taskHistory.bin
--------------------------------------------------------------------------------
/.gradle/5.0/taskHistory/taskHistory.lock:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/.gradle/5.0/taskHistory/taskHistory.lock
--------------------------------------------------------------------------------
/.gradle/buildOutputCleanup/buildOutputCleanup.lock:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/.gradle/buildOutputCleanup/buildOutputCleanup.lock
--------------------------------------------------------------------------------
/.gradle/buildOutputCleanup/cache.properties:
--------------------------------------------------------------------------------
1 | #Sat Feb 22 22:38:25 EST 2020
2 | gradle.version=5.0
3 |
--------------------------------------------------------------------------------
/.gradle/buildOutputCleanup/outputFiles.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/.gradle/buildOutputCleanup/outputFiles.bin
--------------------------------------------------------------------------------
/.gradle/vcs-1/gc.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/.gradle/vcs-1/gc.properties
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | stm32
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
19 | Ghidra
20 | 2
21 | /home/wrongbaud/tools/ghidra_9.1.2_PUBLIC
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
3 | org.eclipse.jdt.core.compiler.compliance=11
4 | org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
5 | org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
6 | org.eclipse.jdt.core.compiler.problem.deprecation=warning
7 | org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
8 | org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
9 | org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
10 | org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
11 | org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
12 | org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
13 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
14 | org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
15 | org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
16 | org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
17 | org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
18 | org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
19 | org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
20 | org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
21 | org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
22 | org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
23 | org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
24 | org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
25 | org.eclipse.jdt.core.compiler.problem.nullReference=warning
26 | org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
27 | org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
28 | org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
29 | org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
30 | org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
31 | org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
32 | org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
33 | org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
34 | org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
35 | org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
36 | org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
37 | org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
38 | org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
39 | org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
40 | org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
41 | org.eclipse.jdt.core.compiler.problem.unusedImport=warning
42 | org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
43 | org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
44 | org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
45 | org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
46 | org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
47 | org.eclipse.jdt.core.compiler.source=11
48 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 wrongbaud
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Module.manifest:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/Module.manifest
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ghidra-stm32
2 |
3 | This is a loader for the STM32F2 series of microcontrollers
4 |
5 | ## What it does
6 | * Labels memory regions
7 | * Labels IVT and entry point (assuming normal boot mode)
8 | * Labels USB-OTG Configuration registers
9 |
10 | ## Installation
11 | You can install the loader via a zip on the releases page, or build the module yourself following instructions from the blog post
12 |
13 | ## Building with eclipse
14 | After configuring Eclipse with the GhidraDev extension, this project can be built in Eclipse
15 |
16 | ## Building with gradle
17 |
18 | You just need Java, gradle and ghidra for building. Position in source dir and issue gradle command:
19 |
20 | ```
21 | gradle -PGHIDRA_INSTALL_DIR=/opt/ghidra_9.1.2_PUBLIC
22 | ```
23 |
24 | You can check what tasks you can also call with gradle with standard tasks options:
25 |
26 | ```
27 | gradle tasks -PGHIDRA_INSTALL_DIR=/opt/ghidra_9.1.2_PUBLIC
28 | ```
29 |
30 | Note: you can also put path to the ghidra in gradle.properties file:
31 | ```
32 | GHIDRA_INSTALL_DIR=/opt/ghidra_9.1.2_PUBLIC
33 | ```
34 |
35 |
--------------------------------------------------------------------------------
/bin/README.txt:
--------------------------------------------------------------------------------
1 | Java source directory to hold module-specific Ghidra scripts.
2 |
--------------------------------------------------------------------------------
/bin/help/TOC_Source.xml:
--------------------------------------------------------------------------------
1 |
2 |
49 |
50 |
51 |
52 |
57 |
58 |
--------------------------------------------------------------------------------
/bin/help/shared/Frontpage.css:
--------------------------------------------------------------------------------
1 | /* ###
2 | * IP: GHIDRA
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | /*
17 | WARNING!
18 | This file is copied to all help directories. If you change this file, you must copy it
19 | to each src/main/help/help/shared directory.
20 |
21 |
22 | Java Help Note: JavaHelp does not accept sizes (like in 'margin-top') in anything but
23 | px (pixel) or with no type marking.
24 |
25 | */
26 |
27 | body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 10px; } /* some padding to improve readability */
28 | li { font-family:times new roman; font-size:14pt; }
29 | h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; }
30 | h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; }
31 | h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; }
32 | h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; }
33 |
34 | /*
35 | P tag code. Most of the help files nest P tags inside of blockquote tags (the was the
36 | way it had been done in the beginning). The net effect is that the text is indented. In
37 | modern HTML we would use CSS to do this. We need to support the Ghidra P tags, nested in
38 | blockquote tags, as well as naked P tags. The following two lines accomplish this. Note
39 | that the 'blockquote p' definition will inherit from the first 'p' definition.
40 | */
41 | p { margin-left: 40px; font-family:times new roman; font-size:14pt; }
42 | blockquote p { margin-left: 10px; }
43 |
44 | p.providedbyplugin { color:#7f7f7f; margin-left: 10px; font-size:14pt; margin-top:100px }
45 | p.ProvidedByPlugin { color:#7f7f7f; margin-left: 10px; font-size:14pt; margin-top:100px }
46 | p.relatedtopic { color:#800080; margin-left: 10px; font-size:14pt; }
47 | p.RelatedTopic { color:#800080; margin-left: 10px; font-size:14pt; }
48 |
49 | /*
50 | We wish for a tables to have space between it and the preceding element, so that text
51 | is not too close to the top of the table. Also, nest the table a bit so that it is clear
52 | the table relates to the preceding text.
53 | */
54 | table { margin-left: 20px; margin-top: 10px; width: 80%;}
55 | td { font-family:times new roman; font-size:14pt; vertical-align: top; }
56 | th { font-family:times new roman; font-size:14pt; font-weight:bold; background-color: #EDF3FE; }
57 |
58 | code { color: black; font-family: courier new; font-size: 14pt; }
59 |
--------------------------------------------------------------------------------
/bin/help/topics/stm32/help.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 |
8 |
9 |
10 |
11 |
12 | Skeleton Help File for a Module
13 |
14 |
15 |
16 |
17 |
Skeleton Help File for a Module
18 |
19 |
This is a simple skeleton help topic. For a better description of what should and should not
20 | go in here, see the "sample" Ghidra extension in the Extensions/Ghidra directory, or see your
21 | favorite help topic. In general, language modules do not have their own help topics.
22 |
23 |
24 |
--------------------------------------------------------------------------------
/bin/images/README.txt:
--------------------------------------------------------------------------------
1 | The "src/resources/images" directory is intended to hold all image/icon files used by
2 | this module.
3 |
--------------------------------------------------------------------------------
/bin/stm32/stm32Loader$RegLabel.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/bin/stm32/stm32Loader$RegLabel.class
--------------------------------------------------------------------------------
/bin/stm32/stm32Loader$STM32InterruptVector.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/bin/stm32/stm32Loader$STM32InterruptVector.class
--------------------------------------------------------------------------------
/bin/stm32/stm32Loader$STM32MemRegion.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/bin/stm32/stm32Loader$STM32MemRegion.class
--------------------------------------------------------------------------------
/bin/stm32/stm32Loader.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/bin/stm32/stm32Loader.class
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Builds a Ghidra Extension for a given Ghidra installation.
2 | //
3 | // An absolute path to the Ghidra installation directory must be supplied either by setting the
4 | // GHIDRA_INSTALL_DIR environment variable or Gradle project property:
5 | //
6 | // > export GHIDRA_INSTALL_DIR=
7 | // > gradle
8 | //
9 | // or
10 | //
11 | // > gradle -PGHIDRA_INSTALL_DIR=
12 | //
13 | // Gradle should be invoked from the directory of the project to build. Please see the
14 | // application.gradle.version property in /Ghidra/application.properties
15 | // for the correction version of Gradle to use for the Ghidra installation you specify.
16 |
17 | //----------------------START "DO NOT MODIFY" SECTION------------------------------
18 | def ghidraInstallDir
19 |
20 | if (System.env.GHIDRA_INSTALL_DIR) {
21 | ghidraInstallDir = System.env.GHIDRA_INSTALL_DIR
22 | }
23 | else if (project.hasProperty("GHIDRA_INSTALL_DIR")) {
24 | ghidraInstallDir = project.getProperty("GHIDRA_INSTALL_DIR")
25 | }
26 |
27 | if (ghidraInstallDir) {
28 | apply from: new File(ghidraInstallDir).getCanonicalPath() + "/support/buildExtension.gradle"
29 | }
30 | else {
31 | throw new GradleException("GHIDRA_INSTALL_DIR is not defined!")
32 | }
33 | //----------------------END "DO NOT MODIFY" SECTION-------------------------------
34 |
--------------------------------------------------------------------------------
/build/classes/java/main/stm32/stm32Loader$RegLabel.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/build/classes/java/main/stm32/stm32Loader$RegLabel.class
--------------------------------------------------------------------------------
/build/classes/java/main/stm32/stm32Loader$STM32InterruptVector.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/build/classes/java/main/stm32/stm32Loader$STM32InterruptVector.class
--------------------------------------------------------------------------------
/build/classes/java/main/stm32/stm32Loader$STM32MemRegion.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/build/classes/java/main/stm32/stm32Loader$STM32MemRegion.class
--------------------------------------------------------------------------------
/build/classes/java/main/stm32/stm32Loader.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/build/classes/java/main/stm32/stm32Loader.class
--------------------------------------------------------------------------------
/build/help/main/help/stm32_HelpSet.hs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | stm32 HelpSet
7 |
8 |
9 |
10 |
11 | TOC
12 |
13 | docking.help.CustomTOCView
14 | stm32_TOC.xml
15 |
16 |
17 | Search
18 |
19 | docking.help.CustomSearchView
20 | stm32_JavaHelpSearch
21 |
22 |
23 | Favorites
24 |
25 | docking.help.CustomFavoritesView
26 |
27 |
28 |
--------------------------------------------------------------------------------
/build/help/main/help/stm32_JavaHelpSearch/DOCS:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/build/help/main/help/stm32_JavaHelpSearch/DOCS
--------------------------------------------------------------------------------
/build/help/main/help/stm32_JavaHelpSearch/DOCS.TAB:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/build/help/main/help/stm32_JavaHelpSearch/DOCS.TAB
--------------------------------------------------------------------------------
/build/help/main/help/stm32_JavaHelpSearch/OFFSETS:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/build/help/main/help/stm32_JavaHelpSearch/OFFSETS
--------------------------------------------------------------------------------
/build/help/main/help/stm32_JavaHelpSearch/POSITIONS:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/build/help/main/help/stm32_JavaHelpSearch/POSITIONS
--------------------------------------------------------------------------------
/build/help/main/help/stm32_JavaHelpSearch/SCHEMA:
--------------------------------------------------------------------------------
1 | JavaSearch 1.0
2 | TMAP bs=2048 rt=0 fl=-1 id1=25 id2=1
3 |
--------------------------------------------------------------------------------
/build/help/main/help/stm32_JavaHelpSearch/TMAP:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/build/help/main/help/stm32_JavaHelpSearch/TMAP
--------------------------------------------------------------------------------
/build/help/main/help/stm32_TOC.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/build/help/main/help/stm32_map.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
--------------------------------------------------------------------------------
/build/helpconfig:
--------------------------------------------------------------------------------
1 | IndexRemove /home/wrongbaud/eclipse-workspace/stm32/src/main/help/
2 |
--------------------------------------------------------------------------------
/build/libs/stm32.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/build/libs/stm32.jar
--------------------------------------------------------------------------------
/build/resources/main/images/README.txt:
--------------------------------------------------------------------------------
1 | The "src/resources/images" directory is intended to hold all image/icon files used by
2 | this module.
3 |
--------------------------------------------------------------------------------
/build/tmp/jar/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 |
3 |
--------------------------------------------------------------------------------
/build/tmp/src/stm32-src.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/build/tmp/src/stm32-src.zip
--------------------------------------------------------------------------------
/data/README.txt:
--------------------------------------------------------------------------------
1 | The "data" directory is intended to hold data files that will be used by this module and will
2 | not end up in the .jar file, but will be present in the zip or tar file. Typically, data
3 | files are placed here rather than in the resources directory if the user may need to edit them.
4 |
5 | An optional data/languages directory can exist for the purpose of containing various Sleigh language
6 | specification files and importer opinion files.
7 |
8 | The data/buildLanguage.xml is used for building the contents of the data/languages directory.
9 |
10 | The skel language definition has been commented-out within the skel.ldefs file so that the
11 | skeleton language does not show-up within Ghidra.
12 |
13 | See the Sleigh language documentation (docs/languages/index.html) for details Sleigh language
14 | specification syntax.
15 |
--------------------------------------------------------------------------------
/dist/ghidra_9.1.2_PUBLIC_20200222_stm32.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wrongbaud/ghidra-stm32/e3d5d969bbc8126e56da69175846fcbf594cd208/dist/ghidra_9.1.2_PUBLIC_20200222_stm32.zip
--------------------------------------------------------------------------------
/extension.properties:
--------------------------------------------------------------------------------
1 | name=@extname@
2 | description=loader for the STM32F2 series of microcontrollers
3 | author=wrongbaud
4 | createdOn=
5 | version=@extversion@
6 |
--------------------------------------------------------------------------------
/ghidra_scripts/README.txt:
--------------------------------------------------------------------------------
1 | Java source directory to hold module-specific Ghidra scripts.
2 |
--------------------------------------------------------------------------------
/lib/README.txt:
--------------------------------------------------------------------------------
1 | The "lib" directory is intended to hold Jar files which this module
2 | is dependent upon. This directory may be eliminated from a specific
3 | module if no other Jar files are needed.
4 |
--------------------------------------------------------------------------------
/os/linux64/README.txt:
--------------------------------------------------------------------------------
1 | The "os/linux64" directory is intended to hold Linux native binaries
2 | which this module is dependent upon. This directory may be eliminated for a specific
3 | module if native binaries are not provided for the corresponding platform.
4 |
--------------------------------------------------------------------------------
/os/osx64/README.txt:
--------------------------------------------------------------------------------
1 | The "os/osx64" directory is intended to hold macOS (OS X) native binaries
2 | which this module is dependent upon. This directory may be eliminated for a specific
3 | module if native binaries are not provided for the corresponding platform.
4 |
--------------------------------------------------------------------------------
/os/win64/README.txt:
--------------------------------------------------------------------------------
1 | The "os/win64" directory is intended to hold MS Windows native binaries (.exe)
2 | which this module is dependent upon. This directory may be eliminated for a specific
3 | module if native binaries are not provided for the corresponding platform.
4 |
--------------------------------------------------------------------------------
/src/main/help/help/TOC_Source.xml:
--------------------------------------------------------------------------------
1 |
2 |
49 |
50 |
51 |
52 |
57 |
58 |
--------------------------------------------------------------------------------
/src/main/help/help/shared/Frontpage.css:
--------------------------------------------------------------------------------
1 | /* ###
2 | * IP: GHIDRA
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | /*
17 | WARNING!
18 | This file is copied to all help directories. If you change this file, you must copy it
19 | to each src/main/help/help/shared directory.
20 |
21 |
22 | Java Help Note: JavaHelp does not accept sizes (like in 'margin-top') in anything but
23 | px (pixel) or with no type marking.
24 |
25 | */
26 |
27 | body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 10px; } /* some padding to improve readability */
28 | li { font-family:times new roman; font-size:14pt; }
29 | h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; }
30 | h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; }
31 | h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; }
32 | h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; }
33 |
34 | /*
35 | P tag code. Most of the help files nest P tags inside of blockquote tags (the was the
36 | way it had been done in the beginning). The net effect is that the text is indented. In
37 | modern HTML we would use CSS to do this. We need to support the Ghidra P tags, nested in
38 | blockquote tags, as well as naked P tags. The following two lines accomplish this. Note
39 | that the 'blockquote p' definition will inherit from the first 'p' definition.
40 | */
41 | p { margin-left: 40px; font-family:times new roman; font-size:14pt; }
42 | blockquote p { margin-left: 10px; }
43 |
44 | p.providedbyplugin { color:#7f7f7f; margin-left: 10px; font-size:14pt; margin-top:100px }
45 | p.ProvidedByPlugin { color:#7f7f7f; margin-left: 10px; font-size:14pt; margin-top:100px }
46 | p.relatedtopic { color:#800080; margin-left: 10px; font-size:14pt; }
47 | p.RelatedTopic { color:#800080; margin-left: 10px; font-size:14pt; }
48 |
49 | /*
50 | We wish for a tables to have space between it and the preceding element, so that text
51 | is not too close to the top of the table. Also, nest the table a bit so that it is clear
52 | the table relates to the preceding text.
53 | */
54 | table { margin-left: 20px; margin-top: 10px; width: 80%;}
55 | td { font-family:times new roman; font-size:14pt; vertical-align: top; }
56 | th { font-family:times new roman; font-size:14pt; font-weight:bold; background-color: #EDF3FE; }
57 |
58 | code { color: black; font-family: courier new; font-size: 14pt; }
59 |
--------------------------------------------------------------------------------
/src/main/help/help/topics/stm32/help.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 |
8 |
9 |
10 |
11 |
12 | Skeleton Help File for a Module
13 |
14 |
15 |
16 |
17 |
Skeleton Help File for a Module
18 |
19 |
This is a simple skeleton help topic. For a better description of what should and should not
20 | go in here, see the "sample" Ghidra extension in the Extensions/Ghidra directory, or see your
21 | favorite help topic. In general, language modules do not have their own help topics.
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/main/java/stm32/stm32Loader.java:
--------------------------------------------------------------------------------
1 | /* ###
2 | * IP: GHIDRA
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package stm32;
17 |
18 | import java.io.IOException;
19 | import java.io.InputStream;
20 | import java.util.*;
21 |
22 | import ghidra.app.util.Option;
23 | import ghidra.app.util.bin.ByteProvider;
24 | import ghidra.app.util.importer.MessageLog;
25 | import ghidra.app.util.opinion.AbstractLibrarySupportLoader;
26 | import ghidra.app.util.opinion.LoadSpec;
27 | import ghidra.framework.model.DomainObject;
28 | import ghidra.framework.store.LockException;
29 | import ghidra.program.flatapi.FlatProgramAPI;
30 | import ghidra.program.model.address.AddressOverflowException;
31 | import ghidra.program.model.data.DataTypeManager;
32 | import ghidra.program.model.lang.LanguageCompilerSpecPair;
33 | import ghidra.program.model.listing.Data;
34 | import ghidra.program.model.listing.Program;
35 | import ghidra.program.model.mem.Memory;
36 | import ghidra.program.model.mem.MemoryAccessException;
37 | import ghidra.program.model.mem.MemoryBlock;
38 | import ghidra.program.model.mem.MemoryConflictException;
39 | import ghidra.util.exception.CancelledException;
40 | import ghidra.util.exception.DuplicateNameException;
41 | import ghidra.util.task.TaskMonitor;
42 | import ghidra.program.model.symbol.RefType;
43 | import ghidra.program.model.symbol.SourceType;
44 |
45 | /**
46 | * TODO: Provide class-level documentation that describes what this loader does.
47 | */
48 | public class stm32Loader extends AbstractLibrarySupportLoader {
49 |
50 | private static class RegLabel {
51 | String label;
52 | int addr;
53 | private RegLabel(String label, int addr) {
54 | this.label = label;
55 | this.addr = addr;
56 | }
57 |
58 | }
59 |
60 | private static final RegLabel [] USBFSRegs = {
61 | new RegLabel("OTG_FS_GOTGCTL",0x0),
62 | new RegLabel("OTG_FS_GOTGINT",0x4),
63 | new RegLabel("OTG_FS_GAHBCFG",0x8),
64 | new RegLabel("OTG_FS_GUSBCFG",0xc),
65 | new RegLabel("OTG_FS_GRSTCTL",0x10),
66 | new RegLabel("OTG_FS_GINTSTS",0x14),
67 | new RegLabel("OTG_FS_GINTMSK",0x18),
68 | new RegLabel("OTG_FS_GRXSTSR",0x1c),
69 | new RegLabel("OTG_FS_GRXSTSP",0x20),
70 | new RegLabel("OTG_FS_GRXFSIZ",0x24),
71 | new RegLabel("OTG_FS_HNPTXFSIZ",0x28),
72 | new RegLabel("OTG_FS_HNPTXSTS",0x2c),
73 | new RegLabel("OTG_FS_GCCFG",0x38),
74 | new RegLabel("OTG_FS_CID",0x3c),
75 | new RegLabel("OTG_FS_HPTIZ",0x100),
76 | new RegLabel("OTG_FS_DIEPTXF1",0x104),
77 | new RegLabel("OTG_FS_DIEPTXF2",0x108),
78 | new RegLabel("OTG_FS_DIEPTXF3",0x10c),
79 | new RegLabel("OTG_FS_HCFG",0x400),
80 | new RegLabel("OTG_FS_HFIR",0x404),
81 | new RegLabel("OTG_FS_HFNUM",0x408),
82 | new RegLabel("OTG_FS_HPTXSTS",0x410),
83 | new RegLabel("OTG_FS_HAINT",0x414),
84 | new RegLabel("OTG_FS_HAINTMSK",0x418),
85 | new RegLabel("OTG_FS_HPRT", 0x440),
86 | new RegLabel("OTG_FS_HCINTx", 0x508),
87 | new RegLabel("OTG_FS_HCINTMSKx", 0x50C),
88 | new RegLabel("OTG_FS_HCTSIZx", 0x510),
89 | new RegLabel("OTG_FS_DCFG", 0x800),
90 | new RegLabel("OTG_FS_DCTL", 0x804),
91 | new RegLabel("OTG_FS_DSTS", 0x808),
92 | new RegLabel("OTG_FS_DIEPMSK", 0x810),
93 | new RegLabel("OTG_FS_DOEPMSK", 0x814),
94 | new RegLabel("OTG_FS_DAINT", 0x818),
95 | new RegLabel("OTG_FS_DAINTMSK", 0x81C),
96 | new RegLabel("OTG_FS_DVBUSDIS", 0x828),
97 | new RegLabel("OTG_FS_DVBUSPULSE", 0x82C),
98 | new RegLabel("OTG_FS_DIEPEMPMSK", 0x834),
99 | new RegLabel("OTG_FS_DIEPCTL0", 0x900),
100 | new RegLabel("OTG_FS_DIEPINTx", 0x908),
101 | new RegLabel("OTG_FS_DIEPTSIZ0", 0x910),
102 | new RegLabel("OTG_FS_DIEPTSIZ1", 0x930),
103 | new RegLabel("OTG_FS_DIEPTSIZ1", 0x950),
104 | new RegLabel("OTG_FS_DIEPTSIZ1", 0x970),
105 | new RegLabel("OTG_FS_DOEPCTL0", 0xB00),
106 | new RegLabel("OTG_FS_DOEPCTL1", 0xB20),
107 | new RegLabel("OTG_FS_DOEPCTL2", 0xB40),
108 | new RegLabel("OTG_FS_DOEPCTL3", 0xB60),
109 | new RegLabel("OTG_FS_DOEPINT", 0xB08),
110 | new RegLabel("OTG_FS_DOEPTSIZ",0xB10),
111 | };
112 |
113 | private static final RegLabel [] USBHSRegs = {
114 | new RegLabel("OTG_HS_GOTGCTL",0x0),
115 | new RegLabel("OTG_HS_GOTGINT",0x4),
116 | new RegLabel("OTG_HS_GAHBCFG",0x8),
117 | new RegLabel("OTG_HS_GUSBCFG",0xc),
118 | new RegLabel("OTG_HS_GRSTCTL",0x10),
119 | new RegLabel("OTG_HS_GINTSTS",0x14),
120 | new RegLabel("OTG_HS_GINTMSK",0x18),
121 | new RegLabel("OTG_HS_GRXSTSR",0x1c),
122 | new RegLabel("OTG_HS_GRXSTSP",0x20),
123 | new RegLabel("OTG_HS_GRXFSIZ",0x24),
124 | new RegLabel("OTG_HS_HNPTXFSIZ",0x28),
125 | new RegLabel("OTG_HS_HNPTXSTS",0x2c),
126 | new RegLabel("OTG_HS_GCCFG",0x38),
127 | new RegLabel("OTG_HS_CID",0x3c),
128 | new RegLabel("OTG_HS_HPTIZ",0x100),
129 | new RegLabel("OTG_HS_DIEPTXF1",0x104),
130 | new RegLabel("OTG_HS_DIEPTXF2",0x108),
131 | new RegLabel("OTG_HS_DIEPTXF3",0x10C),
132 | new RegLabel("OTG_HS_DIEPTXF5",0x110),
133 | new RegLabel("OTG_HS_DIEPTXF6",0x114),
134 | new RegLabel("OTG_HS_DIEPTXF7",0x118),
135 | new RegLabel("OTG_HS_HCFG",0x400),
136 | new RegLabel("OTG_HS_HFIR",0x404),
137 | new RegLabel("OTG_HS_HFNUM",0x408),
138 | new RegLabel("OTG_HS_HPTXSTS",0x410),
139 | new RegLabel("OTG_HS_HAINT",0x414),
140 | new RegLabel("OTG_HS_HAINTMSK",0x418),
141 | new RegLabel("OTG_HS_HPRT", 0x440),
142 | new RegLabel("OTG_HS_HCSPLT", 0x504),
143 | new RegLabel("OTG_HS_HCINT", 0x508),
144 | new RegLabel("OTG_HS_HCINTMSK", 0x50C),
145 | new RegLabel("OTG_HS_HCTSIZx", 0x510),
146 | new RegLabel("OTG_HS_HCDMA", 0x514),
147 | new RegLabel("OTG_HS_HCCHAR0", 0x500),
148 | new RegLabel("OTG_HS_HCCHAR1", 0x520),
149 | new RegLabel("OTG_HS_HCCHAR2", 0x540),
150 | new RegLabel("OTG_HS_HCCHAR3", 0x560),
151 | new RegLabel("OTG_HS_HCCHAR4", 0x580),
152 | new RegLabel("OTG_HS_HCCHAR5", 0x5A0),
153 | new RegLabel("OTG_HS_HCCHAR6", 0x5c0),
154 | new RegLabel("OTG_HS_HCCHAR7", 0x5e0),
155 | new RegLabel("OTG_HS_HCCHAR8", 0x600),
156 | new RegLabel("OTG_HS_HCCHAR9", 0x620),
157 | new RegLabel("OTG_HS_HCCHAR10", 0x640),
158 | new RegLabel("OTG_HS_HCCHAR11", 0x660),
159 |
160 | new RegLabel("OTG_HS_DCFG", 0x800),
161 | new RegLabel("OTG_HS_DCTL", 0x804),
162 | new RegLabel("OTG_HS_DSTS", 0x808),
163 | new RegLabel("OTG_HS_DIEPMSK", 0x810),
164 | new RegLabel("OTG_HS_DOEPMSK", 0x814),
165 | new RegLabel("OTG_HS_DAINT", 0x818),
166 | new RegLabel("OTG_HS_DAINTMSK", 0x81C),
167 | new RegLabel("OTG_HS_DVBUSDIS", 0x828),
168 | new RegLabel("OTG_HS_DVBUSPULSE", 0x82C),
169 | new RegLabel("OTG_HS_DIEPEMPMSK", 0x834),
170 | new RegLabel("OTG_HS_DEACHINT", 0x838),
171 | new RegLabel("OTG_HS_DEACHINTMSK", 0x83C),
172 | new RegLabel("OTG_HS_DIEPEACHMSK1", 0x844),
173 | new RegLabel("OTG_HS_DOEPEACHMSK1", 0x884),
174 |
175 | new RegLabel("OTG_HS_DIEPCTL0", 0x900),
176 | new RegLabel("OTG_HS_DIEPCTL1", 0x920),
177 | new RegLabel("OTG_HS_DIEPCTL2", 0x940),
178 | new RegLabel("OTG_HS_DIEPCTL3", 0x960),
179 | new RegLabel("OTG_HS_DIEPCTL4", 0x980),
180 | new RegLabel("OTG_HS_DIEPCTL5", 0x9A0),
181 | new RegLabel("OTG_HS_DIEPCTL6", 0x9C0),
182 | new RegLabel("OTG_HS_DIEPCTL7", 0x9E0),
183 |
184 | new RegLabel("OTG_HS_DIEPCTL0", 0x900),
185 | new RegLabel("OTG_HS_DIEPINTx", 0x908),
186 | new RegLabel("OTG_HS_DIEPTSIZ0", 0x910),
187 | new RegLabel("OTG_HS_DIEPTSIZ1", 0x930),
188 | new RegLabel("OTG_HS_DIEPTSIZ1", 0x950),
189 | new RegLabel("OTG_HS_DIEPTSIZ1", 0x970),
190 | new RegLabel("OTG_HS_DOEPCTL0", 0xB00),
191 | new RegLabel("OTG_HS_DOEPCTL1", 0xB20),
192 | new RegLabel("OTG_HS_DOEPCTL2", 0xB40),
193 | new RegLabel("OTG_HS_DOEPCTL3", 0xB60),
194 | new RegLabel("OTG_HS_DOEPINT", 0xB08),
195 | new RegLabel("OTG_HS_DOEPTSIZ",0xB10),
196 | };
197 |
198 |
199 | private static class STM32InterruptVector{
200 | String name;
201 | int addr;
202 | private STM32InterruptVector(String name, int addr)
203 | {
204 | this.name = name;
205 | this.addr = addr;
206 | }
207 | }
208 |
209 | private static final STM32InterruptVector [] STM32IVT = {
210 | new STM32InterruptVector("RESET",0x4),
211 | new STM32InterruptVector("NMI",0x8),
212 | new STM32InterruptVector("HardFault",0xC),
213 | new STM32InterruptVector("MemManage",0x10),
214 | new STM32InterruptVector("BusFault",0x14),
215 | new STM32InterruptVector("UsageFault",0x18),
216 | new STM32InterruptVector("SVCall",0x2C),
217 | new STM32InterruptVector("Debug Monitor",0x30),
218 | new STM32InterruptVector("PendSV",0x38),
219 | new STM32InterruptVector("SysTick",0x3C),
220 | new STM32InterruptVector("WWDG",0x40),
221 | new STM32InterruptVector("PVD",0x44),
222 | new STM32InterruptVector("TAMP_STAMP",0x48),
223 | new STM32InterruptVector("RTC_WKUP",0x4C),
224 | new STM32InterruptVector("FLASH",0x50),
225 | new STM32InterruptVector("RCC",0x54),
226 | new STM32InterruptVector("EXTI0",0x58),
227 | new STM32InterruptVector("EXTI1",0x5C),
228 | new STM32InterruptVector("EXTI2",0x60),
229 | new STM32InterruptVector("EXTI3",0x64),
230 | new STM32InterruptVector("EXTI4",0x68),
231 | new STM32InterruptVector("DMA1_Stream0",0x6C),
232 | new STM32InterruptVector("DMA1_Stream1",0x70),
233 | new STM32InterruptVector("DMA1_Stream2",0x74),
234 | new STM32InterruptVector("DMA1_Stream3",0x78),
235 | new STM32InterruptVector("DMA1_Stream4",0x7C),
236 | new STM32InterruptVector("DMA1_Stream5",0x80),
237 | new STM32InterruptVector("DMA1_Stream6",0x84),
238 | new STM32InterruptVector("ADC",0x88),
239 | new STM32InterruptVector("CAN1_TX",0x8C),
240 | new STM32InterruptVector("CAN1_RX0",0x90),
241 | new STM32InterruptVector("CAN1_RX1",0x94),
242 | new STM32InterruptVector("CAN1_SCE",0x98),
243 | new STM32InterruptVector("EXTI9_5",0x9C),
244 | new STM32InterruptVector("TIM1_BRK_TIM9",0xA0),
245 | new STM32InterruptVector("TIM1_UP_TIM10",0xA4),
246 | new STM32InterruptVector("TIM1_TRG_COM_TIM11",0xA8),
247 | new STM32InterruptVector("TIM1_CC",0xAC),
248 | new STM32InterruptVector("TIM2",0xB0),
249 | new STM32InterruptVector("TIM3",0xB4),
250 | new STM32InterruptVector("TIM4",0xB8),
251 | new STM32InterruptVector("I2C1_EV",0xBc),
252 | new STM32InterruptVector("I2C1_ER",0xC0),
253 | new STM32InterruptVector("I2C2_EV",0xC4),
254 | new STM32InterruptVector("I2C2_ER",0xC8),
255 | new STM32InterruptVector("SPI1",0xCC),
256 | new STM32InterruptVector("SPI2",0xD0),
257 | new STM32InterruptVector("USART1",0xD4),
258 | new STM32InterruptVector("USART2",0xD8),
259 | new STM32InterruptVector("USART3",0xDC),
260 | new STM32InterruptVector("EXTI15_10",0xE0),
261 | new STM32InterruptVector("RTC_Alarm",0xE4),
262 | new STM32InterruptVector("OTG_FS_WKUP",0xE8),
263 | new STM32InterruptVector("TIM8_BRK_TIM12",0xEC),
264 | new STM32InterruptVector("TIM8_UP_TIM13",0xF0),
265 | new STM32InterruptVector("TIM8_TRG_COM_TIM14",0xF4),
266 | new STM32InterruptVector("TIM8_CC",0xF8),
267 | new STM32InterruptVector("DMA1_Stream7",0xFC),
268 | new STM32InterruptVector("FSMC",0x100),
269 | new STM32InterruptVector("SDIO",0x104),
270 | new STM32InterruptVector("TIM5",0x108),
271 | new STM32InterruptVector("SPI3",0x10C),
272 | new STM32InterruptVector("UART4",0x110),
273 | new STM32InterruptVector("UART5",0x114),
274 | new STM32InterruptVector("TIM6_DAC",0x118),
275 | new STM32InterruptVector("TIM7",0x11c),
276 | new STM32InterruptVector("DMA2_Stream0",0x120),
277 | new STM32InterruptVector("DMA2_Stream1",0x124),
278 | new STM32InterruptVector("DMA2_Stream2",0x128),
279 | new STM32InterruptVector("DMA2_Stream3",0x12C),
280 | new STM32InterruptVector("DMA2_Stream4",0x130),
281 | new STM32InterruptVector("ETH",0x134),
282 | new STM32InterruptVector("ETH_WKUP",0x138),
283 | new STM32InterruptVector("CAN2_TX",0x13C),
284 | new STM32InterruptVector("CAN2_RX0",0x140),
285 | new STM32InterruptVector("CAN2_RX1",0x144),
286 | new STM32InterruptVector("CAN2_SCE",0x148),
287 | new STM32InterruptVector("OTG_FS",0x14C),
288 | new STM32InterruptVector("DMA2_Stream5",0x150),
289 | new STM32InterruptVector("DMA2_Stream6",0x154),
290 | new STM32InterruptVector("DMA2_Stream7",0x158),
291 | new STM32InterruptVector("USART6",0x15C),
292 | new STM32InterruptVector("I2C3_EV",0x160),
293 | new STM32InterruptVector("I2C3_ER",0x164),
294 | new STM32InterruptVector("OTG_HS_EP1_OUT",0x168),
295 | new STM32InterruptVector("OTG_HS_EP1_IN",0x16C),
296 | new STM32InterruptVector("OTG_HS_WKUP",0x170),
297 | new STM32InterruptVector("OTG_HS",0x174),
298 | new STM32InterruptVector("DCMI",0x178),
299 | new STM32InterruptVector("CRYP",0x17C),
300 | new STM32InterruptVector("HACH_RNG",0x180),
301 |
302 | };
303 |
304 | private static class STM32MemRegion {
305 | String name;
306 | int addr;
307 | int size;
308 | boolean read;
309 | boolean write;
310 | boolean execute;
311 | private STM32MemRegion(String name, int addr, int size, boolean read, boolean write, boolean execute) {
312 | this.name = name;
313 | this.addr = addr;
314 | this.size = size;
315 | this.read = read;
316 | this.write = write;
317 | this.execute = execute;
318 | }
319 | }
320 | // Pull these regions from the datasheet
321 | private static final STM32MemRegion [] STM32MEM = {
322 | new STM32MemRegion("TIM2",0x40000000,0x3FF,true,true,false),
323 | new STM32MemRegion("TIM3",0x40000400,0x3FF,true,true,false),
324 | new STM32MemRegion("TIM4",0x40000800,0x3FF,true,true,false),
325 | new STM32MemRegion("TIM5",0x40000C00,0x3FF,true,true,false),
326 | new STM32MemRegion("TIM6",0x40001000,0x3FF,true,true,false),
327 | new STM32MemRegion("TIM7",0x40001400,0x3FF,true,true,false),
328 | new STM32MemRegion("TIM12",0x40001800,0x3FF,true,true,false),
329 | new STM32MemRegion("TIM13",0x40001C00,0x3FF,true,true,false),
330 | new STM32MemRegion("TIM14",0x40002000,0x3FF,true,true,false),
331 | new STM32MemRegion("RTC/BKP",0x40002800,0x3FF,true,true,false),
332 | new STM32MemRegion("WWDG",0x40002C00,0x3FF,true,true,false),
333 | new STM32MemRegion("IWDG",0x40003000,0x3FF,true,true,false),
334 | new STM32MemRegion("SPI2/I2S2",0x40003800,0x3FF,true,true,false),
335 | new STM32MemRegion("SPI3/I2S3",0x40003C00,0x3FF,true,true,false),
336 | new STM32MemRegion("USART2",0x40004400,0x3FF,true,true,false),
337 | new STM32MemRegion("USART3",0x40004800,0x3FF,true,true,false),
338 | new STM32MemRegion("USART4",0x40004C00,0x3FF,true,true,false),
339 | new STM32MemRegion("USART5",0x40005000,0x3FF,true,true,false),
340 | new STM32MemRegion("I2C1",0x40005400,0x3FF,true,true,false),
341 | new STM32MemRegion("I2C2",0x40005800,0x3FF,true,true,false),
342 | new STM32MemRegion("I2C3",0x40005C00,0x3FF,true,true,false),
343 | new STM32MemRegion("CAN1",0x40006400,0x3FF,true,true,false),
344 | new STM32MemRegion("CAN2",0x40006800,0x3FF,true,true,false),
345 | new STM32MemRegion("PWR",0x40007000,0x3FF,true,true,false),
346 | new STM32MemRegion("DAC",0x40007400,0x3FF,true,true,false),
347 | new STM32MemRegion("TIM1",0x40010000,0x3FF,true,true,false),
348 | new STM32MemRegion("TIM8",0x40010400,0x3FF,true,true,false),
349 | new STM32MemRegion("USART1",0x40011000,0x3FF,true,true,false),
350 | new STM32MemRegion("USART6",0x40011400,0x3FF,true,true,false),
351 | new STM32MemRegion("ADC1/2/3",0x40012000,0x3FF,true,true,false),
352 | new STM32MemRegion("SDIO",0x40012C00,0x3FF,true,true,false),
353 | new STM32MemRegion("SPI1",0x40013000,0x3FF,true,true,false),
354 | new STM32MemRegion("SYSCFG",0x40013800,0x3FF,true,true,false),
355 | new STM32MemRegion("EXTI",0x40013C00,0x3FF,true,true,false),
356 | new STM32MemRegion("TIM9",0x40014000,0x3FF,true,true,false),
357 | new STM32MemRegion("TIM10",0x40014400,0x3FF,true,true,false),
358 | new STM32MemRegion("TIM11",0x40014800,0x3FF,true,true,false),
359 | new STM32MemRegion("GPIOA",0x40020000,0x3FF,true,true,false),
360 | new STM32MemRegion("GPIOB",0x40020400,0x3FF,true,true,false),
361 | new STM32MemRegion("GPIOC",0x40020800,0x3FF,true,true,false),
362 | new STM32MemRegion("GPIOD",0x40020c00,0x3FF,true,true,false),
363 | new STM32MemRegion("GPIOE",0x40021000,0x3FF,true,true,false),
364 | new STM32MemRegion("GPIOF",0x40021400,0x3FF,true,true,false),
365 | new STM32MemRegion("GPIOG",0x40021800,0x3FF,true,true,false),
366 | new STM32MemRegion("GPIOH",0x40021c00,0x3FF,true,true,false),
367 | new STM32MemRegion("GPIOI",0x40022000,0x3FF,true,true,false),
368 | new STM32MemRegion("CRC",0x40023000,0x3FF,true,true,false),
369 | new STM32MemRegion("RCC",0x40023800,0x3FF,true,true,false),
370 | new STM32MemRegion("Flash Interface Register",0x40023C00,0x3FF,true,true,false),
371 | new STM32MemRegion("BKPSRAM",0x40024000,0x3FF,true,true,false),
372 | new STM32MemRegion("DMA1",0x40026000,0x3FF,true,true,false),
373 | new STM32MemRegion("DMA2",0x40026400 ,0x3FF,true,true,false),
374 | new STM32MemRegion("Ethernet Mac",0x40028000 ,0x13FF,true,true,false),
375 | new STM32MemRegion("USB OTG HS",0x40040000 ,0x3FFFF,true,true,false),
376 | new STM32MemRegion("USB OTG FS",0x50000000 ,0x3FFFF,true,true,false),
377 | new STM32MemRegion("DCMI",0x50050000 ,0x3FF,true,true,false),
378 | new STM32MemRegion("CRYP",0x50060000 ,0x3FF,true,true,false),
379 | new STM32MemRegion("HASH",0x50060400 ,0x3FF,true,true,false),
380 | new STM32MemRegion("RNG",0x50060800 ,0x3FF,true,true,false),
381 | new STM32MemRegion("FSMC Control Register",0xA0000000 ,0xFFF,true,true,false),
382 | new STM32MemRegion("SRAM",0x20000000 ,0x20000,true,true,true),
383 | new STM32MemRegion("System Memory",0x1FFF0000 ,0x77FF,true,true,true),
384 | // TODO: Add the ability to select and load these in from the loader...
385 | new STM32MemRegion("OTP",0x1FFF7800 ,0x20F,true,false,false),
386 | new STM32MemRegion("Option Bytes",0x1FFFC000 ,0xF,true,false,false),
387 | };
388 | @Override
389 | public String getName() {
390 |
391 | // TODO: Name the loader. This name must match the name of the loader in the .opinion
392 | // files.
393 |
394 | return "STM32F2";
395 | }
396 |
397 | @Override
398 | public Collection findSupportedLoadSpecs(ByteProvider provider) throws IOException {
399 | List loadSpecs = new ArrayList<>();
400 |
401 | // TODO: Examine the bytes in 'provider' to determine if this loader can load it. If it
402 | // can load it, return the appropriate load specifications.
403 |
404 | // The STM32 has a 32 bit Arm Cortex LE core, so that is the language that we will use
405 | loadSpecs.add(new LoadSpec(this, 0, new LanguageCompilerSpecPair("ARM:LE:32:Cortex", "default"), true));
406 | return loadSpecs;
407 | }
408 |
409 | @Override
410 | protected void load(ByteProvider provider, LoadSpec loadSpec, List