This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Convert to TI assembler syntax

Genius 5820 points

I try (or better: fail) to convert some GCC-assembler-code from http://stackoverflow.com/questions/3247373/how-to-measure-program-execution-time-in-arm-cortex-a8-processor to TI-syntax:

asm volatile ("MCR p15, 0, %0, c9, c12, 0\t\n" :: "r"(1+2+4+16));
asm volatile ("MCR p15, 0, %0, c9, c12, 1\t\n" :: "r"(0x8000000f));  
asm volatile ("MCR p15, 0, %0, c9, c12, 3\t\n" :: "r"(0x8000000f));

How would it look like, how to hand over the values to the MCR command?

Thanks!

  • In .asm file:

         .global enable_all_counters
    enable_all_counters: .asmfunc
       MCR  p15, 0, R0, c9, c12, 0  ;Send 1st function argument to special register
       MOV  R0,#0x000F  ;Putting 0x8000000F into a register needs 
       MOVT R0,#0x8000  ; to be done in 2 instructions.
       MCR p15, 0, R0, c9, c12, 1
       MCR p15, 0, R0, c9, c12, 3
       BX LR
     .endasmfunc

    In C file:

    void enable_all_counters (unsigned int value);

       enable_all_counters(1+2+4+16);