## run_tool -name {GENERATEPROGRAMMINGDATA}
 run_tool_wrapper "run_tool -name {GENERATEPROGRAMMINGDATA} "

## run_tool -name {DEV_MEM_INIT}
 run_tool_wrapper "run_tool -name {DEV_MEM_INIT}"

configure_ram -cfg_file {./src/cfg/RAM.cfg}

#configure_ram -cfg_file {./src/cfg/SNVM.cfg}

#configure_ram -cfg_file {./src/cfg/UPROM.cfg}

#configure_design_initialization_data -second_stage_start_address {0x00000000} \
	 -third_stage_uprom_start_address {0x00000000} \
	 -third_stage_snvm_start_address {0x00000000} \
	 -third_stage_spi_start_address {0x00000400} \
	 -broadcast_RAMs {1} \
	 -standalone_initialization {0} \
	 -third_stage_spi_clock_divider {2} \
	 -auto_calib_timeout {3000}\
	 -init_timeout 128\
	 -third_stage_spi_type {SPIFLASH_NO_BINDING_PLAINTEXT}\

 #generate_design_initialization_data 


 generate_design_initialization_data 

## run_tool -name GENERATEPROGRAMMINGFILE
run_tool_wrapper "run_tool -name GENERATEPROGRAMMINGFILE
"

 puts "Programmingfile generated successfully\n" 
# Export STAPL file
export_bitstream_file \
	-file_name {top} \
	-export_dir ${PrjLocation}/designer/top/export \
	-format STP \
	-master_file 0 \
	-encrypted_uek1_file 0 \
	-encrypted_uek1_file_components {} \
	-encrypted_uek2_file 0 \
	-encrypted_uek2_file_components {} \
	-trusted_facility_file 1 \
	-trusted_facility_file_components "FABRIC SNVM"

puts "Exported bit stream successfully\n"

# Export Programming Job

# Programming job files can be imported in FlasPro Express standalone for programming the device
export_prog_job \
	-job_file_name {top} \
	-export_dir ${PrjLocation}/designer/top/export \
	-bitstream_file_type {TRUSTED_FACILITY} \
	-bitstream_file_components {FABRIC SNVM} \
	-program_design 1 \
	-program_spi_flash 0 \
	-include_plaintext_passkey 0 

puts "Exported job file successfully\n"

puts "Full design flow passed execution"
