AR# 63384

|

2014.4 - SDK - How to create SDK projects using SDK in Batch mode

Description

Below is a short demo on how to create SDK projects using SDK in Batch mode.

Solution

To launch batch mode, run the command below in an SDK shell:
xsdk -batch
 
To create a Hardware Platform:
create_project -type hw -name hw_0 -hwspec system.hdf
 
To create a Base System Platform (BSP):
create_project -type bsp -name bsp_0 -hwproject hw_0 -proc microblaze_0 -os standalone
Where, OS can be standalone, or xilkernel
 
To create an Application:
create_project -type app -name helloworld -hwproject hw_0 -proc microblaze_0 -os standalone -lang C -app {Hello World} -bsp bsp_0
Below are the available template applications:
 
Standalone/Baremetal and Xilkernel OS Application Templates for Language C:
 
        {Hello World}
        {Empty Application}
        {Peripheral Tests}
        {Memory Tests}
        {Zynq FSBL}
        {Zynq DRAM tests}
        {Dhrystone}
        {lwIP Echo Server}
        {RSA Authentication App}
        {SREC Bootloader}
        {Xilkernel POSIX Threads Demo}
 
Standalone/Bare metal and Xilkernel OS Application Templates for Language C++:
 
        {Empty Application}
 
Linux OS Application Templates for Language C:
 
        {Linux Hello World}
        {Linux Empty Application}
        {OpenCV Example Application}
 
Linux OS Application Templates for Language C++:
 
        {Linux Empty Application}

 

Below is an example for a Typical MicroBlaze design exported from Vivado. 

This creates a Hardware Platform, BSP, and a Hello World Application:

xsdk -batch -source test.tcl
#Example test.tcl
#!/usr/bin/tclsh
set_workspace workspace
create_project -type hw -name hw_0 -hwspec <path the HDF file>.hdf
create_project -type bsp -name bsp_0 -hwproject hw_0 -proc microblaze_0 -os standalone
create_project -type app -name helloworld -hwproject hw_0 -proc microblaze_0 -os standalone -lang C -app {Hello World} -bsp bsp_0
build -type bsp -name bsp_0
build -type app  -name helloworld
clean -type all
build -type all
exit
 Below is an example for a typical design exported from Vivado.

This uses the HSI to find the processor, creates a Hardware Platform, BSP and a Custom Application and copies the sources files and builds:
 
xsdk -batch -source test.tcl
#Example test.tcl
#!/usr/bin/tclsh
set_workspace workspace
create_project -type hw -name hw_0 -hwspec <path the HDF file>.hdf
open_hw_design workspace/hw_0/system.hdf
set proc [::hsm::utils::get_procs]
set proc [lindex $proc 0]
if {$proc != ""} {
   create_project -type bsp -name bsp_0 -hwproject hw_0 -proc $proc -os standalone
} else {
   puts "No Processor found in design"
   exit
}
create_project -type app -name myapp -hwproject hw_0 -proc $proc -os standalone -lang C -app {Empty Application} -bsp bsp_0
file copy -force <path to source file>  workspace/myapp/src
build -type bsp  -name bsp_0
build -type app -name myapp 
clean -type all
build -type all
exit
 
Below is an example for a typical Zynq design exported from Vivado.

This creates a Hardware Platform, BSP, and an FSBL application:
xsdk -batch -source test.tcl
 
#Example test.tcl
#!/usr/bin/tclsh
set_workspace workspace
create_project -type hw -name hw -hwspec <path the HDF file>.hdf
cd workspace/hw
open_hw_design system.hdf
set bsp [create_sw_design bsp -proc ps7_cortexa9_0 -os standalone]
add_library xilffs
generate_bsp -sw $bsp -dir ../bsp -compile
cd ../..
create_project -type app -name fsbl -hwproject hw -proc ps7_cortexa9_0 -os standalone -lang C -app {Zynq FSBL} -bsp $bsp
build -type bsp  -name $bsp
build -type app -name fsbl 
clean -type all
build -type all
 
For more information, see (UG1138)
AR# 63384
Date 03/11/2015
Status Active
Type General Article
Devices More Less
Tools
People Also Viewed