2011-09-23 01:20:21     problem linking with bfin-elf-ld

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

2011-09-23 01:20:21     problem linking with bfin-elf-ld

william pagnon (AUSTRALIA)

Message: 103505   

 

Hi,

 

 

 

I struggle for a while now so I'm looking for some help to resolve my problem.

 

 

 

I'm trying to compile a FreeRTOS version for bare metal. I've added the initial things to my main app file and added the lib to FreeRTOS.

 

 

 

The code build corectly with bfin-elf-gcc but give me undefine reference to functions or variables (some time extern) in the bfin-elf-ld part. All the errors of linking are from freeRTOS functions

 

 

 

I've try to add those files where the declaration is made in many ways but it still do not work. Any of you could help me thanks. I attached a version of my make file.

 

 

 

Note: The makefile do add not necessary link sometimes as I tried a lot of things desesperate.

 

 

 

when I run this make file I'got as output:

 

 

 

make

bfin-elf-gcc -g -x assembler-with-cpp -mcpu=bf561 -mmulticore -mcoreb -mlong-calls -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/../../include -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/../../../../../linux-2.6.x/include -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_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/Free_RTOS_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/Free_RTOS_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/Free_RTOS_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/Free_RTOS_imp/include -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/BF561 -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/../../../../../linux-2.6.x/arch/blackfin/include/asm  -DCONFIG_BF561 -D__KERNEL__ -c -o context_asm.o /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin/context_sl_asm.asm

bfin-elf-gcc -g  -c -o port.o /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin/port.c -mcpu=bf561 -mmulticore -mcoreb -mlong-calls -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/../../include -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/../../../../../linux-2.6.x/include -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_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/Free_RTOS_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/Free_RTOS_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/Free_RTOS_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/Free_RTOS_imp/include -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/BF561 -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/../../../../../linux-2.6.x/arch/blackfin/include/asm  -DCONFIG_BF561 -D__KERNEL__

bfin-elf-gcc -g -x assembler-with-cpp -mcpu=bf561 -mmulticore -mcoreb -mlong-calls -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/../../include -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/../../../../../linux-2.6.x/include -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_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/Free_RTOS_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/Free_RTOS_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/Free_RTOS_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/Free_RTOS_imp/include -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/BF561 -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/../../../../../linux-2.6.x/arch/blackfin/include/asm  -DCONFIG_BF561 -D__KERNEL__  -c -o bfin_isr.o /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin/bfin_isr.asm

bfin-elf-gcc -g -mcpu=bf561 -mmulticore -mcoreb -mlong-calls -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/../../include -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/../../../../../linux-2.6.x/include -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_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/Free_RTOS_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/Free_RTOS_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/Free_RTOS_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/Free_RTOS_imp/include -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/BF561 -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/../../../../../linux-2.6.x/arch/blackfin/include/asm  -DCONFIG_BF561 -D__KERNEL__   -c -o test_ad1836_driver.o test_ad1836_driver.c

In file included from test_ad1836_driver.c:9:

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

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

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

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

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

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

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

test_ad1836_driver.c: In function ‘prvSetupTimerInterrupt’:

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

test_ad1836_driver.c: In function ‘icc_task_init’:

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

test_ad1836_driver.c:212: warning: incompatible implicit declaration of built-in function ‘strcpy’

test_ad1836_driver.c:216: warning: large integer implicitly truncated to unsigned type

test_ad1836_driver.c:217: warning: large integer implicitly truncated to unsigned type

test_ad1836_driver.c:218: warning: large integer implicitly truncated to unsigned type

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

bfin-elf-ld  -L/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/../../include -L/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin -L/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source -L/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/BF561 -L/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/../../../../../linux-2.6.x/arch/blackfin/include/asm -L/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/../../../../../arch/blackfin/lib -o test_ad1836_driver -T coreb_test_ad1836_driver.lds --just-symbol ../../icc_core/icc test_ad1836_driver.o -Ttext 0x3c00000 -L /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/../../../../../linux-2.6.x/arch/blackfin/include/asm/cdef_LPBlackfin.h -L /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin/port.c -L /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/include/FreeRTOS.h -L /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/include/task.h -L /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/tasks.c -L /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/include/list.h -L bfin_isr.o

test_ad1836_driver.o: In function `prvSetupTimerInterrupt':

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/test_ad1836_driver.c:130: undefined reference to `vTickISR'

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/test_ad1836_driver.c:130: undefined reference to `vTickISR'

test_ad1836_driver.o: In function `vBootTask':

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/test_ad1836_driver.c:154: undefined reference to `app_init'

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/test_ad1836_driver.c:154: undefined reference to `app_init'

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/test_ad1836_driver.c:155: undefined reference to `app_launch_threads'

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/test_ad1836_driver.c:155: undefined reference to `app_launch_threads'

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/test_ad1836_driver.c:158: undefined reference to `vTaskDelete'

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/test_ad1836_driver.c:158: undefined reference to `vTaskDelete'

