$input_path=$args[0]
$output_path=$args[1]
$len_address_start=$args[2]
$len_address_end=$args[2]+4
$output=srec_info $input_path -intel
$start_address=$output[2].Split(" - ")[3].Insert(0,"0x")
$end_address=$output[2].Split(" - ")[6].Insert(0,"0x")
$ind=$output[2].LastIndexOf(" ")
$size=${end_address}-${start_address}+1
$crc_address=[uint32]$end_address+1
$ss="$output_path.srec"
echo "Binary filesize - $size bytes"
$cmd=srec_cat $input_path -intel  -exclude $len_address_start $len_address_end -GEN  $len_address_start $len_address_end -CONSTant_Little_Endian $size 4  -o $output_path -intel
echo "$cmd"
$cmd=srec_cat $output_path -intel -crop $start_address $crc_address -CRC32LE $crc_address -o $output_path -intel

echo "CRC ADDRESS:                        CRC32:"
srec_cat $output_path -intel -crop $crc_address  -o - -hex-dump

$cmd=srec_cat $output_path -intel -o $ss -Motorola