Decompile ELF on Windows - elf

I want to decompile file ELF 64-bit LSB executable
with IDA on Windows, Its possible? If no, How can I do it on linux?
Thanks

You don't need to execute the binary in order to perform binary decompilation, it's something that usually happens statically, thus it'd work with ELF on Windows.
You can decompile binaries with IDA using several ways:
Hex Rays Decompiler from the creators of IDA itself (not free)
Snowman, open-source decompiler (free)
retdec decompiler plugin (free, registration required)
decompiler by EiNSTeiN
Ghidra, open source decompiler (free)

Related

Angstrom Toolchain

I am new to angstrom and linux. I am in the process of building an sdk with angstrom. But I cant understand what is a Toolchain and its functionality. Please someone help me here.
In software, a toolchain is the set of programming tools that are used to create a product (typically another computer program or system of programs). The tools may be used in a chain, so that the output of each tool becomes the input for the next, but the term is used widely to refer to any set of linked development tools.
A simple software development toolchain consists of a compiler and linker to transform the source code into an executable program, libraries to provide interfaces to the operating system, and a debugger.
http://en.wikipedia.org/wiki/Toolchain

How to set up a dev. environment for ARM board AT91SAM7-EX256 under x86 Linux?

I am a newbie to embedded developement, as figure shown. I have a small ARM board, AT91SAM7-EX256. I have also a JTAG programmer dongle, too. I am using Linux (Ubuntu x86_32) on my notebook and desktop machine. I'm using CodeSourcery Lite for cross-compiling to ARM-Linux.
Am I right that I can't use this Linux-target cross-compiler to make binary or hex files for the small ARM board (it comes without any operating system)? Should I use the version called ARM EABI instead?
As I see, it's a "generic" ARM compiler. I've read some docs, and there're lot of options to specify the processor type and instruction set (thumb, etc.), there will be no problem with it. But how can I tell the compiler, how should the image (bin/hex) looks like for the specific board (startup, code/data blocks etc.)? (In assemblers, there're the org and load directives for it.)
What software do I need to capture some debug messages from the board on my PC? I don't want to on-board debugging, I just need some detailed run-time signal, more than just blinking leds.
I have an option to use MS-Windows, I can get a dedicated machine for it. Do you recommend it, is it much easier?
Can I use inline assembly somehow in my C code? I dunno anything about that. Can I use C++ or just C?
I have also a question, which don't need to answer: are there really 4096 kind of GNU compilers and cross-compilers (from Linux_x86_32 -> Linux_x86_32, Linux_x86_32 -> Linux_ARM, OSX -> Linux_ARM, PPC_Linux -> OSX) and 16 different GNU compiler sources (as many target platforms/processors exists) around? The signs says "yes", but I can't believe it. Correct me, and show me the GNU compiler which can produce object file for any platform/processor, and the universal linker which can produce executable for any platform.
While Windows is not a "better" platform do this kind of embedded development on, it may be easier to start with since you can get a pre-built environment to work with. For example, Yagarto (which I would recommend).
Setting up an embedded development environment on Linux can require a considerable amount of knowledge, but it's not impossible.
To answer your questions:
Your Linux cross-compiler comes with libraries to build executables for a Linux environment. You have hinted that you want to build a bare-metal executable for this board. While you can do this with your compiler, it will just confuse things. I recommend building a baremetal cross-compiler. Since you're building your own baremetal executable (and thus you are the operating system, the ABI doesn't matter since you're generating all of the code and not interoperating with other previously built code.
There are several versions of the ARM instruction set (and Thumb). You need to generate code for your particular processor. If you generate the code for a newer version of the instruction set, you will likely generate code which generates a reserved instruction exception. Most prebuilt gcc cross-compiler toolchains for ARM are "multilib" and will build for a variety of architectures in both ARM and Thumb.
Not sure exactly what you're looking for here. This is a bare metal platform. You can use the debugger channel to send messages if you're debugging on target, or you'll need to build your own communication channel into the firmware you write (i.e. uart support).
See above.
Yes. See here for details on gcc's extended inline assembly syntax. You can do this in C++ and C. You can also simply link pure assembly files.
There is no universal gcc compiler / linker. You need a uniquely built compiler for each host / target combination you use.
Finally, please take a look at Atmel's documentation. They have a wealth of information on developing for this target as well as a board package with the needed linker directives and example programs. Note of course the package is for Atmel's own eval board, but it will get you started.
http://sam7stuff.blogspot.com/
I use either of the codesourcery lite versions. But I have no use for the gcc library nor a C library, I just need a compiler.
In the gcc 3 days newlib was great, modify two files worth of system support (simple open, close, read, putc type stuff) and you could compile just about anything, but with gcc 4.x you cannot even go back and cross compile gcc 3.x, you have to install an old linux distro in a virtual machine.
To get the gcc library yes you probably want to use the eabi version not the version with linux gnueabi in the file names.
You might also consider llvm (if you dont need a C library, and you will still need binutils), hmm, I wonder if newlib compiles with llvm.
I prefer to avoid getting trapped in sandboxes, learn the tools and how to manipulate the linker, etc to build your binaries.

How do you implement a portable JVM into your program?