test_ad1836_driver.o: In function `icc_task_init':

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/test_ad1836_driver.c:364: undefined reference to `xTaskGenericCreate'

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/test_ad1836_driver.c:364: undefined reference to `xTaskGenericCreate'

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/test_ad1836_driver.c:365: undefined reference to `vTaskStartScheduler'

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/test_ad1836_driver.c:365: undefined reference to `vTaskStartScheduler'

make: *** [test_ad1836_driver] Error 1

 

Makefile

QuoteReplyEditDelete

 

 

2011-09-23 01:39:23     problem linking with bfin-elf-ld

Akash Agarwal (UNITED STATES)

Message: 103507    Hi William,

 

I am not very sure on this but going through make log. It seems that at

linking stage you are missing the function definations of the

following functions or symbols.

vTickISR

app_init

app_launch_threads

vTaskDelete

xTaskGenericCreate

vTaskStartScheduler

 

Just find out the function definations of these file., compile the file and

link against it.

 

I could also see that you add *.c and *.h for linking they wont be used

anyways while linking. linker only links object files.

 

I could not see this problem related to tool chain, it is more of a common

linking problem. correct me if i am wrong.

 

Thanks

Akash

 

(enter your response here)

QuoteReplyEditDelete

 

 

2011-09-23 02:43:31     Re: problem linking with bfin-elf-ld

william pagnon (AUSTRALIA)

Message: 103508   

 

Hi Akash,

 

Thanks for you repply.

 

you are right it is a common linking problem but I'm not sure how to solve it so I ask here as some difference may exist for the bfin-elf-ld compare to the classic gcc ld.

 

 

 

Sorry for those linking .c and .h files it was desesperate move as I didn't know what else to do.  But of course, this doesn't resolve the problem.

 

 

 

I know where the function are declare and they are in a assamply file, which is why I tried to build other .o files with the assembly option -x assembler-with-cpp to take in consideration the .asm files

 

are declare in the file task.h:

 

vTaskDelete

 

xTaskGenericCreate

 

vTaskStartScheduler

 

are declare in the file bfin_isr.asm (assembler file, i tried previously to rename it .s but same thing)

 

vTickISR

 

are declare in the file ezkit_561.h

 

app_init

app_launch_threads

 

What I really don't understand is that I have include most of those file (excepted for the assambler file I find a bit more tricky to include and try to go around it but no much chance). Why if they are included, the linker do not see them although the compiler does

 

It must be silly but I have turn around for days now and cannot find a solution.

 

Thanks

 

 

 

WIlliam

QuoteReplyEditDelete

 

 

2011-09-23 03:13:31     Re: problem linking with bfin-elf-ld

Akash Agarwal (UNITED STATES)

Message: 103509    The linker complains about the symbols so it is not able to find the

definations of the symbols. You seriously need to look into the source code

and

find out the definations compile and link against it. may be a more

structured makefile will help you better.

You can look at ld manual pages they will give u a better idea on and what

to do .

 

I dont think there is anything specific regarding bfin here.

 

> (enter your response here)

QuoteReplyEditDelete

 

 

2011-09-23 03:43:05     Re: problem linking with bfin-elf-ld

william pagnon (AUSTRALIA)

Message: 103511   

 

Hi Akash,

 

 

 

Well I did, it is why I end up asking it on the forom as I don't understand why it doesn't find it.

 

 

 

here are the declaration of each function if that help you to help me:

 

 

 

are declare in the file task.h:

 

vTaskDelete:

 

 

 

void vTaskDelete( xTaskHandle pxTaskToDelete ) PRIVILEGED_FUNCTION;

 

 

 

 

xTaskGenericCreate:

 

 

 

signed portBASE_TYPE xTaskGenericCreate( pdTASK_CODE pxTaskCode, const signed c\

har * const pcName, unsigned short usStackDepth, void *pvParameters, unsigned p\

ortBASE_TYPE uxPriority, xTaskHandle *pxCreatedTask, portSTACK_TYPE *puxStackBu\

ffer, const xMemoryRegion * const xRegions ) PRIVILEGED_FUNCTION;

 

vTaskStartScheduler:

 

signed portBASE_TYPE xTaskGenericCreate( pdTASK_CODE pxTaskCode, const signed c\

har * const pcName, unsigned short usStackDepth, void *pvParameters, unsigned p\

ortBASE_TYPE uxPriority, xTaskHandle *pxCreatedTask, portSTACK_TYPE *puxStackBu\

ffer, const xMemoryRegion * const xRegions ) PRIVILEGED_FUNCTION;

 

 

 

void vTaskStartScheduler( void ) PRIVILEGED_FUNCTION;

 

 

 

are declare in the file bfin_isr.asm (assembler file, i tried previously to rename it .s but same thing)

 

vTickISR:

 

/* This is the ISR for core timer interrupt (default level 6)*/

.global _vTickISR;                                                            

_vTickISR:

 

#if (configUSE_PREEMPTION == 0)

 

                LINK 0x0;                                                     

                SP += 12;                                                     

                call.X _vTaskIncrementTick;                                   

                UNLINK;                                                       

 

#else                /* Save the context of the interrupted task. */

        _portSAVE_CONTEXT;                                            

 

        /* Increment the RTOS tick count, then look for the highest pri\

ority                                                                         

                task that is ready to run. */

                LINK 0x0;                                                     

                SP += 12;                                                     

                call.X _vTaskIncrementTick;                                   

                UNLINK;

 

                /* Restore the context of the new task. */

                _portRESTORE_CONTEXT;                                         

 

#endif

_vTickISR.end:

 

 

are declare in the file ezkit_561.h

 

app_init:

 

extern void app_init(void);

 

app_launch_threads

 

extern void app_launch_threads(void);

 

 

 

I did look as well at the ld manual page and could find an answere to my problem.

 

 

 

Maybe it is not specific to black fin but it is still using FreeRTOS for blackfin.

 

 

 

Note that I compiled other bare metal project before for blackfin and didn't go into those linker problem. At first I though it was cause of the mix of assembler and c file , but I'm not sure anymore especially because function declare in c file are not reconised any more.

 

 

 

Please give me an example of how it should be properly linked

 

 

 

Thanks

QuoteReplyEditDelete

 

 

2011-09-23 10:44:12     Re: problem linking with bfin-elf-ld

Stuart Henderson (UNITED KINGDOM)

Message: 103516   

 

Hi William,

 

I think you're getting "definition" and "declaration" mixed up here.  I suggest a quick read of this:

http://ee.hawaii.edu/~tep/EE160/Book/chap14/subsection2.1.1.4.html

 

after reading that, are you sure you have definitions of all those symbols in objects or libraries on your link line?

 

 

 

I also think you're getting confused over the meaning of the "-L" linker switch.  I suggest you read the appropriate section here:

http://sourceware.org/binutils/docs/ld/Options.html

 

 

 

As you can see, and as Akash says, the -Ls followed by .c, .h and .o files on your link line don't make much sense.  I suggest you strip all the .c and .h files and remove the -Ls from before any .o files.

 

 

 

Finally, I'm afraid i don't know much about FreeRTOS, however judging by the paths (../ADI_VDSP/..) and file names (the GNU toolchain doesn't consider *.asm as a valid assembly source file extension, as you have discovered) it was designed to be compiled by Analog Devices VisualDSP++, not the GNU toolchain.  As such, you may find that it is considerable effort to get FreeRTOS working with this toolchain.

 

Stu

QuoteReplyEditDelete

 

 

2011-09-27 00:14:14     Re: problem linking with bfin-elf-ld

william pagnon (AUSTRALIA)

Message: 103551   

 

Hi Suart,

 

Thanks for your help, it is greatly apreciated. You are right, I'm porting blackfin 561 FreeRTOS program from VDSP to bare metal,

 

 

 

The main problem I can see is that I have a different memory map using my coreb and thus it seem that I need to link separatly from the compilation.

 

 

 

Anyway, I went further and got ride off the undefined errors except one which is in libc. It seam that blackfin may have a different libc that usual which is normal but when I use the option -lc in the ld linker or provide the path to the general libraries of blackfin I have the following error:

 

 

 

make

bfin-elf-gcc -g -mcpu=bf561 -mmulticore -mcoreb -mlong-calls -Wall -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/../../include -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/../../../../../linux-2.6.x/include -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_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/Free_RTOS_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/Free_RTOS_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/Free_RTOS_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/Free_RTOS_imp/include -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/include -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/BF561 -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/../../../../../linux-2.6.x/arch/blackfin/include/asm  -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/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin/port.c /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/include/../tasks.c /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/include/../queue.c /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/include/../croutine.c /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/include/../portable/MemMang/heap_3.c  /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/include/../list.c /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/BF561/app_c.c /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_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/Free_RTOS_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/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin/bfin_isr.asm /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/BF561/user_isr.asm

In file included from BF561/ezkit_561.h:4,

                 from test_ad1836_driver.c:5:

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/include/sys/exception.h:3: warning: ignoring #pragma system_header

In file included from test_ad1836_driver.c:13:

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

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

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

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

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

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

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

test_ad1836_driver.c: In function ‘prvSetupTimerInterrupt’:

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

test_ad1836_driver.c: In function ‘vBootTask’:

test_ad1836_driver.c:154: warning: unused variable ‘i’

test_ad1836_driver.c: In function ‘icc_task_init’:

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

test_ad1836_driver.c:201: warning: implicit declaration of function ‘coreb_msg’

test_ad1836_driver.c:215: warning: implicit declaration of function ‘strcpy’

test_ad1836_driver.c:215: warning: incompatible implicit declaration of built-in function ‘strcpy’

test_ad1836_driver.c:215: warning: pointer targets in passing argument 1 of ‘strcpy’ differ in signedness

test_ad1836_driver.c:219: warning: large integer implicitly truncated to unsigned type

test_ad1836_driver.c:220: warning: large integer implicitly truncated to unsigned type

test_ad1836_driver.c:221: warning: large integer implicitly truncated to unsigned type

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

test_ad1836_driver.c:236: warning: implicit declaration of function ‘sm_create_session’

test_ad1836_driver.c:249:13: warning: multi-line comment

test_ad1836_driver.c:367: warning: pointer targets in passing argument 2 of ‘xTaskGenericCreate’ differ in signedness

test_ad1836_driver.c:489:17: warning: multi-line comment

test_ad1836_driver.c:184: warning: unused variable ‘src_cpu’

test_ad1836_driver.c:184: warning: unused variable ‘src_ep’

test_ad1836_driver.c:183: warning: unused variable ‘ret’

test_ad1836_driver.c:182: warning: unused variable ‘len’

test_ad1836_driver.c:181: warning: unused variable ‘buf’

test_ad1836_driver.c:180: warning: unused variable ‘session’

test_ad1836_driver.c: In function ‘icc_task_exit’:

test_ad1836_driver.c:531: warning: implicit declaration of function ‘sm_destroy_session’

test_ad1836_driver.c: In function ‘Init_Sport_Interrupts’:

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

In file included from /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin/port.c:48:

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/include/sys/exception.h:3: warning: ignoring #pragma system_header

In file included from /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/BF561/app_c.c:3:

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/include/sys/exception.h:3: warning: ignoring #pragma system_header

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/BF561/app_c.c: In function ‘app_launch_threads’:

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/BF561/app_c.c:131: warning: pointer targets in passing argument 2 of ‘xTaskGenericCreate’ differ in signedness

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/BF561/app_c.c:115: warning: unused variable ‘OS_result’

In file included from /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/BF561/ezkit_561.h:4,

                 from /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/BF561/ezkit_561.c:1:

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/include/sys/exception.h:3: warning: ignoring #pragma system_header

bfin-elf-ld -v              -L/opt/uClinux/bfin-elf/bfin-elf/lib/ -o test_ad1836_driver -T  coreb_test_ad1836_driver.lds  --just-symbol ../../icc_core/icc queue.o ezkit_561.o app_c.o heap_3.o  port.o tasks.o test_ad1836_driver.o list.o croutine.o user_isr.o bfin_isr.o context_sl_asm.o -Ttext 0x3c00000 -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' '-L/opt/uClinux/bfin-elf/bfin-elf/lib/' '-o' 'test_ad1836_driver' '-T' 'coreb_test_ad1836_driver.lds' '--just-symbol' '../../icc_core/icc' 'queue.o' 'ezkit_561.o' 'app_c.o' 'heap_3.o' 'port.o' 'tasks.o' 'test_ad1836_driver.o' 'list.o' 'croutine.o' 'user_isr.o' 'bfin_isr.o' 'context_sl_asm.o' '-Ttext' '0x3c00000' '-lc'

GNU ld version 2.17

user_isr.o: In function `IVG11_ISR':

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/BF561/user_isr.asm:31: relocation truncated to fit: R_BFIN_PCREL24 against symbol `IVG11_ISR_Hook' defined in .text section in app_c.o

bfin_isr.o: In function `vContextSwitch':

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin/bfin_isr.asm:29: relocation truncated to fit: R_BFIN_PCREL24 against symbol `vTaskSwitchContext' defined in .text section in tasks.o

bfin_isr.o: In function `vTickISR':

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin/bfin_isr.asm:63: relocation truncated to fit: R_BFIN_PCREL24 against symbol `vTaskIncrementTick' defined in .text section in tasks.o

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin/bfin_isr.asm:67: relocation truncated to fit: R_BFIN_PCREL24 against symbol `vTaskSwitchContext' defined in .text section in tasks.o

