cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Scholar
Scholar
8,682 Views
Registered: ‎04-27-2010

SDK undefined reference

Jump to solution

I am using Vivado 2017.3 with SDK. In SDK I enable the flash memory library. When I compile the program it complains of undefined reference for all the flash library functions even though the bsp has all the files. I have added the header file in my main, so I cant understand why there is a problem. Can someone explain what the issue is?

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Moderator
Moderator
10,077 Views
Registered: ‎09-12-2007

The compiler options dont seem to have this set:

--start-group,-lxil,-lgcc,-lc,--end-group

 

Can you right click on your app in SDK, and select C/C++ build settings. Then under Microblaze gcc linker -> Inferred options -> Software Platform, can you edit this, and add your library here.

 

For example

 

linker.PNG

View solution in original post

13 Replies
Highlighted
Xilinx Employee
Xilinx Employee
8,630 Views
Registered: ‎10-06-2016

Hi @beandigital

 

It might be that in the project settings of your application project the library has not been included in the linker options. If not wrong that should be automatically done when enabling the library in BSP but you might want to check it.

 

In the other hand can you post the console output of the compilation? The error message and the compilation command prints are quite usefull to understand what's going wrong when you have a compilation error ;)

 

Kind Regards,

Ibai


Ibai
Don’t forget to reply, kudo, and accept as solution.
0 Kudos
Highlighted
Scholar
Scholar
8,625 Views
Registered: ‎04-27-2010

Hi

 

This is what I get. Sometimes if I just disable then enable the flash library it works, other times it doesnt. Which settings should I be checking? Also I am now using 2017.4 and the problem still exists.

 

 

12:46:24 **** Auto Build of configuration Debug for project flash_mem ****
make all
'Building file: ../src/flash.c'
'Invoking: MicroBlaze gcc compiler'
mb-gcc -Wall -O0 -g3 -c -fmessage-length=0 -MT"src/flash.o" -I../../flash_mem_bsp/microblaze_0/include -mlittle-endian -mcpu=v10.0 -mxl-soft-mul -Wl,--no-relax -ffunction-sections -fdata-sections -MMD -MP -MF"src/flash.d" -MT"src/flash.o" -o "src/flash.o" "../src/flash.c"
'Finished building: ../src/flash.c'
' '
'Building target: flash_mem.elf'
'Invoking: MicroBlaze gcc linker'
mb-gcc -Wl,-T -Wl,../src/lscript.ld -L../../flash_mem_bsp/microblaze_0/lib -mlittle-endian -mcpu=v10.0 -mxl-soft-mul -Wl,--no-relax -Wl,--gc-sections -o "flash_mem.elf" ./src/flash.o -Wl,--start-group,-lxil,-lgcc,-lc,--end-group
./src/flash.o: In function `main':
D:\Work\Vivado\g400_001\g400_001.sdk\flash_mem\Debug/../src/flash.c:86: undefined reference to `XIsf_Initialize'
D:\Work\Vivado\g400_001\g400_001.sdk\flash_mem\Debug/../src/flash.c:98: undefined reference to `XIsf_WriteEnable'
D:\Work\Vivado\g400_001\g400_001.sdk\flash_mem\Debug/../src/flash.c:101: undefined reference to `XIsf_Erase'
D:\Work\Vivado\g400_001\g400_001.sdk\flash_mem\Debug/../src/flash.c:122: undefined reference to `XIsf_WriteEnable'
D:\Work\Vivado\g400_001\g400_001.sdk\flash_mem\Debug/../src/flash.c:125: undefined reference to `XIsf_Write'
D:\Work\Vivado\g400_001\g400_001.sdk\flash_mem\Debug/../src/flash.c:145: undefined reference to `XIsf_WriteEnable'
D:\Work\Vivado\g400_001\g400_001.sdk\flash_mem\Debug/../src/flash.c:148: undefined reference to `XIsf_Read'
./src/flash.o: In function `IsfWaitForFlashNotBusy':
D:\Work\Vivado\g400_001\g400_001.sdk\flash_mem\Debug/../src/flash.c:186: undefined reference to `XIsf_GetStatus'
collect2.exe: error: ld returned 1 exit status
make: *** [flash_mem.elf] Error 1

12:46:30 Build Finished (took 6s.483ms)

0 Kudos
Highlighted
Moderator
Moderator
10,078 Views
Registered: ‎09-12-2007

The compiler options dont seem to have this set:

--start-group,-lxil,-lgcc,-lc,--end-group

 

Can you right click on your app in SDK, and select C/C++ build settings. Then under Microblaze gcc linker -> Inferred options -> Software Platform, can you edit this, and add your library here.

 

For example

 

linker.PNG

View solution in original post

Highlighted
Scholar
Scholar
8,602 Views
Registered: ‎04-27-2010

Yes that seems to have worked, thanks.

0 Kudos
Highlighted
Observer
Observer
7,853 Views
Registered: ‎04-17-2018

Though I have added those things, in my build f_mount,f_close are still showing undefined reference.Please help me .

 

 

