Here are some examples plucked from my Makefiles.
Note the -Fill with -over option.
As well as how to align to a given block size and the use of parentheses to nest commands.
It might make sense to do the Fill on split Hex files before the bin conversion.
-----
# Find out the size:
srec_info $(OBJDIR)/$(TARGET).org.s19
# Note we build two CRC's the old one we always used so older boards can still be loaded by older program, then the new one used by newer BootLoaders:
srec_cat $(OBJDIR)/$(TARGET).org.hex -Intel -Little_Endian_CRC16 -MAximum-Address $(OBJDIR)/$(TARGET).org.hex -Intel -Cyclic_Redundancy_Check16_XMODEM -Fill 0xFF -OVER $(OBJDIR)/$(TARGET).org.hex -Intel -Output $(OBJDIR)/$(TARGET).hex.xmd -Intel
srec_cat $(OBJDIR)/$(TARGET).hex.xmd -Intel -Fill 0xFF -over $(OBJDIR)/$(TARGET).hex.xmd -Intel -o $(OBJDIR)/$(TARGET).flash.bin.1 -binary
# Align to 8 byte boundary:
# srec_cat test4.s19 -Output_Block_Size 8 -Output_Block_Packing -output test4new.s19
#
# Align to 64 byte boundary, which prevents internal breaks in srec_cat's implementation:
# srec_cat test4.s19 -Output_Block_Size 64 -Output_Block_Packing -output test4new64.s19
srec_cat \
'(' $(OBJDIR)/$(TARGET).org.s19 -Motorola -Fill 0xFF -Over $(OBJDIR)/$(TARGET).org.s19 -Motorola ')' \
-Output $(OBJDIR)/$(TARGET).$(NEW_BUILDNUMBER).bin -Binary
srec_cat -Output_Block_Size 64 -Output_Block_Packing \
'(' $(OBJDIR)/$(TARGET).org.s19 -Motorola -Fill 0xFF -Over $(OBJDIR)/$(TARGET).org.s19 -Motorola ')' \
-Output $(OBJDIR)/$(TARGET).$(NEW_BUILDNUMBER).s19 -Motorola
# Show what is in the Boot Config Area:
@echo KBOOT BCA:
srec_cat $(TARGET_DIR)/$(TARGET).bin -binary -crop 0x3c0 0x400 -output - -hex_dump
srec_cat $(TARGET_DIR)/$(TARGET).bin -binary -crop 0x400 0x410 -output - -hex_dump
srec_cat RadioBinaries/Model$(GPSPATH)/Radio_Model$(GPSPATH)_NoBootloader.hex -Intel -Output RadioBinaries/Model$(GPSPATH)/Radio_Model(GPSPATH)_flash.c -C_Array Radio_Flash