/opt/uClinux/bfin-elf/bfin-elf/lib//libc.a(sbrkr.o): In function `sbrk_r':

/usr/src/packages/BUILD/blackfin-toolchain-2010R1/gcc-4.3/newlib/libc/reent/sbrkr.c:60: undefined reference to `_sbrk'

/usr/src/packages/BUILD/blackfin-toolchain-2010R1/gcc-4.3/newlib/libc/reent/sbrkr.c:60: relocation truncated to fit: R_BFIN_PCREL24 against undefined symbol `_sbrk'

make: *** [test_ad1836_driver] Error 1

 

 

The compilation  seams ok (although I would have to convert some code as mention by the warnings like pragma etc ...)

 

When the linker run, I did modify code and compile enought object file to link in ld to get read of most of the undefined functions.

 

Now it as me about undefined reference to `_sbrk' which is in libc but it seem it refer to the normal gcc library (/usr/src/packages/BUILD/blackfin-toolchain-2010R1/gcc-4.3/newlib/libc/reent/sbrkr) not the blackfin cross platform librarie that is in . /opt/uClinux/bfin-elf/bfin-elf/lib/libc.a

 

 

 

How can I resolve this error?

 

 

 

I followed the advice of Akash as well and redo my make file (not finish though as still experimenting). I attache it to show you my new configuration

 

Thanks again to both of you to help me through

 

Makefile

QuoteReplyEditDelete

 

 

2011-09-27 00:33:36     Re: problem linking with bfin-elf-ld

Akash Agarwal (UNITED STATES)

Message: 103552    Hi William,

 

You are welcome.

I am not sure whether we should specify the -lc option but if you want the

linker to use the bfin libratry instead of the standard libc library

you can give the path of it using the "-L path" option .

 

If you are porting examples from VDSP to bare metal, i would like you to

point few stuffs in the docs if you not have not seem them before.

1)

http://docs.blackfin.uclinux.org/doku.php?id=visualdsp:port_c_code&s[]=pragma

 

The other thing which the document not mention is about defining a ISR in

bare metal is different from VDSP.

you will have to use the attribute interrupt handler.

Example :

//EX_INTERRUPT_HANDLER(ISR) -- VDSP

void ISR()__attribute__((interrupt_handler)); -- bare metal

 

 

(enter your response here)

QuoteReplyEditDelete

 

 

2011-09-27 02:39:21     Re: problem linking with bfin-elf-ld

william pagnon (AUSTRALIA)

Message: 103557   

 

Thanks Akash,

 

 

 

if I do not use lc or lg, I've got error to define function free() and malloc():

 

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

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' '-L/opt/uClinux/bfin-uclinux/bfin-uclinux/lib' '-o' 'test_ad1836_driver' '-T' 'coreb_test_ad1836_driver.lds' '--just-symbol' '../../icc_core/icc' 'queue.o' 'ezkit_561.o' 'app_c.o' 'heap_3.o' 'port.o' 'tasks.o' 'test_ad1836_driver.o' 'list.o' 'croutine.o' 'user_isr.o' 'bfin_isr.o' 'context_sl_asm.o' '-Ttext' '0x3c00000'

GNU ld version 2.17

heap_3.o: In function `vPortFree':

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/include/../portable/MemMang/heap_3.c:111: undefined reference to `free'

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/include/../portable/MemMang/heap_3.c:111: undefined reference to `free'

