UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Participant herand
Participant
250 Views
Registered: ‎07-24-2017

XSCT script does not add libraries to linker correctly

Jump to solution

I'm having a very strange problem, while developing in the SDK, I occasionally got an error that the functions from the xilinx library xilffs were not found.

Strangely enough, they were activated in the BSP. After deactivating xilffs, regenerating the BSP source files, reactivating the library and again regenerating the sources, these errors were gone. I'd thought, well this is annoying but you know, whatever...

However, I am now trying to write a tcl script for xsct, automatically generating projects, configuring the BSP and build the project. The error now occurs everytime I try to run the script. My tcl script is as follows:

cd D:/FPGA/test_zybo/test_zybo.sdk
setws D:/FPGA/test_zybo/test_zybo.sdk
createhw -name toplevel_hw_platform_0 -hwspec toplevel.hdf

createapp -name zybo_fsbl -app {Zynq FSBL} -proc ps7_cortexa9_0 -hwproject toplevel_hw_platform_0 -os standalone
configapp -app zybo_fsbl build-config release

createapp -name zynq_test_project -app {Empty Application} -proc ps7_cortexa9_0 -hwproject toplevel_hw_platform_0 -os standalone
configapp -app zynq_test_project build-config release

importsources -name zynq_test_project -path "D:/FPGA_PUFs/RO/test_zybo/sdk" -linker-script

repo -set D:/FPGA/test_zybo/sw_repo
repo -scan

setlib -bsp zynq_test_project_bsp -lib test_lib
setlib -bsp zynq_test_project_bsp -lib lwip202
setlib -bsp zynq_test_project_bsp -lib xilffs

regenbsp -bsp zynq_test_project_bsp

configbsp -bsp zynq_test_project_bsp pcap true
configbsp -bsp zynq_test_project_bsp scugic true
configbsp -bsp zynq_test_project_bsp sd true
configbsp -bsp zynq_test_project_bsp xadc true
configbsp -bsp zynq_test_project_bsp gpio true
configbsp -bsp zynq_test_project_bsp tcpip true
configbsp -bsp zynq_test_project_bsp timer true
configbsp -bsp zynq_test_project_bsp uart true

configbsp -bsp zynq_test_project_bsp mem_size 2097152
configbsp -bsp zynq_test_project_bsp memp_n_pbuf 8
configbsp -bsp zynq_test_project_bsp memp_n_tcp_pcb 2
configbsp -bsp zynq_test_project_bsp memp_n_tcp_pcb_listen 4096
configbsp -bsp zynq_test_project_bsp memp_n_tcp_seg 4096
configbsp -bsp zynq_test_project_bsp pbuf_pool_size 4096
configbsp -bsp zynq_test_project_bsp tcp_snd_buf 65535
configbsp -bsp zynq_test_project_bsp tcp_wnd 65535
configbsp -bsp zynq_test_project_bsp phy_link_speed CONFIG_LINKSPEED1000
configbsp -bsp zynq_test_project_bsp lwip_udp false

regenbsp -bsp zynq_test_project_bsp

projects -clean
projects -build

exec bootgen -image D:/FPGA/test_zybo/sdk/zynq_test_project.bif -arch zynq -w -o D:/FPGA/test_zybo/bitstreams/BOOT.bin

I have written my own library, which includes some of the functions from lwip202 and xilffs.

I run the script from Vivado with the following code:

file mkdir "D:/FPGA_PUFs/RO/test_zybo/test_zybo.sdk"
file copy -force "D:/FPGA_PUFs/RO/test_zybo/test_zybo.runs/impl_1/toplevel.sysdef" "D:/FPGA_PUFs/RO/test_zybo/test_zybo.sdk/toplevel.hdf"
exec xsdk -batch -source "D:/FPGA/test_zybo/script.tcl"

Compilation is fine, but somehow something goes wrong with the linker:

