STM32 bootloader protocol
Your own link specifies this as a binary protocol:

The host sends the bytes to the STM32 as follows:
Byte 1: 0x31
Byte 2: 0xCE
Wait for ACK
Byte 3 to byte 6:Start address (byte 3: MSB, byte 6: LSB)
Byte 7: Checksum: XOR (byte3, byte4, byte5, byte6)
Wait for ACK
Byte 8: Number of bytes to be received (0 &lt; N ≤ 255)
N +1 data bytes:(Max 256 bytes)
Checksum byte:XOR (N, N+1 data bytes)


The contents of the binary packet are similar to a line in a hex file (or an amalgamation of several contiguous ones) but this is binary, not an ASCII-hex representation.