In the start window of Ghidra click the File | New Project... menu entry and create a new project.
Import new file tmc.elf
.
Processor: ARM
Variant: v4t
Size: 32
Endian: little
Compiler: default
Import using the format Executable and Linking Format (ELF)
.
Let it auto-analyze the file. (This takes a while).
Switch to The Little Hat and activate the Ghidra Bridge
plugin. Then click on Tools | Plugins | Export headers to Ghidra.
Switch to Ghidra and click on File | Parse C Source....
Click on the Clear profile button in the top right.
In Source files to parse
click on the Display file chooser to select files to add button. Navigate to the tmp/ghidra_types
folder of The Little Hat and select all files and click OK. Do the same for all files in the gba
subfolder.
Click on Parse to Program.
Click on Continue? in the Use Open Archives?
dialog.
In the Data Type Manager
dock right-click on tmc.elf
and select Apply Function Data Types.
In Ghidra open the Script Manager using the menu entry Window | Script Manager.
Click on Create New Script button in the top right.
Select Java
script type.
Copy contents of the-little-hat/plugins/cexplore_bridge/CExploreBridge.java
.
Or directly create a symlink from the ghidra_scripts
directory.
After starting the script, press No
to keep it running in the background. It starts a webserver on port 10242
that can be used by the CExplore Bridge in The Little Hat to fetch the decompilation for a function and transfer it to CExplore.
Set up the CExplore Bridge in The Little Hat as described in Using the CExplore Bridge plugin. Start the CExplore Bridge webserver in Ghidra.
Click the Set Ghidra global types button in the CExplore Bridge dock.