Intel® SoC FPGA Embedded Development Suite
Support for SoC FPGA Software Development, SoC FPGA HPS Architecture, HPS SoC Boot and Configuration, Operating Systems
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
573 Discussions

TCL Script - Automation of Compilation process and programming SOF file

Amir3
New Contributor I
1,753 Views

Hey,

 

I am trying to create a TCL script for automating the compilation process and SOF file programming.

 

I get this Error - "Error:Unknown option: -outdir"

I changed the "-outdir" to "-output_directory" but again I get the same Error

 

This is the script I wrote:

package require ::quartus::project

 

# Set the project directory
set project_dir "Y"

 

# Set the project name
set project_name "X"

 

# Set the output directory for compiled files
set output_dir "$project_dir/output_files"

 

# Set the name of the SOF file
set sof_file "$project_name.sof"

 

# Open the project
project_open $project_dir/$project_name.qpf

 

# Compile the project
execute_module -tool map
execute_module -tool fit
execute_module -tool asm
execute_module -tool sta
execute_module -tool sign

 

# Create the output directory if it does not exist
file mkdir $output_dir

 

# Generate the SOF file
set sof_path $output_dir/$sof_file
execute_module -tool asm_sof -outdir $output_dir -file $sof_path

 

# Launch the programmer window
launch_programmer -hardware_name "USB-Blaster"

 

# Wait for the programmer to open
after 1000

 

# Select the device and file in the programmer window
program_device -position 1 -file $sof_path -operation "Program"

 

Note - I write X and Y because I can't write the original values here

 

Thanks!

0 Kudos
1 Solution
RichardTanSY_Altera
1,716 Views

You may checkout this document for all the supported command-line and tcl scripting in Quartus.

https://www.intel.com/content/www/us/en/docs/programmable/683432/22-4/faq.html


The tcl command "execute_module -tool" support these option [-tool <asm|cdb|drc|eda|fit|map|syn|pow|sta|stp|sim|si|cpf|ipg|pfg> ]

I think the asm_sof is an illegal value. And there is no "output directory" option available for execute_module command.


Best Regards,

Richard Tan



View solution in original post

3 Replies
RichardTanSY_Altera
1,717 Views

You may checkout this document for all the supported command-line and tcl scripting in Quartus.

https://www.intel.com/content/www/us/en/docs/programmable/683432/22-4/faq.html


The tcl command "execute_module -tool" support these option [-tool <asm|cdb|drc|eda|fit|map|syn|pow|sta|stp|sim|si|cpf|ipg|pfg> ]

I think the asm_sof is an illegal value. And there is no "output directory" option available for execute_module command.


Best Regards,

Richard Tan



RichardTanSY_Altera
1,687 Views

As we do not receive any response from you on the previous question/reply/answer that we have provided. I now transition this thread to community support. 


Best Regards,

Richard Tan


p/s: If any answer from the community or Intel Support are helpful, please feel free to give best answer or rate 4/5 survey.


0 Kudos
Amir3
New Contributor I
1,620 Views

Hey Richard,

 

My updated TCL script:

package require ::quartus::project
package require ::quartus::flow

# Set the project directory
set project_dir "C:/Amir_Berger/Project/Y"

# Set the project name
set project_name "X"

# Set the output directory for compiled files
set output_dir "$project_dir/output_files"

# Set the name of the SOF file
set sof_file "$project_name.sof"

# Set the output directory for SOF file
set sof_dir "$output_dir/$sof_file"

# Open the project
project_open $project_dir/$project_name.qpf

# Complie Design
execute_flow -compile
qexec "quartus_pgm -c 1 -m JTAG -o MILTECH_2024.sof"

 

The errors I got:

Error:while executing
Error:"qexec "quartus_pgm -c 1 -m JTAG -o MILTECH_2024.sof""
Error: (file "ProgSOF_1.tcl" line 28)
Error: invoked from within
Error:"_source ProgSOF_1.tcl"
Error: ("uplevel" body line 1)
Error: invoked from within
Error:"uplevel 1 $cmd "
Error: (procedure "source" line 5)
Error: invoked from within
Error:"source ProgSOF_1.tcl"

 

Following this error description, I understand that the problem is related to the "qexec "quartus_pgm.." line, but I don't understand why.

 

I will appreciate your help

 

Thanks.

 

0 Kudos
Reply