As result it takes a lot of time to download. Are there any ways to minimise download code size?
C or Assembler?
I'm not sure where the problem is. Are you saying that your total program size is 100 bytes but the hex file is 2k? Hex files are usually much larger then the number of bytes in your program. The file is made up of a series of records. Each records contains a record type identifier, an address, one or more bytes of data and a checksum. Furthermore they are usually ASCII which doubles the size requirements (binary hex value 0x50 is stored as 0x35, 0x30). If you are transfering data to your target in ASCII format you could speed it up by transfering it in binary format. You would just have to define a protocol that both ends would have to follow. Or are you saying that your program is 100 bytes but things like startup code and C libraries are increasing the size of the program to 2k? If so you could write your program in assembler. Hope this helps. If not, please be more specific. -Walt
Convert the HEX file to a BINARY file. The filesize will then match the size of the code. Jon
How are you downloading? 2k takes "an awful long time" does not make sense Erik
Are you sure it's 2K? Note that the Windows explorer shows file sizes in multiples of the disk's cluster size - so even a 1-byte file may be shown as 2K!
main function starts at address 800h that is 2k. Converting it to bin and back results in 2k size. Can I change this base?
Then you need to implement a HEX loader. HEX files contain start addresses and check sums (a 100 Bytes Binary will then be about 300 Bytes, but still a lot smaller than 2K). HEX file format is described under: http://www.keil.com/support/docs/1584.htm
Of cource, I've implemented hex loader. However, the tusb3210 MCU requires header to be added to the single code segment. Therefore, I cannot load only those segments of code that will be executed. I also need to download 2k of NOPs. Why keil reserves them and how to get rid of them configuring copiler?
Finally we get to the real question. Of course, nobody can read your mind.
I also need to download 2k of NOPs. Why keil reserves them and how to get rid of them configuring copiler? It sounds like you are using the FREE evaluation compiler. It has certain limitations including code size and program starting address restrictions. If you want an unrestricted version, contact your Keil distributor and they will be happy to assist you. Jon