2022-08-09 09:22 PM
2022-08-10 01:14 AM
The MCU isn't holding the .HEX file like that, the binary data it is describing is held as data in memory.
You could use standard serial transfer methods, say like XMODEM, to move it as a block of data. You could also have it "print" the data in a more familiar Intel or Motorola. HEX format if you're more comfortable with handling that. There will be about 2.5x the data.
On receiving side you'd take the data and use the HAL FLASH functions to write the data into memory.