So I've heard of programs that have some sort of portable JVM that runs in their program, so it can run on any computer, no matter what, with no dependencies.
How did they do that?
Avian is designed to work this way. You build your app as a native executable for whatever platform(s) you need to support, and that executable contains the VM, an embedded JAR containing your Java classes and resources, and any JNI code your app requires.
If what you're looking for is have a portable version of a JRE, you can just zip your own JRE/JDK and have your program use it.
See my answer on a related question.

Adobe alchemy and dllimport

Is it possible to connect c++ dll to .c file (with dllimport or something else) and convert it to .swc with adobe alchemy? If it does - how to do that?
This is like asking "can I use a dll on mac os x"?
A dll is platform-specific (windows) machine code. Alchemy is a C/C++ compiler for Flash. They don't mix- all your code must be compiled with Alchemy.
For more info see the Alchemy FAQ.
If you're running on the desktop (AIR) you can execute DLLs with the NativeProcess. That might be as close as you can get.

OK Programming language from USB stick with no installation

I'm looking for a compiler or interpreter for a language with basic math support and File IO which can be executed directly from a memorystick in either Linux or Windows. Built in functionality for basic datastructures and sorting/searching would be a plus.
(I've read about movable python, but it only supports windows)
Thank you
Not sure what are the issues there for the other languages, but I am pretty sure that Lua will work fine on such environment.
It is perfect for your requirements: basic I/O, math functions, excellent data structures (all based on numeric and associative array, with any kind of key/values, allowing the most complex operations).
Bonus: very simple to learn (for the bases, at least), readable, and powerful when you start to dig. And it starts to have a number of useful libraries, sockets, regexes and parsers, GUI, etc.
It is just a single binary file, no install at all, no registry access, no file access (beyond reading the binary and script!) if not requested, totally transparent: it is often used in embedded system, often memory constrained, on Roms, etc.
There is a python distribution called Movable Python which is designed to do exactly that. It might do what you want. Also, MinGW/MSYS will run on Windows with no registry entries or other installation beyond placing the files in a directory tree - all you need to do is set up the relevant directories in the path, which can be done in a batch file.
The Java JDK easily fits on a stick, and does not require installation; You can install it to a PC first and then just copy the install directory to the stick. I presume you can do the same for the Linux JDK.
And there's a ton of good text editors that don't require installation.
Not sure if it still applies to current versions, but I have an ancient perl.exe (version 5.001, from 1994 or 1995) that still works perfectly fine as a no-installation single executable.
If you can tolerate TCL, it's hard to beat a tclkit
TCC (the Tiny C Compiler) is a full implementation of C in a really small package. You can even write shell scripts in C:
#!/usr/local/bin/tcc -run
#include <stdio.h>
int main()
{
printf("Hello World\n");
return 0;
}
TCC is available for any Unix-like platform, and also for Windows.
I've done exactly that with Ruby. Worked well.
I'm way late for this party, but I thought I'd weigh in anyway.
I currently have a Windows-usable USB stick with the following installed on it (for Windows):
Languages
Java
Erlang
Fantom
Groovy
Haskell
jacl (JVM-based Tcl)
JavaFX
JRuby (JVM-based Ruby)
Jython (JVM-based Python)
NASM
nice
pnuts
Rexx
Scala
SISC (JVM-based Scheme)
Sleep
Tcl
Prolog
gawk (via GnuWin32 and MinGW/MSys)
jawk (JVM-based AWK)
ANTLR
Clojure
JBasic (JVM-based BASIC)
Tuprolog (JVM-based Prolog)
Rhino (JVM-based Javascript)
YASM
Lua
Kahlua (JVM-based Lua)
C (via GnuWin32 and MinGW/MSys)
C++ (via GnuWin32 and MinGW/MSys)
Fortran77 (via GnuWin32 and MinGW/MSys)
Ada (via GnuWin32 and MinGW/MSys)
Programming Tools
jEdit (JVM-based programmer's editor)
Ant (JVM-based build tool)
Maven 2 (JVM-based build tool)
vi (via GnuWin32 and MinGW/MSys)
Vim
CMake
gmake (via GnuWin32 and MinGW/MSys)
Leiningen
Subversion
Fossil
ANTLRworks
ctags/etags
Geek Toys
All SIMH emulators, with networking if available
Several operating systems, utilities, etc. for same
And a cast of dozens in key libraries, plus the Geronimo application server.
Yes, this is a single USB stick, and I probably missed an item here or there while making this list. It's amazing what you can run off of a USB stick these days.
http://smallbasic.sourceforge.net/
Runs anywhere (even mobiles) and has everything you need.
You could use DevCpp, it comes with Mingw 3.x or CodeLite (Mingw 4.x) for C/C++. For Pascal you can use DevPas, for Python web development try InstantDjango or better yet Web2py (very nice indeed!), for Ruby you have InstanRails, for Perl you got a complete enviroment (even a C compiler!) with StrawberryPerl. You could install cygwin on the USB drive. There are a lot more options out there. Interested in a LISP like portable/cross-platform and little language? Try newlisp (its a gem!). Also you could run almost anything (linux or windows based) on a portable VM under Portable VirtualBox/VMplayer or QEmu with a performance tax ;).
Why not C++? You can statically link in any external librarys assuming there lisence allows it, and you won't have any external dependencies.