'Building target: zynq_fw_project.elf'
'Invoking: ARM v7 gcc linker'
arm-none-eabi-gcc -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -Wl,-build-id=none -specs=Xilinx.spec -Wl,-T -Wl,../src/lscript.ld -L../../zynq_test_project_bsp/ps7_cortexa9_0/lib -o "zynq_test_project.elf" ./src/fw_com.o ./src/fw_data.o ./src/fw_hw.o ./src/fw_meas.o ./src/main.o ./src/platform.o ./src/tcpip_custom.o -Wl,--start-group,-lxil,-lgcc,-lc,--end-group
../../zynq_test_project_bsp/ps7_cortexa9_0/lib\libxil.a(ah_tcpip.o): In function `testlib_tcpip_intfcn_callback_accept':
D:\FPGA\test_zybo\test_zybo.sdk\zynq_test_project_bsp\ps7_cortexa9_0\libsrc\test_lib_v1_1\src/testlib_tcpip.c:936: undefined reference to `tcp_arg'
D:\FPGA\test_zybo\test_zybo.sdk\zynq_test_project_bsp\ps7_cortexa9_0\libsrc\test_lib_v1_1\src/testlib_tcpip.c:939: undefined reference to `tcp_sent'
D:\FPGA\test_zybo\test_zybo.sdk\zynq_test_project_bsp\ps7_cortexa9_0\libsrc\test_lib_v1_1\src/testlib_tcpip.c:942: undefined reference to `tcp_recv'
D:\FPGA\test_zybo\test_zybo.sdk\zynq_test_project_bsp\ps7_cortexa9_0\libsrc\test_lib_v1_1\src/testlib_tcpip.c:948: undefined reference to `tcp_err'


I am very confused, especially because if I open the workspace, repeat the process of deselecting/reselecting/regenerating the BSP sources, the linker then works very fine.

I have found that there are differences in the linker script calls, but I don't know how to set them by xsct:

Working version:

arm-none-eabi-gcc -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -Wl,-build-id=none -specs=Xilinx.spec -Wl,-T -Wl,../src/lscript.ld -L../../zynq_test_project_bsp/ps7_cortexa9_0/lib -o "zynq_test_project.elf" ./src/fw_com.o ./src/fw_data.o ./src/fw_hw.o ./src/fw_meas.o ./src/main.o ./src/platform.o ./src/tcpip_custom.o -Wl,--start-group,-lxil,-lgcc,-lc,--end-group -Wl,--start-group,-lxil,-llwip4,-lgcc,-lc,--end-group -Wl,--start-group,-lxilffs,-lxil,-lgcc,-lc,--end-group

Non-working version:

arm-none-eabi-gcc -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -Wl,-build-id=none -specs=Xilinx.spec -Wl,-T -Wl,../src/lscript.ld -L../../zynq_test_project_bsp/ps7_cortexa9_0/lib -o "zynq_test_project.elf" ./src/fw_com.o ./src/fw_data.o ./src/fw_hw.o ./src/fw_meas.o ./src/main.o ./src/platform.o ./src/tcpip_custom.o


I would appreciate every help even slightly pointing me to the correct direction, thanks in advance.


Kind regards, herand

 

 

0 Kudos
1 Solution

Accepted Solutions
Participant herand
Participant
183 Views
Registered: ‎07-24-2017

Re: XSCT script does not add libraries to linker correctly

Jump to solution

And now I also present a final solution: Turn around the order of project creation.

I don't know why but know the full flow works fine, when the fsbl is created after the "real" project and bsp are created and configured:

createhw ...
repo -set ...
repo -scan ...
createbsp ... 
setlib -bsp...
configbsp -bsp ...
updatemss -mss ...
regenbsp -bsp ....
createapp -name zynq_test_project ...
configapp -app ...
importsources -name ....
createapp -name zybo_fsbl ...
configapp -app zybo_fsbl build-config release
projects -build
exec bootgen -image ....

Hope this helps someone in the future who struggles with the same problem.

Kind regards, herand

0 Kudos
3 Replies
Participant herand
Participant
209 Views
Registered: ‎07-24-2017

Re: XSCT script does not add libraries to linker correctly

Jump to solution

Update by my side, hoping someone will recognize this new error.

After reading lots and lots of examples, I decided to go the way suggested in UG1208 Ch.4 "Working with Libraries". I changed the order such that I create the BSP first, set and configure the libs, update the mss file with updatemss (which I didn't do before) and then regenbsp.

Then I wanted to create the app based on the ready-to-use BSP by calling:

createapp -name zynq_test_project -app {Empty Application} -proc ps7_cortexa9_0 -bsp  zynq_test_project_bsp -hwproject toplevel_hw_platform_0 -os standalone

This gives me a new error as follows:

Building '/toplevel_hw_platform_0'
Library compiler flags not available for test_lib 1.1
Failed to create Application project zynq_test_project.Library compiler flags not available for test_lib 1.1
    while executing
"error [dict get $msg err]"
    (procedure "xsdk_eval" line 15)
    invoked from within
"xsdk_eval $chan "Xsdk" createProject "o{$fmt}" e [list $data]"
    (procedure "createapp" line 76)
    invoked from within
"createapp -name zynq_test_project -app {Empty Application} -proc ps7_cortexa9_0 -bsp zynq_test_project_bsp -hwproject toplevel_hw_platform_0 -os standalone"
    (file "D:/FPGA_PUFs/test_zybo/tcl/help_generate_sdk_projects.tcl" line 42)
    while executing
"exec xsdk -batch -source [format "%s/%s" $project_sources_tcl "help_generate_sdk_projects.tcl"]"
    (file "D:/FPGA_PUFs/....tcl" line 92)

Again, starting the SDK from Vivado and executing the same command in the SDK XSCT console works perfectly fine, but fails every time in Vivado.

 

 

0 Kudos
Participant herand
Participant
190 Views
Registered: ‎07-24-2017

Re: XSCT script does not add libraries to linker correctly

Jump to solution

I finally found the source of error, somehow right before the call to createapp, the xsct server crashes. I tested it on 3 different computers with 3 different OS (Windows 8.1, Windows 10, CentOS), the crash occurs on each of them.

The workaround solution: restart the xsct server in the script by executing the script temp_xsdb_launch_script.tcl, which is called when the SDK starts, containing the following code:

set xsdb_idle_timeout -1;source C:/Xilinx/SDK/2018.3/scripts/xsdb/xsdb/xsdb-server.tcl

Is there any tcl function providing the path to the current installation, e.g. C:\Xilinx\SDK\2018.3 ?

 

If some Xilinx employee is interested in the error logs:

SDK.log

20:38:48 INFO  : Result from executing command 'getProjects': zybo_fsbl;zybo_fsbl_bsp;zynq_test_bsp;zynq_test_hw_platform_0
20:41:07 ERROR : xsct server communication channel has closed unexpectedly.
java.net.SocketException: Connection reset
	at java.net.SocketInputStream.read(SocketInputStream.java:209)
	at java.net.SocketInputStream.read(SocketInputStream.java:141)
	at java.io.BufferedInputStream.read1(BufferedInputStream.java:284)
	at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
	at java.io.FilterInputStream.read(FilterInputStream.java:107)
	at org.eclipse.tcf.core.ChannelTCP.get(ChannelTCP.java:185)
	at org.eclipse.tcf.core.StreamChannel.read(StreamChannel.java:84)
	at org.eclipse.tcf.core.AbstractChannel$1.run(AbstractChannel.java:327)

/.metadata/.log

!ENTRY com.xilinx.sdk.utils 0 0 2019-05-22 20:38:42.152
!MESSAGE XSCT command with result: [::hsi::utils::get_hw_sw_details -json D:/FPGA/test_zybo/test_zybo.sdk/zynq_test_hw_platform_0/system.hdf D:/FPGA/test_zybo/test_zybo.sdk/zynq_test_bsp/system.mss], Result: [null, {"procname": "ps7_cortexa9_0",
"osname": "standalone",
"osver": "6.8",
}]. Thread: Thread-44

!ENTRY com.xilinx.sdk.utils 0 0 2019-05-22 20:38:42.154
!MESSAGE XSCT Command: [::hsi::utils::generate_bsp_sources D:/FPGA_PUFs/RO/test_zybo/test_zybo.sdk/zynq_fw_hw_platform/system.hdf D:/FPGA_PUFs/RO/test_zybo/test_zybo.sdk/zynq_fw_bsp/system.mss D:/FPGA_PUFs/RO/test_zybo/test_zybo.sdk/zynq_fw_bsp], Thread: Thread-44

!ENTRY com.xilinx.sdk.utils 0 0 2019-05-22 20:38:43.473
!MESSAGE XSCT command with result: [::hsi::utils::generate_bsp_sources D:/FPGA_PUFs/RO/test_zybo/test_zybo.sdk/zynq_fw_hw_platform/system.hdf D:/FPGA_PUFs/RO/test_zybo/test_zybo.sdk/zynq_fw_bsp/system.mss D:/FPGA_PUFs/RO/test_zybo/test_zybo.sdk/zynq_fw_bsp], Result: [null, ]. Thread: Thread-44

!ENTRY org.eclipse.cdt.core 1 0 2019-05-22 20:38:45.185
!MESSAGE Indexed 'zynq_fw_bsp' (123 sources, 75 headers) in 1,55 sec: 4.548 declarations; 29.567 references; 47 unresolved inclusions; 3 syntax errors; 53 unresolved names (0,16 %)

!ENTRY org.eclipse.cdt.core 1 0 2019-05-22 20:38:45.678
!MESSAGE Indexed 'zybo_fsbl' (11 sources, 59 headers) in 0,463 sec: 1.660 declarations; 7.640 references; 0 unresolved inclusions; 0 syntax errors; 0 unresolved names (0 %)

!ENTRY org.eclipse.cdt.core 1 0 2019-05-22 20:38:46.877
!MESSAGE Indexed 'zybo_fsbl_bsp' (127 sources, 84 headers) in 1,19 sec: 5.433 declarations; 34.791 references; 47 unresolved inclusions; 3 syntax errors; 53 unresolved names (0,13 %)

!ENTRY org.eclipse.cdt.core 4 0 2019-05-22 20:38:51.401
!MESSAGE Error
!STACK 0
java.lang.NullPointerException
	at org.eclipse.cdt.internal.core.ConsoleOutputSniffer.processLine(ConsoleOutputSniffer.java:178)
	at org.eclipse.cdt.internal.core.ConsoleOutputSniffer.access$0(ConsoleOutputSniffer.java:174)
	at org.eclipse.cdt.internal.core.ConsoleOutputSniffer$ConsoleOutputStream.checkLine(ConsoleOutputSniffer.java:99)
	at org.eclipse.cdt.internal.core.ConsoleOutputSniffer$ConsoleOutputStream.write(ConsoleOutputSniffer.java:58)
	at java.io.OutputStream.write(OutputStream.java:75)
	at org.eclipse.cdt.core.CommandLauncher.printCommandLine(CommandLauncher.java:287)
	at org.eclipse.cdt.core.CommandLauncher.waitAndRead(CommandLauncher.java:250)
	at org.eclipse.cdt.internal.core.BuildRunnerHelper.build(BuildRunnerHelper.java:273)
	at org.eclipse.cdt.make.core.MakeBuilder.invokeMake(MakeBuilder.java:219)
	at org.eclipse.cdt.make.core.MakeBuilder.build(MakeBuilder.java:108)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:735)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:246)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:301)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:304)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:263)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:403)
	at org.eclipse.core.internal.resources.Project$1.run(Project.java:551)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2240)
	at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:529)
	at org.eclipse.core.internal.resources.Project.build(Project.java:112)
	at com.xilinx.sdk.cmdline.application.AppBuilder.build(AppBuilder.java:130)
	at com.xilinx.sdk.cmdline.application.AppBuilder.build(AppBuilder.java:101)
	at com.xilinx.sdk.cmdline.application.AppBuilder.start(AppBuilder.java:68)
	at com.xilinx.sdk.cmdline.service.SdkTcfCmdServer.executeCommand(SdkTcfCmdServer.java:201)
	at com.xilinx.sdk.cmdline.service.SdkTcfCmdServer.command(SdkTcfCmdServer.java:144)
	at com.xilinx.sdk.cmdline.service.SdkTcfCmdServer.access$2(SdkTcfCmdServer.java:87)
	at com.xilinx.sdk.cmdline.service.SdkTcfCmdServer$1.run(SdkTcfCmdServer.java:74)
	at java.lang.Thread.run(Thread.java:745)

(many more errors from here)

 

0 Kudos
Participant herand
Participant
184 Views
Registered: ‎07-24-2017

Re: XSCT script does not add libraries to linker correctly

Jump to solution

And now I also present a final solution: Turn around the order of project creation.

I don't know why but know the full flow works fine, when the fsbl is created after the "real" project and bsp are created and configured:

createhw ...
repo -set ...
repo -scan ...
createbsp ... 
setlib -bsp...
configbsp -bsp ...
updatemss -mss ...
regenbsp -bsp ....
createapp -name zynq_test_project ...
configapp -app ...
importsources -name ....
createapp -name zybo_fsbl ...
configapp -app zybo_fsbl build-config release
projects -build
exec bootgen -image ....

Hope this helps someone in the future who struggles with the same problem.

Kind regards, herand

0 Kudos