heap_3.o: In function `pvPortMalloc':

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/include/../portable/MemMang/heap_3.c:87: undefined reference to `malloc'

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/include/../portable/MemMang/heap_3.c:87: undefined reference to `malloc'

tasks.o: In function `prvInitialiseTCBVariables':

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/include/../tasks.c:2011: undefined reference to `strncpy'

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/include/../tasks.c:2011: undefined reference to `strncpy'

user_isr.o: In function `IVG11_ISR':

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/BF561/user_isr.asm:31: relocation truncated to fit: R_BFIN_PCREL24 against symbol `IVG11_ISR_Hook' defined in .text section in app_c.o

bfin_isr.o: In function `vContextSwitch':

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin/bfin_isr.asm:29: relocation truncated to fit: R_BFIN_PCREL24 against symbol `vTaskSwitchContext' defined in .text section in tasks.o

bfin_isr.o: In function `vTickISR':

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin/bfin_isr.asm:63: relocation truncated to fit: R_BFIN_PCREL24 against symbol `vTaskIncrementTick' defined in .text section in tasks.o

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin/bfin_isr.asm:67: relocation truncated to fit: R_BFIN_PCREL24 against symbol `vTaskSwitchContext' defined in .text section in tasks.o

make: *** [test_ad1836_driver] Error 1

 

 

if I add --library=/opt/uClinux/bfin-elf/bfin-elf/lib/libc.a

 

$(LD) -v  $(LDFLAGS)  --library=/opt/uClinux/bfin-elf/bfin-elf/lib/libc.a -o test_ad1836_driver -T  coreb_test_ad1836_driver.lds  --just-symbol  $(ICC_CORE) queue.o ezkit_561.o app_c.o heap_3.o  port.o tasks.o test_ad1836_driver.o list.o croutine.o user_isr.o bfin_isr.o context_sl_asm.o -Ttext $(TASK_LOAD_BASE)

 

 

It cannot find the library:

 

bfin-elf-ld -v  -L/opt/uClinux/bfin-uclinux/bfin-uclinux/lib  --library=/opt/uClinux/bfin-elf/bfin-elf/lib/libc.a -o test_ad1836_driver -T  coreb_test_ad1836_driver.lds  --just-symbol ../../icc_core/icc queue.o ezkit_561.o app_c.o heap_3.o  port.o tasks.o test_ad1836_driver.o list.o croutine.o user_isr.o bfin_isr.o context_sl_asm.o -Ttext 0x3c00000

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' '-L/opt/uClinux/bfin-uclinux/bfin-uclinux/lib' '--library=/opt/uClinux/bfin-elf/bfin-elf/lib/libc.a' '-o' 'test_ad1836_driver' '-T' 'coreb_test_ad1836_driver.lds' '--just-symbol' '../../icc_core/icc' 'queue.o' 'ezkit_561.o' 'app_c.o' 'heap_3.o' 'port.o' 'tasks.o' 'test_ad1836_driver.o' 'list.o' 'croutine.o' 'user_isr.o' 'bfin_isr.o' 'context_sl_asm.o' '-Ttext' '0x3c00000'

GNU ld version 2.17

/opt/uClinux/bfin-elf/bin/../bfin-elf/bin/ld.real: cannot find -l/opt/uClinux/bfin-elf/bfin-elf/lib/libc.a

 

 

and I'm sure it is there:

 

ls /opt/uClinux/bfin-elf/bfin-elf/lib/

basiccrt561b.o  bf522.ld    bf536.ld   bf561.ld           libg.a

basiccrt561.o   bf523.ld    bf537.ld   bf561m.ld          libiberty.a

basiccrt561s.o  bf524.ld    bf538.ld   bf592.ld           libm.a

basiccrt.o      bf525.ld    bf539.ld   bfin-common-mc.ld  libnosys.a

basiccrts.o     bf526.ld    bf542.ld   bfin-common-sc.ld  libsim.a

bf504.ld        bf527.ld    bf544.ld   crt0.o             mfdpic

bf506.ld        bf531.ld    bf547.ld   elf2flt.ld         mid-shared-library

bf512.ld        bf532.ld    bf548.ld   ldscripts          msep-data

bf514.ld        bf532-none  bf549.ld   libbfdsp.a

bf516.ld        bf533.ld    bf561a.ld  libbffastfp.a

bf518.ld        bf534.ld    bf561b.ld  libc.a

 

 

 

So I don't really understand that....

 

 

Using the -L path option instead -l do target the directory is accepted by ld but I suspect it is just because it is a directory and may not found any lib in there.

 

Thanks for the link, I do actually have use this for the start and had to figure out by myself previously:

 

//EX_INTERRUPT_HANDLER(ISR) -- VDSP

void ISR()__attribute__((interrupt_handler)); -- bare metal

 

 

 

I did most of the code changes for the conveersion although I'm waiting to have at least a fully linked and compiled version to get read of the other warnings.

 

 

 

could help me further to resolve this link problem.

 

 

 

THank

 

 

 

William

QuoteReplyEditDelete

 

 

2011-09-27 07:07:15     Re: problem linking with bfin-elf-ld

Stuart Henderson (UNITED KINGDOM)

Message: 103580   

 

You seem to be compiling/linking a bare-metal project (bfin-elf), but then pointing the linker at the FLAT lib dir (bfin-uclinux):

 

"-L/opt/uClinux/bfin-uclinux/bfin-uclinux/lib"

 

Stu

QuoteReplyEditDelete

 

 

2011-09-27 19:17:29     Re: problem linking with bfin-elf-ld

william pagnon (AUSTRALIA)

Message: 103586   

 

Hi Stu,

 

 

 

oups, sorry, I've change that, but it still cannot read my libraries that I put it with folder path (-L it process the linking instruction but do not seem take in consideration the lib in this folder) or the -l option where it tels me that the lib doesn't exist

 

 

 

Will

QuoteReplyEditDelete

 

 

2011-09-27 19:36:51     Re: problem linking with bfin-elf-ld

william pagnon (AUSTRALIA)

Message: 103587   

 

Hi,

 

Tried to change permission in case this was the problem  with chmod 777 and chown, still the same problem.

 

/opt/uClinux/bfin-elf/bin/../bfin-elf/bin/ld.real: cannot find -l/opt/uClinux/bfin-elf/bfin-elf/lib/libc.a

 

I tried to do a local copy of the library in my project folder and still the same : cannot find the library

 

 

 

I tried with --library=/opt/uClinux/bfin-elf/bfin-elf/lib/libc.a

 

 

but still cannot find the library

 

 

 

any idea?

QuoteReplyEditDelete

 

 

2011-09-28 08:16:50     Re: problem linking with bfin-elf-ld

Akash Agarwal (UNITED STATES)

Message: 103598    > it should be

 

-L /opt/uClinux/bfin-elf/bfin-elf/lib -lc or

Here you telll the linker to search for libc.a library in the path

/opt/uClinux/bfin-elf/bfin-elf/lib

 

 

> /opt/uClinux/bfin-elf/bfin-elf/lib/libc.a

 

Here you directly link against the library ..

 

You may want to read some resource on linking static libraries

QuoteReplyEditDelete

 

 

2011-09-28 20:19:34     Re: problem linking with bfin-elf-ld

william pagnon (AUSTRALIA)

Message: 103601   

 

Hi Akash,

 

 

 

I don't realy understand your comment. In the ld doc it says:

 

-larchive

--library=archive

    Add archive file archive to the list of files to link. This option may be used any number of times. ld will search its path-list for occurrences of "lib archive .a" for every archive specified.

 

So I don't see why I cannot do -l/opt/uClinux/bfin-elf/bfin-elf/lib as explained in my previous post.

 

so why do I get /opt/uClinux/bfin-elf/bin/../bfin-elf/bin/ld.real: cannot find -l/opt/uClinux/bfin-elf/bfin-elf/lib/libc.a

 

 

 

for the -L option, the doc say:

 

-Lsearchdir

--library-path=searchdir

    Add path searchdir to the list of paths that ld will search for archive libraries and ld control scripts. You may use this option any number of times. The directories are searched in the order in which they are specified on the command line. Directories specified on the command line are searched before the default directories. All -L options apply to all -l options, regardless of the order in which the options appear.

 

So their is nothing wrong about doing -L/opt/uClinux/bfin-elf/bfin-elf/lib

 

 

 

nevertheless those libraries are never take in consideration

 

 

 

Why?

 

In Addition, why should I use -lc as it seem to link me to the wrong libc.a library and I then get an undefined error that has nothing to do with my code (at least I think):

 

/opt/uClinux/bfin-elf/bfin-elf/lib/libc.a(sbrkr.o): In function `sbrk_r':

