Hi sblpp,
您可以参考ModusToolbox中postbuild命令,使用srec_cat将hex中相关的部分删除:
- SREC_CAT_LOC=$(CY_TOOLS_DIR)/srecord/bin/srec_cat
- # Cymcuelftool populates the .cymeta and .cychecksum sections
- # which are not physical addresses on the device. They are
- # used by certain tools like PSoC Programmer to determine
- # the device and verify checksum. Since we don't use these
- # tools, these sections are removed. Keeping them will result
- # in errors during programming because these addresses don't
- # exist on the device.
- #
- # srec_cat tool is used to exclude addresses we don't care
- # about.
- METADATA_START_ADDR=0x90300000
- METADATA_END_ADDR=0x90700000
- POSTBUILD+=$(SREC_CAT_LOC) $(BINARY_OUT_PATH).hex -intel -exclude $(METADATA_START_ADDR) \
- $(METADATA_END_ADDR) -o $(BINARY_OUT_PATH)_stripped.hex -intel --Output_Block_Size 16 ; \
- cp -f $(BINARY_OUT_PATH)_stripped.hex $(BINARY_OUT_PATH).hex; \
- rm -f $(BINARY_OUT_PATH)_stripped.hex;
|