If I attempt to write a bitstream with Vivado tool, there is no option to compress a bitstream that includes an ".elf" file.
How can this be done?
Create a file, write_ncd.tcl with the following two lines:
write_ncd -force system_stub.ncd
write_pcf -force system_stub.pcf
In the Vivado tool, click on Implementation Settings. In the Implementation Settings dialog box, select Implementation, then scroll down to "Route Design". Click on the right half of the "tcl.post" selection and select the write_ncd.tcl file. Close this dialog and implement your design.
This will export an NCD and PCF file to the implementation directory that can be used with BitGen to create a compressed bitstream with an ".elf" file. After creating the ".elf" file in SDK, open an ISE Design Suite Command Prompt. Use the "system_stub.ncd" and "system_stub.pcf" with a BitGen command, along with the -g compress and -bd <path to ELF file> options to generate a compressed bitstream with an ".elf" file in block RAM.
Following is a sample BitGen command using this flow as run from the location of the Vivado project file (XPR):
bitgen.exe -w -g compress -g StartUpClk:CCLK -bd .\vc707_multiboot_vivado.sdk\SDK\SDK_Export\golden_iprog\Debug\golden_iprog.elf .\vc707_multiboot_vivado.runs\impl_1\system_stub.ncd golden_iprog.bit .\vc707_multiboot_vivado.runs\impl_1\system_stub.pcf
NOTE: The path to the "write_ncd.tcl" file will be entered as an absolute path and will need to be updated if the project directory is moved.