How to run an ARM11 PMU test on Android?

170 views
Skip to first unread message

Thanasis Petsas

unread,
Nov 27, 2011, 11:16:38 AM11/27/11
to android-ndk
Hello,

I found this simple PMU test example for ARM11 family core:

// Example PMU test program for ARM11 family core
//
// This example code is provided "as is", with out warranty
// or support entitlement. No liability is accepted.
// ------------------------------------------------------------


#include <stdio.h>
#include "v6_pmu.h"

int main(void)
{
unsigned int cycle_count, counter0;

enable_pmu(); // Enable the PMU

reset_ccnt(); // Reset the CCNT (cycle counter)
reset_pmn(); // Reset the configurable counters

pmn_config(0, 0x03); // Configure counter 0 to count event
code 0x03

//
// Start of test code
//

printf("hello world\n");

//
// End of test code
//

disable_pmu(); // Stop counters

counter0 = read_pmn(0); // Read counter 0
cycle_count = read_ccnt(); // Read CCNT

printf("Counter 0 = %d, CCNT = %d\n", counter0, cycle_count);

return 0;
}

I have a rooted HTC Hero, whose CPU belongs to ARM11 family and I want
to run this code on it. I have used many times Android NDK to cross-
compile pieces of native code. I am wandering how to do this for such
piece of code.. I only have the v6_pmu.h, but not the v6_pmu.c. Have
someone done it before? Can somebody help me on this?

Thanasis

Glenn Kasten

unread,
Nov 29, 2011, 10:23:01 AM11/29/11
to android-ndk
This question is not about Android NDK, so please use another forum;
probably a group about ARM architecture and assembly programming will
give better answers.

But I'll give a hint: the code you've posted is from the zip
attachment
of http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/17587.html
which does include the underlying routines. That code is written in
ARM RealView
assembler syntax, not the GNU assembler syntax used by NDK.

Reply all
Reply to author
Forward
0 new messages