I'm new to Ghidra so go easy on me. Running it on Windows.
After successfully extracting a Bluetooth door lock's firmware from a nRF51, I proceeded to decompile it using Ghidra. My aim is to able to read some of its original source code, even though I understand it won't be as clean as the original.
But, after analyzing the bin file, I get tons of error. Architecture used/tried to solve this issue was both the ARM Cortex LE 32 bit and the ARM v6 LE 32 bit. Looked for solutions on the internet and I did not find anyone with the same issue. All of the errors are Bad Instruction
.
Here's pictures of two different analyze:
Without ARM Aggressive Instruction Finder (Prototype)
With ARM Aggressive Instruction Finder (Prototype)
The reason I posted two pictures of my code browser because those two different analysis gave me different amount of bookmark. I know it's because of the Instruction Finder but who knows this might help you to help me.
I have also tried adding a line into my ia.sinc
file as suggested by a user named nsadeveloper789 on a GitHub issue but it did not solve my issue. I have also tried the No Return
method from a PDF lesson (page 11) and no luck as well.
Did used SVD-Loader as well but still doesn't solve the issue as the SVD-Loader's script itself might have an issue and I've commented on this issue on GitHub (currently no specific solution). You can have a look at this issue here.
Does anyone knows how to solve this issue? I've been trying for a week or two now and even asked this in the unofficial Ghidra's Discord group but no answer yet.
Looking forward for your answers. Thanks in advance.
Here's a link to download the bin file: https://filebin.net/5abhimciwdfr5gfi
16MHz Cortex M0
which according to Wikipedia an ARMv7 CPU. Hence it may be the case that the illegal instructions are ARM thumb instructions. See also this question.