STM32 decompiler - hex

I found on my pc an old .hex file from a project that I worked a few years ago. The problem is that I couldn find the source code on my pc, and I forgot how my code worked. Can anyone help me to decompile it and to reverse engieneer?

You can open it in IDA or in Ghidra, they should recognize the file as intel-hex. When you open, you should choose the processor - the CPU architecture of the file (ARM, TriCore, PPC, ...).
Your chip is STM32, so it's supposed to be 32-bit LE ARM.
Then browse through the code. If the CPU architecture is supported by your IDA, you can press F5 to decompile a function. Ghidra supports more CPU architectures, so you can just browse through the functions and see the decompilation results in the decompile window.

Related

How can i inspect .dmp files from windows with QtCreator

We are developing out Project with QtCreator 3.1.1 and Qt 5.2.1
Now we got .dmp files from C:\Users\<USER>\AppData\Local\CrashDumps
How can we load them into QtCreator to inspect where the App crashed?
I don't have enough rep to leave this as a comment, but I don't believe Qt can open the .dmp files, they are more of a Microsoft thing. Visual Studio should work if you want to look at it, they have a free community version you can use.
However, that dmp file might not be overly useful, it will likely tell you what you already know (memory access error, etc). These are "small memory dump files" ( you can read more about accessing and configuring them here: https://support.microsoft.com/en-us/kb/315263 ). They have interesting information, but not necessarily the stack trace you're looking for. For example, the stack trace may just be the QtGui and QtCore dll's.
If the crash is reproducible you might have better luck causing the crash on a machine with Qt Creator installed so you can send it directly to debug as it crashes, assuming it's not reproducible when running locally in Qt.

Writing to flash ROM for an embedded OS on atmega328p (h8write equivalent for avr)

I'm currently reading a Japanese book on embedded OS/RTOS es except that I am not using the recommended hardware as I already had a seeeduino microcontroller.(atmega328p) The book is about KOZOS "12 steps to making your own embedded OS" by Sakai Hiroaki(It's hiro-something)
I'm stuck at the part where I need to write into the flash ROM of the atmega328p because the author is using a different chip called H8. He uses a software called h8write and uses that in his OS, but I honestly have no idea what is going on at this point, and what the avr replacement for h8write would be. I've looked around to no avail as there is minimal documentation on what h8write does aside from the "it helps you write to flash ROM" that shows up in the book.
This is the first time I'm doing lower layer stuff and it's frankly terrifying...
I'm using ubuntu 14.04 if that helps.
If I understand correctly, the h8write program is supposed to run on your computer and transfer the compiled to the microcontroller. You are using a seeeduino, which is an Arduino compatible board, with Ubuntu. The standard way of programming on this environment is with the arduino software:
install the arduino package (sudo apt-get install aruino)
type the command arduino from a terminal emulator: this brings an IDE where you can type your code
connect the seeeduino to an USB port
click on the button with a right-pointing arrow: this will take care of everything (compiling, linking and uploading to the seeeduino)
Once you are comfortable with this workflow, you can try to get your hands dirty with low-level stuff. The Arduino IDE is built on top of smaller utilities like avr-gcc, avr-libc, avr-as and avrdude. Avrdude is the program used to transfer the compiled program to the Arduino/seeeduino, i.e. write to the flash. You can use these utilities directly, from the command line. This is however complicated by the fact that you will need to pass many command-line arguments, so I recommend you automate the process using a Makefile. Thankfully there is a generic Arduino Makefile available that makes this quite easy:
install the generic Arduino Makefile: sudo apt-get install arduino-mk
read the instructions in the comments at the top (the Makefile is at /usr/share/arduino/Arduino.mk)
write your own project-specific Makefile as per these instructions
type make to compile your program
type make upload to upload to the seeeduino (i.e. write the flash).
This application note tells you how to write the flash memory during program run.
A very good tutorial on how to use the PROGMEM attribute in AVR microcontrollers can be found here

SensorTag, iBeacon, Compiled firmware doesn't work