/usr/src/packages/BUILD/blackfin-toolchain-2010R1/gcc-4.3/newlib/libc/reent/sbrkr.c:60: undefined reference to `_sbrk'

/usr/src/packages/BUILD/blackfin-toolchain-2010R1/gcc-4.3/newlib/libc/reent/sbrkr.c:60: relocation truncated to fit: R_BFIN_PCREL24 against undefined symbol `_sbrk'

 

Anybody can tell me clearly how to resolve this problem?

QuoteReplyEditDelete

 

 

2011-09-29 06:42:50     Re: problem linking with bfin-elf-ld

Stuart Henderson (UNITED KINGDOM)

Message: 103622   

 

note the documentation says:

 

"-larchive

...

ld will search its path-list for occurrences of "lib archive .a" for every archive specified."

 

so "-l/opt/uClinux/bfin-elf/bfin-elf/lib/libc.a" doesn't make sense.

 

you want to tell the compiler driver where the libraries are with -L:

 

-L/opt/path/to/libs

 

and then tell it which library you want to use with -l in the form specified by the help above:

 

-lc

 

none of this is necessary, however, as gcc automatically links in libc regardless.  try compiling an example with "-v" and take a look at the link line to see what libraries are automatically being linked and what paths are being searched.

 

 

 

the other error you are seeing may be due to excessivly large distances between code in memory.  you should compile using "-mlong-calls" for modules which result in this error.  More info on this switch can be found here:

 

