2005-09-15 14:09:31     ADI FFT on uClinux

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

2005-09-15 14:09:31     ADI FFT on uClinux

Thomas Baumann (GERMANY)

Message: 3413    Hi there,

 

i am trying to make the ADI FFt to run on uClinux as kernel module.

But i have some problems to compile it.

I changed some parts of the source slightly to make it fit to bfin plattform, but i still get an nice warning so i am not able to launch the module.

 

bash:~/code/ADI_FFT> make clean; make

make -C /develop/uClinux-dist/linux-2.6.x M=`pwd` clean

make[1]: Entering directory `/develop/uClinux-dist/linux-2.6.x'

CLEAN /code/ADI_FFT/.tmp_versions

make[1]: Leaving directory `/develop/uClinux-dist/linux-2.6.x'

make -C /develop/uClinux-dist/linux-2.6.x M=`pwd` modules

make[1]: Entering directory `/develop/uClinux-dist/linux-2.6.x'

CC [M] /code/ADI_FFT/bfinFFT.o

CC [M] /code/ADI_FFT/Test_CFFT_Rad4_PS_NBRev.o

AS [M] /code/ADI_FFT/cycle_count.o

AS [M] /code/ADI_FFT/CFFT_Rad4_PS_NBRev.o

LD [M] /code/ADI_FFT/FFT.o

Building modules, stage 2.

MODPOST

*** Warning: ".__constant" [/home/TBau/code/ADI_FFT/FFT.ko] undefined!

*** Warning: ".__operator" [/home/TBau/code/ADI_FFT/FFT.ko] undefined!

CC /code/ADI_FFT/FFT.mod.o

LD [M] /code/ADI_FFT/FFT.ko

make[1]: Leaving directory `/develop/uClinux-dist/linux-2.6.x'

 

 

I saw that someone wrote he had successful ported the FFT to uClinux. Maybe someone could share his knowledge

 

Regards Thomas

QuoteReplyEditDelete

 

 

2005-09-15 15:37:50     RE: ADI FFT on uClinux

Ben Davis (UNITED STATES)

Message: 3416    We ported CFFT_Rad4_NS_NBRev.asm inside our processing code which is just a normal program.

 

We had to change the section names to lowercase (may not be an issue with newer gcc?), and also reset the L registers to 0 at the end of the function. I think that may have been all the changes necesary.

 

I will try to look into anything else we may have done

QuoteReplyEditDelete

 

 

2005-09-16 10:51:42     RE: ADI FFT on uClinux

Thomas Baumann (GERMANY)

Message: 3428    Ok, i´ve built the ADI FFT as an application.

A even got it built, but when i run it it exits with an SIGBUS error, immediately after the assemblercode in stage1_st is executed.

Have you experienced this error before, or did i forget any important compiling options ?

 

i just compiled with:

bfin-uclinux-gcc -elf2flt -o FFT_app FFT_app.o CFFT_Rad4_PS_NBRev.o

 

i also tried with the Wall, and align tags, but that doesn´t change anything.

QuoteReplyEditDelete

 

 

2005-09-16 16:27:25     RE: ADI FFT on uClinux

Ben Davis (UNITED STATES)

Message: 3434    I also commented out the .section L1code.

 

My make script used this succesfully.

bfin-uclinux-g++ -o _bfin-uclinux/CFFT_Rad4_NS_NBRev.o -c CFFT_Rad4_NS_NBRev.S -DOS_LINUX -DOS_UCLINUX -DOS_UCLINUXBFIN -D__ADSPBLACKFIN__ -DHAS_NAMESPACES

bfin-uclinux-gcc -o _bfin-uclinux/Test_CFFT_Rad4_NS_NBRev2.o -c Test_CFFT_Rad4_NS_NBRev2.c -DOS_LINUX -DOS_UCLINUX -DOS_UCLINUXBFIN -D__ADSPBLACKFIN__ -DHAS_NAMESPACES

 

bfin-uclinux-ar -r _bfin-uclinux/libCFFT_Rad4_NS_NBRev.a _bfin-uclinux/CFFT_Rad4_NS_NBRev.o _bfin-uclinux/Test_CFFT_Rad4_NS_NBRev2.o

bfin-uclinux-ar: creating _bfin-uclinux/libCFFT_Rad4_NS_NBRev.a

bfin-uclinux-ranlib _bfin-uclinux/libCFFT_Rad4_NS_NBRev.a

bfin-uclinux-g++ -o _bfin-uclinux/CFFT_Rad4_NS_NBRev _bfin-uclinux/CFFT_Rad4_NS_NBRev.o _bfin-uclinux/Test_CFFT_Rad4_NS_NBRev2.o -Wl,-elf2flt

 