Untitled.png
0 Kudos
Highlighted
Explorer
Explorer
6,010 Views
Registered: ‎10-16-2018

Hi @stephenm,

After I added the required library (PmodDA3.h), I got another error.

Here is  a part of the consol output:

'Building target: FH_TX_2.elf'
'Invoking: MicroBlaze gcc linker'
mb-gcc -L"D:\Users\dell\Vivado_projects\FHSS_Transmitter_2\FHSS_Transmitter_2.sdk\FH_TX_2_bsp\microblaze_0\libsrc" -Wl,-T -Wl,../src/lscript.ld -L"D:\Users\dell\Vivado_projects\FHSS_Transmitter_2\FHSS_Transmitter_2.sdk\FH_TX_2_bsp\microblaze_0\lib" -mlittle-endian -mcpu=v10.0 -mxl-soft-mul -Wl,--no-relax -Wl,--gc-sections -o "FH_TX_2.elf" ./src/testperiph.o ./src/xiomodule_selftest_example.o -Wl,--start-group,-lxil,-lgcc,-lc,--end-group -Wl,--start-group,PmodDA3.h,-lxil,-lgcc,-lc,--end-group
d:/xilinx/sdk/2018.2/gnu/microblaze/nt/bin/../lib/gcc/microblaze-xilinx-elf/7.2.0/../../../../microblaze-xilinx-elf/bin/ld.exe: cannot find PmodDA3.h: No such file or directory
collect2.exe: error: ld returned 1 exit status
make: *** [FH_TX_2.elf] Error 1

00:11:55 Build Finished (took 829ms)

_________________________________________________

Looking forward your Help.

Thanks

0 Kudos
Highlighted
Visitor
Visitor
4,894 Views
Registered: ‎06-09-2019

Hi, I tried to do the same as u mintioned above. I can't actually edit these setting I don't know why. My error message is as shown . Thanks a lot 

*** Build of configuration Debug for project w3_example ****

make all
Building file: ../src/w3_example.c
Invoking: MicroBlaze gcc compiler
mb-gcc -Wall -O0 -g3 -I../../w3_TemplateProject_OnBoardPeriphs_v1p3_bsp/microblaze_0/include -c -fmessage-length=0 -mxl-barrel-shift -mxl-pattern-compare -mno-xl-soft-div -mcpu=v8.20.b -mno-xl-soft-mul -MMD -MP -MF"src/w3_example.d" -MT"src/w3_example.d" -o"src/w3_example.o" "../src/w3_example.c"
Finished building: ../src/w3_example.c