http://gcc.gnu.org/onlinedocs/gcc/Blackfin-Options.html#Blackfin-Options

 

Stu

QuoteReplyEditDelete

 

 

2011-09-29 07:45:38     Re: problem linking with bfin-elf-ld

william pagnon (AUSTRALIA)

Message: 103623   

 

Hi Stu,

 

 

 

as posted before, I use already -v in the linker option and try the way you and Akash suggest to add the libraries but no improvement.

 

 

 

the output is:

 

 

 

bfin-elf-ld -v  -o test_ad1836_driver -T  coreb_test_ad1836_driver.lds  --just-symbol ../../icc_core/icc queue.o ezkit_561.o app_c.o heap_3.o  port.o tasks.o test_ad1836_driver.o list.o croutine.o user_isr.o bfin_isr.o context_sl_asm.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' 'app_c.o' 'heap_3.o' 'port.o' 'tasks.o' 'test_ad1836_driver.o' 'list.o' 'croutine.o' 'user_isr.o' 'bfin_isr.o' 'context_sl_asm.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

user_isr.o: In function `IVG11_ISR':

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/BF561/user_isr.asm:31: relocation truncated to fit: R_BFIN_PCREL24 against symbol `IVG11_ISR_Hook' defined in .text section in app_c.o

bfin_isr.o: In function `vContextSwitch':

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin/bfin_isr.asm:29: relocation truncated to fit: R_BFIN_PCREL24 against symbol `vTaskSwitchContext' defined in .text section in tasks.o

bfin_isr.o: In function `vTickISR':

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin/bfin_isr.asm:63: relocation truncated to fit: R_BFIN_PCREL24 against symbol `vTaskIncrementTick' defined in .text section in tasks.o

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin/bfin_isr.asm:67: relocation truncated to fit: R_BFIN_PCREL24 against symbol `vTaskSwitchContext' defined in .text section in tasks.o

/opt/uClinux/bfin-elf/bfin-elf/lib/libc.a(sbrkr.o): In function `sbrk_r':

/usr/src/packages/BUILD/blackfin-toolchain-2010R1/gcc-4.3/newlib/libc/reent/sbrkr.c:60: undefined reference to `_sbrk'

/usr/src/packages/BUILD/blackfin-toolchain-2010R1/gcc-4.3/newlib/libc/reent/sbrkr.c:60: relocation truncated to fit: R_BFIN_PCREL24 against undefined symbol `_sbrk'

make: *** [test_ad1836_driver] Error 1

 

 

I already use -mlong-calls in gcc compiler option, if you look at my makefile:

 

 

 

CFLAGS  := -mcpu=bf561 -mmulticore -mcoreb -mlong-calls -Wall -I$(PWD) -I$(ICC_\

INCLUDE) -I$(KERNELDIR)/include -I$(KERNELDIR)/arch/blackfin/include -I$(KERNEL\

DIR)/arch/blackfin/include/generated -I$(KERNELDIR)/arch/blackfin/mach-bf561/in\

