2008-05-26 05:11:32     uboot standalone program and interrupt cycle number

Document created by Aaronwu Employee on Sep 18, 2013
Version 1Show Document
  • View in full screen mode

2008-05-26 05:11:32     uboot standalone program and interrupt cycle number

murti iki (GERMANY)

Message: 56269   

 

Hello all,

 

I am wondering about the validity of a measurement that I made. For some performance comparisons I measured the number of cycles needed for the gpio interrupt to occur and the result is 1100 core cycles. Below is more info about my setup.

 

  PF15 is  set as output  and is connected to PF5 which is set to cause an interrupt on rising edge.

 

        main.c

 

        before = cycles();

 

       *pPORTFIO_SET = 0x8000;  //set pf15 to 1

 

        ....

 

        isr.c

 

       after = cycles();

     *pPORTFIO_CLEAR = PF5;       //  clear the interrupt;

     *pPORTFIO_CLEAR = PF15;    // clear the gpio output

       ssync();

       printf("time for the isr to occur is %u\n",after-before);

 

 

 

      cycles.c

 

       inline unsigned int cycles(void) {

       unsigned int ret;

 

        __asm__ __volatile__

       (

          "%0 = CYCLES;\n\t"

          : "=&d" (ret)

          :

          : "R1"

        );

 

        return ret;

       }   

 

As far as I see my code is okey but frankly 1100 cycles seems to much to me. I can't even imagine how many cycles it will take when I measure the same program with uclinux.  Most probably I am missing something critical.

 

Can you please guide me on this issue?

 

Thank you very much

 

murti

 

    

 

 

QuoteReplyEditDelete

 

 

2008-05-26 20:27:07     Re: uboot standalone program and interrupt cycle number

Robin Getz (UNITED STATES)

Message: 56280   

 

Murti:

 

I don't know if this is correct or not - but can you do the test twice in a row, and see if the numbers are different?

 

If the 2nd time is different (much shorter) - welcome to running applications in a cached environment.

 

-Robin

QuoteReplyEditDelete

 

 

2008-05-27 03:21:08     Re: uboot standalone program and interrupt cycle number

murti iki (GERMANY)

Message: 56292   

 

Hello Robin,

 

Thanks for the reply. 1100 cycles is actually the cached number. The first try usually gives something like 1300 and then the others (I use a "for" loop just as in the "making the blackfin perform" article) are 1100 cycles.

 

I would really appreciate it if anyone who has done such tests can share his/her results so that I can get rid of this " Am I missing something critical !? " mood

 

 

 

 

QuoteReplyEditDelete

 

 

2008-05-29 10:56:48     Re: uboot standalone program and interrupt cycle number

murti iki (GERMANY)

Message: 56406   

 

Okey some updates.

 

I did the same test under uclinux and the result is around 5000 core cycles which makes sense.

 

I have attached the uboot standalone program.  I would be most happy if someone can give it a try. Or just check the code (it is very short and easy to read)

 

          - just untar the contents and place it under the uboot source file folder

 

          - set the build.sh to executable and run it

 

      on the blackfin platform

 

          - boot into uboot and

 

                 tftp 0x1000 cycle_no.bin

 

                 go 0x1164

 

Also please note that programmable flags PF15 and PF5 should be connected to each other via a jumper or a cable.

 

Thanks alot for your time

 

isr_cycle.tar.gz

QuoteReplyEditDelete

 

 

2008-05-29 11:46:06     Re: uboot standalone program and interrupt cycle number

Robin Getz (UNITED STATES)

Message: 56414   

 

Mutri:

 

It is going to be next week before I have a chance to look at this (Sorry for delay, but it will get looked at).

 

-Robin

QuoteReplyEditDelete

 

 

2008-06-30 03:20:06     Re: uboot standalone program and interrupt cycle number

murti iki (GERMANY)

Message: 58063   

 

Hello Robin,

 

I was wondering if you found the time to have a look at the code. Sorry for bothering you

 

thanks

 

 

QuoteReplyEditDelete

 

 

2008-06-30 03:58:58     Re: uboot standalone program and interrupt cycle number

Yi Li (CHINA)

Message: 58065   

 

Hi,

 

I will try to run your code.

 

 

QuoteReplyEditDelete

 

 

2008-06-30 04:35:13     Re: uboot standalone program and interrupt cycle number

Yi Li (CHINA)

Message: 58102   

 

I have problem building your code:

 

1. when building standalone application, please use bfin-elf-gcc. You don't have to sepecify include path for headers in toolchain.

 

2. I modified your build script a little, but still got some problem, could you please fix it?

 

"./build.sh

+ bfin-elf-gcc -g -Os -mcpu=bf537 -ffixed-P5 -DTEXT_BASE=do-not-use-me -fno-builtin -ffreestanding -Wall -Wstrict-prototypes -c -o initialization.o initialization.c

+ bfin-elf-gcc -g -Os -mcpu=bf537 -ffixed-P5 -DTEXT_BASE=do-not-use-me -fno-builtin -ffreestanding -Wall -Wstrict-prototypes -c -o isr.o isr.c

+ bfin-elf-gcc -g -Os -mcpu=bf537 -ffixed-P5 -DTEXT_BASE=do-not-use-me -fno-builtin -ffreestanding -Wall -Wstrict-prototypes -c -o main.o standalone.c

standalone.c: In function ‘main’:

standalone.c:18: warning: implicit declaration of function ‘tstc’

standalone.c:22: error: expected expression before ‘)’ token

+ bfin-elf-gcc -g -Os -mcpu=bf537 -ffixed-P5 -DTEXT_BASE=do-not-use-me -DCONFIG_BLACKFIN -fno-builtin -ffreestanding -Wall -Wstrict-prototypes -c -o stubs.o stubs.c

"

 

As example of building standalone application, please refer to samples in toolchain svn:

 

toolchain/examples/standalone/bf537-stamp/blink/.

QuoteReplyEditDelete

 

 

2008-07-08 12:45:19     Re: uboot standalone program and interrupt cycle number

murti iki (GERMANY)

Message: 58490   

 

Hello Yi,

 

Maybe it is because the toolchain versions differ but I have no problem in building the program. My Uboot version is 1.1.6

 

and the toolchain is 2007R1.  Actually the build script is almost a one to one copy of the U-boot script that builds the example

 

u-boot standalone programs.  Can it be the case that the files were not in the uboot folder when you built them.

 

 

 

Thank you once more for your help

 

Regards

QuoteReplyEditDelete

 

 

2008-07-08 21:47:30     Re: uboot standalone program and interrupt cycle number

Yi Li (CHINA)

Message: 58494   

 

Please use 2008R1 toolchain if you can choose. And the suggested way to build standalone application is showed in "toolchain/examples/standalone/bf537-stamp/blink/".

QuoteReplyEditDelete

 

 

2008-07-09 07:49:44     Re: uboot standalone program and interrupt cycle number

murti iki (GERMANY)

Message: 58528   

 

Yi,

 

Please correct me if I am wrong but the examples you refer are baremetal standalone applications whereas my program is a U-boot standalone application. As far as I know they are not the same. I am not sure but maybe this can also be a reason that number of cycles is too much.  What do you think about this?

 

Did you also get the same error when you placed the program under the u-boot source file?

 

Thanks again

Attachments

    Outcomes