Currently I am working on an Embedded Project. I am using IAR Embedded Workbench IDE and target platform is 8051-based microcontroller. Is it possible to use Valgrind tool to check the code I wrote?
No, and Yes*.
No: As another commenter said, Valgrind does not run on 8051 architectures, so you can't use Valgrind as you would on an x86 system.
Yes*: (the asterisk (*) is because it's a limited "yes")
But you can use Valgrind on the non-8051/IAR-specific parts of your code if you:
This way Valgrind will be able to check some of your code, which is better than nothing.
And separating the compiler/chip specific parts of your code will also make it more portable and reusable.
Oh, and this isn't directly related, but you should also consider using a static analysis program like PC-Lint: http://www.gimpel.com/html/index.htm
It checks some things that Valgrind checks, and many things that Valgrind doesn't check. Plus it will check all of your code, not just the non-8051/IAR code.
There are plenty of similar tools out there; PC-Lint is the most popular that I've seen.
You should check this page, Valgrind Supported Platforms. 8051 micro-controller instruction set is not supported by Valgrind.
Moreover, you should know Valgrind is an instruction simulator. It means you have to run Valgrind on the system, and it runs your code with OS and base layer of C or other POSIX libraries to simulate your program's memory read/write, or profiling. So 8051 is impossible to run Valgrind.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With