What is the purpose of s19 file? Am I right that it is used by flash programmer to download the code to MCU? But why can't a flash programmer download binary file directly onto MCU?
Because s19 is just text file, how can be a text file be flashed onto MCU?
I guess my main question is: I am missing the process between an s19 file and downloaded binary code in MCU
>>What is the purpose of s19 file?
wikipedia has this covered. In summary, it describes what (data) goes where (addresses) and also has provisions to ensure everything is intact (checksums)
>>Am I right that it is used by flash programmer to download the code to MCU?
>>But why can't a flash programmer download binary file directly onto MCU?
Some can, provided the binary file is correctly setup and the starting address is given, but it depends on the specific programmer and software you are using.
>>Because s19 is just text file, how can be a text file be flashed onto MCU?
Read the wikipedia article for some background first. The file contains addresses and data. Something (either a program on a PC or a bootloader on the MCU) will translate this ASCII info into the binary format the MCU requires and perform the "flashing" operation. Because the MCU only understands binary, some intermediate work is required to turn the ASCII description into the binary the MCU can execute from.
The S series of record formats are intended to be a standard that any chip and any programmer can be compatably used. It's in ASCII text with a defined format so file transfers are simple. Do a lookup in Wikipedia on "SREC". A much better explanation than I can provide.
I've written EPROM programmers that take S-records. It's an easy format to parse. L8R <<<)))
S19 is motorola's data format used in flashing tools similar ti intel's Hex format.
Intel hex format start with ':', followed by no of bytes, address, type, data & checksum in 2 byte ASCII data representing the actual byte code. This has a Binary to hex record ratio of ~ 2.1.
S19 format starts with 'S' followed by similar combination of data types in different order and has similar record ratio. If you want to know more about this, please go through http://srecord.sourceforge.net/ link.