QuoteReplyEditDelete

 

 

2005-09-19 13:20:05     RE: ADI FFT on uClinux

Thomas Baumann (GERMANY)

Message: 3463    I used your make scripting, but it leads to the same effect.

 

Compiling is not the case, but if i led the programm run, it exits everytime at the same instruction.

 

If i remive all lsetups from the assembler code, and let it run only one time over the whole procedure it works.

But if i let it go through the loops it steps out always at the same instruction:

 

Dump of assembler code for function stage1_st:

0x079d01dc <stage1_st+0>: R5=R1+|-R3,R3=R1-|+R3(ASR);

0x079d01e0 <stage1_st+4>: I0+=M3(BREV);

0x079d01e2 <stage1_st+6>: R7=[I0];

0x079d01e4 <stage1_st+8>: R7=R7>>>0x2 (V);

0x079d01e8 <stage1_st+12>: [I1++]=R6;

0x079d01ea <stage1_st+14>: R6=[I0];

0x079d01ec <stage1_st+16>: R6=R6>>>0x2 (V);

0x079d01f0 <stage1_st+20>: [I1++]=R3;

0x079d01f2 <stage1_st+22>: I0+=M3(BREV);

0x079d01f4 <stage1_st+24>: R0=R7+|+R6,R1=R7-|-R6(ASR);

0x079d01f8 <stage1_st+28>: I0+=M3(BREV);

0x079d01fa <stage1_st+30>: R7=[I0]; <-- Here it crashes

0x079d01fc <stage1_st+32>: R7=R7>>>0x2 (V);

0x079d0200 <stage1_st+36>: I0+=M3(BREV);

0x079d0202 <stage1_st+38>: R6=[I0];

0x079d0204 <stage1_st+40>: R6=R6>>>0x2 (V);

0x079d0208 <stage1_st+44>: [I1++]=R4;

0x079d020a <stage1_st+46>: R5=R7+|+R6,R3=R7-|-R6(CO,ASR);

0x079d020e <stage1_st+50>: [I1++]=R5;

 

This does not happen at the first or second attempt, but after a few loops.

 

I´ve got no sense why this happens.

QuoteReplyEditDelete

 

 

2005-09-19 15:46:55     RE: ADI FFT on uClinux

Ben Davis (UNITED STATES)

Message: 3469    In the test program they use the segment commands to reserve memory, we changed this to point to the cache.

 

#if 0

segment("mydata1") complex_fract16 in[1024];

segment("mydata2") complex_fract16 output[1024];

segment("mydata3") complex_fract16 w[1024];

#else

#define DataBankA ((void*)0xFF800000)

#define DataBankB ((void*)0xFF900000)

#define ScratchPad ((void*)0xFFB00000)

complex_fract16* in = DataBankA;

complex_fract16* output = DataBankB;

complex_fract16* w = ScratchPad;

#endif

 

 

and make sure you set the L registers to 0 at the end of CFFT_Rad4_PS_NBRev.

QuoteReplyEditDelete

 

 

2005-09-20 09:52:38     RE: ADI FFT on uClinux

Thomas Baumann (GERMANY)

Message: 3474    Thx for you help, i changed the memory segment to yout way, but when i launch the application i receive:

 

Kernel panic: Data Access CPLB Protection Voilation

 

This happens when i first attempt to read from the Address in Assembler. The Pointer is right, and the content is right. I don´t understand why i can access the memory from C, but i crashes in the assembler function.

 

The place where it crashes is:

 

00000040 <stage1_st>:

40: 21 c4 4b 87 R5=R1+|-R3,R3=R1-|+R3(ASR);

44: ec 9e I0+=M3(BREV);

46: 07 9d R7=[I0]; <----- Indirect Read Operation causes CPLB Protection Violation

48: 81 c6 f7 0f R7=R7>>>0x2 (V);

4c: 0e 9e [I1++]=R6;

4e: 06 9d R6=[I0];

50: 81 c6 f6 0d R6=R6>>>0x2 (V);

54: 0b 9e [I1++]=R3;

56: ec 9e I0+=M3(BREV);

58: 01 c4 3e 82 R0=R7+|+R6,R1=R7-|-R6(ASR);

5c: ec 9e I0+=M3(BREV);

5e: 07 9d R7=[I0];

60: 81 c6 f7 0f R7=R7>>>0x2 (V);

64: ec 9e I0+=M3(BREV);

66: 00 00 NOP;

68: 06 9d R6=[I0];

6a: 00 00 NOP;