Followed the instruction at http://processors.wiki.ti.com/index.php/SensorTag_with_iBeacon.
The iBeacon-enabled firmware was created with IAR and updated with OAD from iPhone but SensorTag stopped working after the update. No advertising, no LED blink by the side button.
I tried same/similar things several times and also tried directly upload the firmware from IAR IDE via CC Debugger but no luck.
I can put it back to the previous working state by uploading downloaded firmware with the flash programmer.
I also tried to compile the standard firmware (SensorTag with no iBeacon from the BLE stack) by myself with the IAR but it didn't work, neither.
So I think the compiling in IAR is my problem but the make could finish successfully. No code was changed by myself. (only the _NR_OF_VIRTUAL_REGISTERS to avoid a linker error).
I wonder if there are anyone who successfully made it work by following the instruction on the above URL.
Firmware for iBeacon: SensorTag_Beacon_Patch_1v0
CC Debugger's FW:0041
SensorTag: CC2451, 1.4.1, 1407
IAR for 8051 version 8.30.3
BLE stack: BLE_CC254x_140.zip
Working standard firmware version: 1.5 A & B
If I could get any suggestions or advises, it'd be appreciated.
Thanks and regards,
Thanks for comment, Chris.
I found a solution on TI E2E community.
IAR 8051 V8.30 has a problem since updated from V8.20. It was reported as "8051 V8.30 linker Error[e16]: Segment ISTACK is too long for segment definition" (http://supp.iar.com/Support/?Note=95811).
After modifications to .xcl linker configuration, the build ran OK without any errors.
But the firmware didn't work on SensorTag.
One of the post on TI E2E Community mentioned that changing the Number of virtual registers in the "Option" settings from 16 to 12 worked with IAR V8.30.3. Then tried that with an original .xcl file (not modified one). No error during build and worked on SensorTag too.
There are 3 packages in the SensorTag_Beacon project, that are CC2541DK-Sensor, CC2541DK-Sensor-OAD-ImgA and CC2514DK-Sensor-OAD-ImgB.
What worked are only CC2541DK-Sensor with Number of Virtual Register in Option set to 12 and without .xcl file modified.
CC2541DK-Sensor-OAD-ImgA and CC2514DK-Sensor-OAD-ImgB didn't work with any combinations of the Option setting and .xcl modifications.
Hope this helps to anyone else in the future.
Regards,

deploying a Qt application

In a nutshell, the question is: I just finished my first application using Qt Creator on a computer running under Linux Ubuntu, now how do I make this available for everyone. Now follows the more detailed version ;)
I must apologize for asking this, I am aware that this question has probably been asked many times and that there is official documentation that I can read. I am just completely new to programming and I am very confused by everything I've read so far. If you are kind enough to help, please assume I know absolutely nothing :)
Here we go: I've just finished designing my first application (a scientific program) with Qt creator on my laptop which runs under Linux Ubuntu. It works fine and I'm very proud of it ;)
Here's what my project consists of: 40 header files, 42 source files, 1 pro file, 1 qrc file, 1 html file and 7 png files. In the code, I use #include for a bunch of fairly standard Qt classes (QWidget, QTextBrowser and so forth, maybe like 40 of those).
Now I'd like to make it available to other people. For Linux and Mac users, I've figured a way to do that: I can compress the folder containing my project, tell them to install Qt on their computer, then download and extract the files on their hard disk, open a terminal in the folder and run
qmake myProject.pro
qmake
make
That seems to work fine (by the way, does it matter that this is not precisely what Qt creator does? The qmake step there is qmake-qt4 myProject.pro -r -spec linux-g++ and the make step is make -w). Now, I assume there is a solution where I don't ask them to download and install something like 200Mo of Qt material. As for Microsoft Windows users, I don't have a clue.
I would be very grateful if you could explain to me in a very concrete way what I need to do. Needless to say, I'll go for the best and easiest solution, I don't need to understand everything about deployment. Many thanks in advance!
Edit: In case that's useful : I've been using Qt Creator 2.5.0 based on Qt 4.8.1 (64 bit), I'm working on a laptop with Ubuntu 12.04 64bits
For Linux and Mac users, I would compile the software for them in 32 and 64bit formats - no-one likes compiling unknown software from source. Obviously keep the source code option for those on more unusual architectures/OSs (and provide a shell script for them that mimics the commands Qt Creator calls!). As Qt runtimes are available from package managers on just about every distro (and come pre-installed on most anyway, KDE requires them for example), by not asking them to compile from source your users will have a much smaller download (if any) and won't require them to download software from a website potentially unknown to them. Of course the best way would be to try to get your software added as a package into the major distros' repositories, but that may take some time to organise.
Compile your software for Windows users for both 32 and 64bit formats. It's generally frowned upon to ask users to download runtime libraries they potentially don't know, and put them into their system32 folder... So most applications bundle all the libraries they need with their application. Qt-based applications are no different, and so put the runtimes into the folder where the executable is. Also it is much more professional to create a proper installer, there are a few free installer applications for Windows, a web search will give you the most popular (I think I saw a thread on SO about it as well).
As you can see the platforms aren't too dissimilar, the main point I would make is: Do not force people to compile from source! The vast majority of people on Earth do not even know what compiling is, so provide for the major arrchitectures/OSs yourself.

Simulator for MHEG

Where do i get the simulator for MHEG?how to write,compile and run the MHEG application in eclipse?
There are a lot of high quality MHEG-5 commercial products and several open source ones. I'm only going to list the open source projects here.
triton is an open source WYSIWYG compiler and emulator from Ocean Blue Software
openmheg is a windows emulator that can run MHEG from a TV capture card.
mhegenc Has a compiler and decompiler that converts between text format and ASN.1 DER format ready for transmission by broadcasters that support MHEG-5
mheg+ and it's wiki. It has macro expansion and named variables that makes code far more readable, it also has an emulator that can run files from disk or play a recording from a TV capture card. Written in Java so it runs under Windows or Linux.
You can emulate MHEG from a TV capture card using red button in Linux. It also has a compiler and decompiler.
You can compile MHEG code in eclipse for any of these.

Resources