I did some script to help me - Here, my inputs are: .sof file and .elf file.
After this, script will generate .hex file.
With this I NEED to use converter from altera (PLS ALTERA BOYS: CREATE A COMMAND LINE FOR .JIC GENERATION). But, this script help me a little.
(I attached!)
# !/bin/bash
sof=""
elf=""
hex=""
# Processing arguments
if [ $# -lt 3 ]; then
echo "Usage: jicgen -s <hardware.sof> -e <firmware.elf> -o <out_file.hex>"
echo "-s <hardware.sof> - Quartus Logic file"
echo "-e <firmware.elf> - Firmware NIOS generated file"
echo "-o <out_file.hex> - hex output file name"
echo
exit
fi
while [ $# -gt 0 ]
do
case $1
in
-s)
sof=$2
shift 2
;;
-e)
elf=$2
shift 2
;;
-o)
hex=$2
shift 2
;;
*)
echo "Usage: jicgen -s <hardware.sof> -e <firmware.sof> -o <out_file.hex>"
echo "-s <hardware.sof> - Quartus Logic file"
echo "-e <firmware.elf> - Firmware NIOS generated file"
echo "-o <out_file.hex> - hex output file name"
echo
shift 1
;;
esac
done
# Commands
echo "Converting SOF file..."
sof2flash --epcs --input=$sof --output=hw.flash --quiet
echo
echo "Converting ELF file..."
elf2flash --epcs --after=hw.flash --input=$elf --output=sw.flash
echo
echo "Creating HEX file..."
cp hw.flash hw_sw.flash
cat sw.flash >> hw_sw.flash
nios2-elf-objcopy --input-target srec --output-target ihex hw_sw.flash $hex
echo