6c: 81 c6 f6 0d R6=R6>>>0x2 (V);

70: 0c 9e [I1++]=R4;

72: 01 c4 7e 97 R5=R7+|+R6,R3=R7-|-R6(CO,ASR);

76: 0d 9e [I1++]=R5;

 

What am i doing wrong, i get it build, but it won´t run

QuoteReplyEditDelete

 

 

2005-09-20 15:39:55     RE: ADI FFT on uClinux

Ben Davis (UNITED STATES)

Message: 3481    so what function is this in? is it in __CFFT_Rad4_PS_NBRev or some other function? What version gcc and what kernal are you using.

QuoteReplyEditDelete

 

 

2005-09-21 07:12:08     RE: ADI FFT on uClinux

Thomas Baumann (GERMANY)

Message: 3494    This happens in __CFFT_Rad4_NS_NBRev.

My gcc version is 3.4.4 from the august toolchain release, and my kernel is the 2.6 RC1_Jun_2005.

QuoteReplyEditDelete

 

 

2005-09-21 08:52:42     RE: ADI FFT on uClinux

Thomas Baumann (GERMANY)

Message: 3495    OK i think i figured out what my problem is.

 

If i initialize the array variables with pointers on the L1 like 0xFF800000 it causes CPLB Protection faults.

What do i have to do, for making access possible ?

QuoteReplyEditDelete

 

 

2011-10-20 06:42:41     RE: ADI FFT on uClinux

william pagnon (AUSTRALIA)

Message: 104044   

 

Hi,

 

I'm implementing this in core b of BF561 by the way and this code is the conversion of VDSP FFT optimisation code to bare metal.

 

I don't know where this linking error come from:

 

 

 

make

bfin-elf-gcc -g -mcpu=bf561 -mmulticore -mcoreb -mlong-calls -Wall -save-temps -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/../../include -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/../../../../../linux-2.6.x/include -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/../../../../../linux-2.6.x/arch/blackfin/include -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/../../../../../linux-2.6.x/arch/blackfin/include/generated -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/../../../../../linux-2.6.x/arch/blackfin/mach-bf561/include  -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/../../../../../linux-2.6.x/drivers/staging/icc/include -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/include -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/Source/portable/ADI_VDSP/Blackfin -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/Source/include -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/BF561 -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/../../../../../linux-2.6.x/arch/blackfin/include/asm -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/CFFT_Rad4_NS_NBRev/corea  -DCONFIG_BF561 -D__KERNEL__ -O3  -c  test_ad1836_driver.c   /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/Source/portable/ADI_VDSP/Blackfin/port.c /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/Source/include/../tasks.c /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/Source/include/../queue.c /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/Source/include/../croutine.c /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/Source/include/../portable/MemMang/heap_2.c  /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/Source/include/../list.c /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/BF561/app_c.c  /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/BF561/ezkit_561.c  -x assembler-with-cpp /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/CFFT_Rad4_NS_NBRev/corea/cycle_count.asm /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/Source/portable/ADI_VDSP/Blackfin/context_sl_asm.asm /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/Source/portable/ADI_VDSP/Blackfin/bfin_isr.s /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/BF561/user_isr.asm  /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/CFFT_Rad4_NS_NBRev/corea/CFFT_Rad4_NS_NBRev.asm

In file included from test_ad1836_driver.c:14:

Initialize.c:58: warning: initialisation makes pointer from integer without a cast

test_ad1836_driver.c:33: warning: type defaults to ‘int’ in declaration of ‘sm_recv_packet’

test_ad1836_driver.c:106: warning: initialisation makes pointer from integer without a cast

test_ad1836_driver.c:109: warning: initialisation makes pointer from integer without a cast

test_ad1836_driver.c:112: warning: initialisation makes pointer from integer without a cast

test_ad1836_driver.c:115: warning: initialisation makes pointer from integer without a cast

test_ad1836_driver.c:118: warning: initialisation makes pointer from integer without a cast

test_ad1836_driver.c:121: warning: initialisation makes pointer from integer without a cast

test_ad1836_driver.c: In function ‘prvSetupTimerInterrupt’:

test_ad1836_driver.c:182: warning: assignment makes pointer from integer without a cast

test_ad1836_driver.c: In function ‘icc_task_init’:

test_ad1836_driver.c:518: warning: initialisation from incompatible pointer type

test_ad1836_driver.c:713: warning: passing argument 5 of ‘sm_recv_packet’ makes pointer from integer without a cast

test_ad1836_driver.c: In function ‘Init_Sport_Interrupts’:

Initialize.c:264: warning: ‘i’ is used uninitialized in this function