clude  -I$(KERNELDIR)/drivers/staging/icc/include -I$(DRIVERS_INCLUDE) -I$(FREE\

RTOSPORTABLE_INCLUDE) -I$(FREERTOS_INCLUDE) -I$(FREERTOS_BF561_INCLUDE) -I$(BFC\

OMMON_INCLUDE)  -DCONFIG_BF561 -D__KERNEL__

 

 

 

 

$(CC) $(CFLAGS) -O3  -c  test_ad1836_driver.c  $(FREERTOSPORTABLE_INCLU\

DE)/port.c $(FREERTOS_INCLUDE)/../tasks.c $(FREERTOS_INCLUDE)/../queue.c $(FREE\

RTOS_INCLUDE)/../croutine.c $(FREERTOS_INCLUDE)/../portable/MemMang/heap_3.c  $\

(FREERTOS_INCLUDE)/../list.c $(FREERTOS_BF561_INCLUDE)/app_c.c $(FREERTOS_BF561\

_INCLUDE)/ezkit_561.c   $(ASMFLAGS) $(FREERTOSPORTABLE_INCLUDE)/context_sl_asm.\

asm $(FREERTOSPORTABLE_INCLUDE)/bfin_isr.asm $(FREERTOS_BF561_INCLUDE)/user_isr\

.asm

 

 

 

 

Maybe the error is caused from the first one:

 

user_isr.o: In function `IVG11_ISR':

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/BF561/user_isr.asm:31: relocation truncated to fit: R_BFIN_PCREL24 against symbol `IVG11_ISR_Hook' defined in .text section in app_c.o

 

 

Is that can cause the further error:

 

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin/bfin_isr.asm:67: relocation truncated to fit: R_BFIN_PCREL24 against symbol `vTaskSwitchContext' defined in .text section in tasks.o

/opt/uClinux/bfin-elf/bfin-elf/lib/libc.a(sbrkr.o): In function `sbrk_r':

/usr/src/packages/BUILD/blackfin-toolchain-2010R1/gcc-4.3/newlib/libc/reent/sbrkr.c:60: undefined reference to `_sbrk'

/usr/src/packages/BUILD/blackfin-toolchain-2010R1/gcc-4.3/newlib/libc/reent/sbrkr.c:60: relocation truncated to fit: R_BFIN_PCREL24 against undefined symbol `_sbrk'

make: *** [test_ad1836_driver] Error 1

 

 

?

 

 

 

Thanks

 

 

Will

QuoteReplyEditDelete

 

 

2011-09-29 11:12:11     Re: problem linking with bfin-elf-ld

Stuart Henderson (UNITED KINGDOM)

Message: 103625   

 

yes, since long-calls is a compiler switch, it doesn't affect assembly files.  you will need to hand edit these to use indirect jumps.

 

e.g.

-jump.l _func;

+P2.H = _func;

+P2.L = _func;

+jump (P2);

 

Stu

QuoteReplyEditDelete

 

 

2011-09-30 09:00:36     Re: problem linking with bfin-elf-ld

william pagnon (AUSTRALIA)

Message: 103659   

 

Hi Stu,

 

 

 

Thanks for the repply. I've the problem due to extern declared function in assembler and defined in C file.  thus:

 

bfin_isr.o: In function `vContextSwitch':

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin/bfin_isr.asm:29: relocation truncated to fit: R_BFIN_PCREL24 against symbol `vTaskSwitchContext' defined in .text section in tasks.o

 

 

 

 

complain about:

 

#define _portEXIT_SWITCHING_ISR                         \

                .extern _vTaskSwitchContext;            \                     

                call.X _vTaskSwitchContext;                     \             

                _portRESTORE_CONTEXT

 

 

 

in particular call.X _vTaskSwitchContext;

 

I tried to use your code to replace call.X jump in my code but without success. It give me similar error about the JUMP function too.

 

 

 

Is this can be a problem with the lds file? How do I operate and link pproperly a jump from an assembly code to a function defined in c using extern to link them ?

QuoteReplyEditDelete

 

 

2011-10-04 05:46:59     Re: problem linking with bfin-elf-ld

Stuart Henderson (UNITED KINGDOM)

Message: 103706   

 

Can you show me the change you made to the macro to make it work and also the error message you now get?

 

you can find some info on calling c/c++ functions from assembly here:

 

https://docs.blackfin.uclinux.org/doku.php?id=toolchain:application_binary_interface#calling_c_c_functions_from_assembly_programs

 

Stu

QuoteReplyEditDelete

 

 

2011-10-06 22:10:59     Re: problem linking with bfin-elf-ld

william pagnon (AUSTRALIA)

Message: 103732   

 

Hi Stu,

 

 

 

For the previous error,

 

I removed the standard libraries an replaced them with icc.h and protocole.h from the icc lib:

 

 

 

#include <icc.h>

#include <protocol.h>

//#include <stdlib.h>                                                         

//#include <stdio.h>                                                          

//#include <sys/exception.h>                                                  

//#include <signal.h>                                                         

#include "../Source/include/FreeRTOS.h"

#include "task.h"

#include "semphr.h"

#include <mach/cdefBF561.h>

#include <mach/defBF561.h>

 

/******** Processor specific ********/

//#include <cdefBF561.h>                                                      

#include "ezkit_561.h"

 

 

 

 

