- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am trying to create a script so that the .sof file is copied to a specific location after the build is done. I went as far as adding this to the .qsf file: set_global_assignment -name POST_FLOW_SCRIPT_FILE "quartus_sh:post_compile.tcl" Now, I don't know what to put in the post_compile.tcl file to actually do the file copy. The build fails at the end because there is no post_compile.tcl yet. Does anyone know how to do this? Thank you!Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How about consulting a tcl manual? Unfortunately, I'm not aware of the copy syntax, but I know where to read about.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was not sure if Altera was using standard Tcl. I ended up adding this:
file copy -force src.rbf dest.rbf Right now, I am hardcoding the "src.rbf" name. I eventually would like to be able to use the top name for it so that this script can be generic and can be used for other projects. I will add a post when I find out how to do that. Thank you- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tcl has some direct commands for finding file names, stripping the prefix off, etc. (I don't remember the names though.) When writing out a file, I always use the following, which looks to see if the file exists, copies it to a .bak file, and then opens a new one. (The file used here was a .csf)
set filename src if {[file exists $filename.csf]} { if {[file exists $filenam.csf.bak]} { puts "removing $filenam.csf.bak" file delete $filename.csf.bak } file copy $filename.csf $filename.csf.bak puts "moving $filename.csf to $filename.csf.bak" file delete $filename.csf } set file [file open $filename.csf a] puts $file "Add some text to the file" puts $file "Add some more" close $file- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I got this working by doing this:
set rbf_file_name ".rbf"
post_message "### Copying output $rbf_file_name"
file copy -force $rbf_file_name new_dir/$rbf_file_name
This is what the Altera site says about the arguments passed in: --- Quote Start --- The first argument passed in the quartus(args) variable is the name of the flow or module being executed, depending on the assignment you use. The second argument is the name of the project, and the third argument is the name of the revision --- Quote End --- I am not sure how the output file name relates to these, but the script above seems to work fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You're selecting the second argument, which is the project name. Most output files are named after the revision, so I would change it to that. (In most projects the project name and revision name are the same, in which case it technically doesn't matter, but revision is probably correct.) Remember that:
a) Project name is the name of your .qpf. b) Revision is the name of the .qsf. There can be only one .qpf but multiple .qsf files, which are controlled under Project -> Revisions...- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Rysc!
This is the kind of clarification I was looking for. I did notice that argv[1] and [2] are the same, but that is probably because I have a simple project.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page