bfin-elf-ld -v  -o test_ad1836_driver -T  coreb_test_ad1836_driver.lds  --just-symbol ../../icc_core/icc queue.o ezkit_561.o  heap_2.o  port.o tasks.o test_ad1836_driver.o list.o croutine.o user_isr.o bfin_isr.o app_c.o context_sl_asm.o cycle_count.o CFFT_Rad4_NS_NBRev.o -Ttext 0x3c00000 -L /opt/uClinux/bfin-elf/bfin-elf/lib -L /opt/uClinux/bfin-elf/bfin-elf/lib -lc

argv[0]      = 'bfin-elf-ld'

bindir       = '/opt/uClinux/bfin-elf/bin/'

tooldir      = '/opt/uClinux/bfin-elf/bin/../bfin-elf/bin/'

linker       = '/opt/uClinux/bfin-elf/bin/../bfin-elf/bin/ld.real'

elf2flt      = '/opt/uClinux/bfin-elf/bin/../bfin-elf/bin/elf2flt'

nm           = '/opt/uClinux/bfin-elf/bin/../bfin-elf/bin/nm'

objdump      = '/opt/uClinux/bfin-elf/bin/bfin-elf-objdump'

objcopy      = '/opt/uClinux/bfin-elf/bin/bfin-elf-objcopy'

ldscriptpath = '/opt/uClinux/bfin-elf/bin/../bfin-elf/bin/../lib'

Invoking: '/opt/uClinux/bfin-elf/bin/../bfin-elf/bin/ld.real' '-v' '-o' 'test_ad1836_driver' '-T' 'coreb_test_ad1836_driver.lds' '--just-symbol' '../../icc_core/icc' 'queue.o' 'ezkit_561.o' 'heap_2.o' 'port.o' 'tasks.o' 'test_ad1836_driver.o' 'list.o' 'croutine.o' 'user_isr.o' 'bfin_isr.o' 'app_c.o' 'context_sl_asm.o' 'cycle_count.o' 'CFFT_Rad4_NS_NBRev.o' '-Ttext' '0x3c00000' '-L' '/opt/uClinux/bfin-elf/bfin-elf/lib' '-L' '/opt/uClinux/bfin-elf/bfin-elf/lib' '-lc'

GNU ld version 2.17

cycle_count.o: In function `Compute_Cycle_Count':

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/CFFT_Rad4_NS_NBRev/corea/cycle_count.asm:22: undefined reference to `Ret_Add'

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/CFFT_Rad4_NS_NBRev/corea/cycle_count.asm:23: undefined reference to `Ret_Add'

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/CFFT_Rad4_NS_NBRev/corea/cycle_count.asm:27: undefined reference to `Save_R7'

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/CFFT_Rad4_NS_NBRev/corea/cycle_count.asm:28: undefined reference to `Save_R7'

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/CFFT_Rad4_NS_NBRev/corea/cycle_count.asm:44: undefined reference to `Save_R7'

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/CFFT_Rad4_NS_NBRev/corea/cycle_count.asm:45: undefined reference to `Save_R7'

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/CFFT_Rad4_NS_NBRev/corea/cycle_count.asm:48: undefined reference to `Ret_Add'

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/DSP_imp/CFFT_Rad4_NS_NBRev/corea/cycle_count.asm:49: undefined reference to `Ret_Add'

make: *** [test_ad1836_driver] Error 1

 

in the code cycle_count.asm that I convert to bare metal application I've got:

 

.....

 

.section l1.data;                                                             

.align 4;                                                                     

        .var _Ret_Add ;                                                       

        .var _Save_R7 ;                                                       

 

.section l1.text;                                                             

.global _Compute_Cycle_Count;                                                 

.align 8;                                                                     

_Compute_Cycle_Count:

        P0.L = _Ret_Add;                                                      

        P0.H = _Ret_Add;                                                      

        R3 = RETS;                                                            

        [P0] = R3;                                                            

 

        P0.L = _Save_R7;                                                      

        P0.H = _Save_R7;                                                      

        [P0] = R7;                                                            

.......

 

 

 

So it seem to be define and in section l1.data which in the lds file. I attache the lds file in case there a memory problem.

 

 

 

 

 

Best Regards,

 

William

 

coreb_test_ad1836_driver.lds

QuoteReplyEditDelete

 

 

2011-10-20 07:09:06     RE: ADI FFT on uClinux

Stuart Henderson (UNITED KINGDOM)

Message: 104045   

 

Hi William,

 

Could you start a new thread for this?

 

This is a 6 year old topic and may not be at all related.

 

Thanks,

Stu

Outcomes