this did fix the undefined reference to `_sbrk' not exactly sure why but it doesn't enoy me anymore with malloc and free declaration.

 

 

 

For the curent error I had already ready the link you send me but there is not proper example for

Calling C/C++ Functions From Assembly Programs

 

THere is just a small section describing vagly what to o but it is mot suffitient to be understandable. Could you give me an example of how to do an external call from assembler code to C defined function based on the provious code of my last message?

 

this is the error I have at the moment for the linker. I'm posting all of it in case the compilation part gives you an hint. but it is all about one error for external function call from assembler code to C dcode.

 

 

 

make

bfin-elf-gcc -g -mcpu=bf561 -mmulticore -mcoreb -mlong-calls -Wall -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/../../include -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/../../../../../linux-2.6.x/include -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_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/Free_RTOS_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/Free_RTOS_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/Free_RTOS_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/Free_RTOS_imp/include -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/include -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/BF561 -I/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/../../../../../linux-2.6.x/arch/blackfin/include/asm  -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/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin/port.c /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/include/../tasks.c /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/include/../queue.c /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/include/../croutine.c /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/include/../portable/MemMang/heap_2.c  /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/include/../list.c /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/BF561/app_c.c /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_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/Free_RTOS_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/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin/bfin_isr.asm /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/BF561/user_isr.asm

In file included from test_ad1836_driver.c:13:

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

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

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

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

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

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

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

test_ad1836_driver.c: In function ‘prvSetupTimerInterrupt’:

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

test_ad1836_driver.c: In function ‘vBootTask’:

test_ad1836_driver.c:154: warning: unused variable ‘i’

test_ad1836_driver.c: In function ‘icc_task_init’:

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

test_ad1836_driver.c:203: warning: implicit declaration of function ‘coreb_msg’

test_ad1836_driver.c:217: warning: implicit declaration of function ‘strcpy’

test_ad1836_driver.c:217: warning: incompatible implicit declaration of built-in function ‘strcpy’

test_ad1836_driver.c:217: warning: pointer targets in passing argument 1 of ‘strcpy’ differ in signedness

test_ad1836_driver.c:221: warning: large integer implicitly truncated to unsigned type

test_ad1836_driver.c:222: warning: large integer implicitly truncated to unsigned type

test_ad1836_driver.c:223: warning: large integer implicitly truncated to unsigned type

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

test_ad1836_driver.c:238: warning: implicit declaration of function ‘sm_create_session’

test_ad1836_driver.c:251:13: warning: multi-line comment

test_ad1836_driver.c:369: warning: pointer targets in passing argument 2 of ‘xTaskGenericCreate’ differ in signedness

test_ad1836_driver.c:491:17: warning: multi-line comment

test_ad1836_driver.c:180: warning: unused variable ‘session’

test_ad1836_driver.c: In function ‘icc_task_exit’:

test_ad1836_driver.c:533: warning: implicit declaration of function ‘sm_destroy_session’

test_ad1836_driver.c: In function ‘Init_Sport_Interrupts’:

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

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/BF561/app_c.c: In function ‘app_launch_threads’:

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/BF561/app_c.c:137: warning: pointer targets in passing argument 2 of ‘xTaskGenericCreate’ differ in signedness

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/BF561/app_c.c:121: warning: unused variable ‘OS_result’

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin/context_sl_asm.asm:150:3: warning: multi-line comment

In file included from /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin/bfin_isr.asm:9:

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin/context_sl_asm.asm:150:3: warning: multi-line comment

In file included from /home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/BF561/user_isr.asm:5:

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/BF561/../Source/portable/ADI_VDSP/Blackfin/context_sl_asm.asm:150:3: warning: multi-line comment

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 -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' '-Ttext' '0x3c00000' '-L' '/opt/uClinux/bfin-elf/bfin-elf/lib' '-L' '/opt/uClinux/bfin-elf/bfin-elf/lib' '-lc'

GNU ld version 2.17

user_isr.o: In function `IVG11_ISR':

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/BF561/user_isr.asm:32: relocation truncated to fit: R_BFIN_PCREL24 against symbol `IVG11_ISR_Hook' defined in .text section in app_c.o

bfin_isr.o: In function `vContextSwitch':

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin/bfin_isr.asm:29: relocation truncated to fit: R_BFIN_PCREL24 against symbol `vTaskSwitchContext' defined in .text section in tasks.o

bfin_isr.o: In function `vTickISR':

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin/bfin_isr.asm:63: relocation truncated to fit: R_BFIN_PCREL24 against symbol `vTaskIncrementTick' defined in .text section in tasks.o

/home/william/Development_new/Music_Recognition/code/uCLinux/uclinux-dist/user/blkfin-apps/icc_utils/example/Free_RTOS_imp/Source/portable/ADI_VDSP/Blackfin/bfin_isr.asm:67: relocation truncated to fit: R_BFIN_PCREL24 against symbol `vTaskSwitchContext' defined in .text section in tasks.o

make: *** [test_ad1836_driver] Error 1

 

 

 

 

Best Regards,

 

 

 

Will

QuoteReplyEditDelete

 

 

2011-10-10 08:20:17     Re: problem linking with bfin-elf-ld

william pagnon (AUSTRALIA)

Message: 103771   

 

Hi,

 

 

 

I have finally resolve my problem. using the program objdump I looked at the setions of the code for the problematic symbole.

 

I tried to add to the functiondeclaration and definition: __attribute__ ((longcall)) but it didn't work.

 

the problem by the way (if some body read the thread for similar issues) is that the addressing of the external function definition is too remote from the place where it is called from giving the message: relocation truncated to fit

 

This thread put me on track:

 

 

 

http://www.xilinx.com/support/answers/20068.htm

 

 

 

To resolve the problem in my assembler code I did add before the function that contain the external call: CALL.X  _function

 

the section name to wich the external function call is declared in the C file. In my case this was:

 

 

 

.text

 

 

 

adding this resolved the issue putting the call to the function and the function definition close enought to be linked.

 

 

 

William

QuoteReplyEditDelete

 

 

2011-10-10 08:47:22     Re: problem linking with bfin-elf-ld

Jie Zhang (UNITED STATES)

Message: 103772   

 

__attribute__ ((longcall)) does not work when the call site is assembly code.

QuoteReplyEditDelete

 

 

2011-10-10 21:54:24     Re: problem linking with bfin-elf-ld

william pagnon (AUSTRALIA)

Message: 103775   

 

Thanks Jie,

 

 

 

that is actually good to know

Attachments

Outcomes