Building target: w3_example.elf
Invoking: MicroBlaze gcc linker
mb-gcc -Wl,-T -Wl,../src/lscript.ld -L../../w3_TemplateProject_OnBoardPeriphs_v1p3_bsp/microblaze_0/lib -mxl-barrel-shift -mxl-pattern-compare -mno-xl-soft-div -mcpu=v8.20.b -mno-xl-soft-mul -o"w3_example.elf" ./src/w3_example.o -Wl,--start-group,-lxil,-lgcc,-lc,--end-group
./src/w3_example.o: In function `main':
/home/abdelsalam/Desktop/Abdelsalam_research/Project_1/w3_TemplateProject_OnBoardPeriphs_v1p3/SDK_workspace/w3_example/Debug/../src/w3_example.c:44: undefined reference to `w3_eeprom_readSerialNum'
./src/w3_example.o: In function `userio_example':
makefile:39: recipe for target 'w3_example.elf' failed
/home/abdelsalam/Desktop/Abdelsalam_research/Project_1/w3_TemplateProject_OnBoardPeriphs_v1p3/SDK_workspace/w3_example/Debug/../src/w3_example.c:71: undefined reference to `microblaze_enable_exceptions'
./src/w3_example.o: In function `w3_node_init':
/home/abdelsalam/Desktop/Abdelsalam_research/Project_1/w3_TemplateProject_OnBoardPeriphs_v1p3/SDK_workspace/w3_example/Debug/../src/w3_example.c:76: undefined reference to `clk_init'
/home/abdelsalam/Desktop/Abdelsalam_research/Project_1/w3_TemplateProject_OnBoardPeriphs_v1p3/SDK_workspace/w3_example/Debug/../src/w3_example.c:84: undefined reference to `ad_init'
/home/abdelsalam/Desktop/Abdelsalam_research/Project_1/w3_TemplateProject_OnBoardPeriphs_v1p3/SDK_workspace/w3_example/Debug/../src/w3_example.c:91: undefined reference to `radio_controller_init'
/home/abdelsalam/Desktop/Abdelsalam_research/Project_1/w3_TemplateProject_OnBoardPeriphs_v1p3/SDK_workspace/w3_example/Debug/../src/w3_example.c:97: undefined reference to `iic_eeprom_init'
/home/abdelsalam/Desktop/Abdelsalam_research/Project_1/w3_TemplateProject_OnBoardPeriphs_v1p3/SDK_workspace/w3_example/Debug/../src/w3_example.c:103: undefined reference to `XTmrCtr_Initialize'
/home/abdelsalam/Desktop/Abdelsalam_research/Project_1/w3_TemplateProject_OnBoardPeriphs_v1p3/SDK_workspace/w3_example/Debug/../src/w3_example.c:110: undefined reference to `XTmrCtr_SetOptions'
/home/abdelsalam/Desktop/Abdelsalam_research/Project_1/w3_TemplateProject_OnBoardPeriphs_v1p3/SDK_workspace/w3_example/Debug/../src/w3_example.c:120: undefined reference to `XTmrCtr_SetResetValue'
./src/w3_example.o: In function `usleep':
/home/abdelsalam/Desktop/Abdelsalam_research/Project_1/w3_TemplateProject_OnBoardPeriphs_v1p3/SDK_workspace/w3_example/Debug/../src/w3_example.c:123: undefined reference to `XTmrCtr_Start'
/home/abdelsalam/Desktop/Abdelsalam_research/Project_1/w3_TemplateProject_OnBoardPeriphs_v1p3/SDK_workspace/w3_example/Debug/../src/w3_example.c:125: undefined reference to `XTmrCtr_IsExpired'
/home/abdelsalam/Desktop/Abdelsalam_research/Project_1/w3_TemplateProject_OnBoardPeriphs_v1p3/SDK_workspace/w3_example/Debug/../src/w3_example.c:130: undefined reference to `XTmrCtr_Reset'
/opt/Xilinx/13.4/ISE_DS/EDK/gnu/microblaze/lin64/bin/../lib/gcc/microblaze-xilinx-elf/4.1.2/../../../../microblaze-xilinx-elf/lib/bs/m/libxil.a(xil_printf.o): In function `padding':
/proj/epdsw/gnu/mb_gnu/src/gcc/libgloss/microblaze/xil_printf.c:50: undefined reference to `outbyte'
/opt/Xilinx/13.4/ISE_DS/EDK/gnu/microblaze/lin64/bin/../lib/gcc/microblaze-xilinx-elf/4.1.2/../../../../microblaze-xilinx-elf/lib/bs/m/libxil.a(xil_printf.o): In function `outnum':
/proj/epdsw/gnu/mb_gnu/src/gcc/libgloss/microblaze/xil_printf.c:111: undefined reference to `outbyte'
/opt/Xilinx/13.4/ISE_DS/EDK/gnu/microblaze/lin64/bin/../lib/gcc/microblaze-xilinx-elf/4.1.2/../../../../microblaze-xilinx-elf/lib/bs/m/libxil.a(xil_printf.o): In function `xil_printf':
/proj/epdsw/gnu/mb_gnu/src/gcc/libgloss/microblaze/xil_printf.c:163: undefined reference to `outbyte'
/proj/epdsw/gnu/mb_gnu/src/gcc/libgloss/microblaze/xil_printf.c:260: undefined reference to `outbyte'
/proj/epdsw/gnu/mb_gnu/src/gcc/libgloss/microblaze/xil_printf.c:233: undefined reference to `outbyte'
/opt/Xilinx/13.4/ISE_DS/EDK/gnu/microblaze/lin64/bin/../lib/gcc/microblaze-xilinx-elf/4.1.2/../../../../microblaze-xilinx-elf/lib/bs/m/libxil.a(xil_printf.o):/proj/epdsw/gnu/mb_gnu/src/gcc/libgloss/microblaze/xil_printf.c:229: more undefined references to `outbyte' follow
collect2: ld returned 1 exit status
make: *** [w3_example.elf] Error 1

0 Kudos
Highlighted
Explorer
Explorer
4,891 Views
Registered: ‎10-16-2018

Hi @abdelsalam ,

Could you plz, post a screen shot for the "Problems" tab . It may be help ma to indicate your error.

Thanks.

0 Kudos
Highlighted
Visitor
Visitor
4,842 Views
Registered: ‎06-09-2019

@ahmed_alfadhelThanks a lot for your replay.

In the follwing, pictures from the error message. And another one for the seeting which I can't edit

 

Thanks a lot in advance.

Screenshot from 2019-06-25 03-31-43.png
Screenshot from 2019-06-25 03-32-42.png
Screenshot from 2019-06-25 03-32-47.png
0 Kudos
Highlighted
Explorer
Explorer
4,828 Views
Registered: ‎10-16-2018

Welcome @abdelsalam ,

I meant , the "Porblems" tab :Capture.JPG

I want screenshot for it.

Thanks.

0 Kudos
Highlighted
Visitor
Visitor
4,800 Views
Registered: ‎06-09-2019

@ahmed_alfadhel  Hello.

finally I manged to solve the problem I was facing.

My actual error was this one "/bin/bash: gmake: command not found" and because I'm using upuntu I needed to run this line in my command window first,
"sudo ln -s /usr/bin/make /usr/bin/gmake"

And that solve the problem

Thank You for your help I appriciated.

Highlighted
Visitor
Visitor
3,501 Views
Registered: ‎05-30-2019

It looks like you mistyped lxilisf 

0 Kudos
Highlighted
1,251 Views
Registered: ‎06-02-2020

can you please tell me what did you write exactly in software platform inferred flag area to make it work?

0 Kudos