Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Profiling on baremetal embedded systems (ARM)

I am wondering how you profile software on bare metal systems (ARM Cortex a8)? Previously I was using a simulator which had built-in benchmark statistics, and now I want to compare results from real hardware (running on a BeagleBoard-Xm).

I understand that you can use gprof, however I'm kind of lost as that assumes you have to run Linux on the target system?

I build the executable file with Codesourcery's arm-none-eabi cross-compiler and the target system is running FreeRTOS.

like image 948
MrGigu Avatar asked Jan 02 '12 17:01

MrGigu


2 Answers

Closely evaluate what you mean by "profiling". You are indeed operating very close to bare metal, and it's likely that you will be required to take on some of the work performed by a tool like gprof.

Do you want to time a function call? or an ISR? How about toggling a GPIO line upon entering and exiting the code under inspection. A data logger or oscilloscope can be set to trigger on these events. (In my experience, a data logger is more convenient since mine could be configured to capture a sequence of these events - allowing me to compute average timings.)

Do you want to count the number of executions? The Cortex A8 comes equipped with a number of features (like configurable event counters) that can assist: link. Your ARM chip may be equipped with other peripherals that could be used, as well (depending on the vendor). Regardless, take a look at the above link - the new ARMs have lots of cool features that I don't get to play with as much as I would like! ;-)

like image 87
Throwback1986 Avatar answered Sep 19 '22 07:09

Throwback1986


I have managed to get profiling working for ARM Cortex M. As the GNU ARM Embedded (launchpad) tools do not come with profiling libraries included, I have added the necessary glue and profiling functionality. References: See http://mcuoneclipse.com/2015/08/23/tutorial-using-gnu-profiling-gprof-with-arm-cortex-m/

I hope this helps.

like image 22
Erich Styger Avatar answered Sep 20 '22 07:09

Erich Styger