Hi! i am using P89c669 as master and P89v51 as Slave.The Slave program it self by using IAP method.the hex file for the program is received form master.so the master have the hex file.now the problem is to convert the normal hex to prefix added hex value [0x].because keil is not support the hex values without 0x prefix.Is there any solution for this. Thanks & Regards, K.T.Venkatesh.
"now the problem is to convert the normal hex to prefix added hex value [0x].because keil is not support the hex values without 0x prefix"
No, I don't think that is the problem at all!
For example, the Intel Hex format does not have "0x" prefixes, and there are plenty of examples - including Keil C51 examples - that work perfectly well with it.
Therefore, please explain in detail what you are trying to achieve, and why (you think) your current approach needs this "0x" prefix...
Hi! actually i want to save the hex flie in the P89C669 [example:- 02 05 81 e5 36 etc..]. the keil compiler gives error when i put 'e5' or 'f6' in the program.if i add 0x as prefix of the digits '0xe5' there is no more error.but it's difficult to convert a 32kb hex file with 0x prefix.i want to save the hex file as array in the program. Thanks & regards, K.T.Venkatesh.
A C program requries C rules when you add hexadecimal constants in the source code.
But why are you trying to paste a lot of Intel-hex data into your source? The Intel-hex data must be located at an absolute location, something that isn't possible if you add it as constants to your program.
Download both your binary and the Intel-hex file when you program the chip. Just make sure that the Intel-hex do specify a memory area that does not collide with your binary.
But before you do: Please post exactly what you are trying to do and mainly why do you want to do this?
Never, never, never post this kind of questions to a forum without a long and descriptive text why you think this is a good idea. There is a very large probability that you are barking up the wrong tree. Other peole don't have this problem - not because they are ont inventive, but probably because they now the correct way to get the result you are aiming for.
hi! sorry for my uncomplete description.i have use two boards.one is master another one is slave.i want to program the slave board using the master whenever i want.so the master must contain the hex code of slave.I thing there is only way to store the large amount of data in c by using the array am i right? [now i using the hex file with 0x prefix and its working fine]. what my query is "it is difficult to add the prefix 0x for all the hex datas in program, is there any simple method for storing the hex file in the program" then one more thing i am not using the intel hex file i am using the straight hex file. thanks & regards, K.T.Venkatesh.
"so the master must contain the hex code of slave"
Not necessarily.
How often will you need to re-program the slave?
Wouldn't it be easier to have the master receive the hex file from a PC (or whatever) "on the fly", and use this to program the slave?
"I thing there is only way to store the large amount of data in c by using the array am i right?"
I don't know about it being the only way, but it is probably the most convenient way!
But the real question is: do you really want it in the Master's source code at all?
If it really has to be in the Master's Flash (rather than done "on the fly" - see above), then why not just program it directly into Flash from the Hex file?
But if you really want it in the source code, there are utilities that will turn arbitrary data into 'C' definitions; eg, see srecord.sourceforge.net/
"Wouldn't it be easier to have the master receive the hex file from a PC (or whatever) 'on the fly', and use this to program the slave?"
That is to say:
1. the master receives one Hex record from the PC; 2. the master programs that one Hex record into the slave; 3. when the programming of that one record is complete, the master requests the next record from the PC; 4. repeat from 1 until the entire hex file has been programmed.
Hi! The programing to the slave is not done by a technical person.the application is likely to download the SW by the UI menu access.For this purpose only i want the hex file in program.If i download the hex file with the code to the flash how can i retrive the datas from the flash memory.I thing it's some more difficult than the array method. Thanks & regards, K.T.Venkatesh.
How do you program the master chip? Using Intel-hex or a binary download?
If a binary download, you can bad it with 0xff up to a fixed size, and then concatenate with the binary data for a slave.
If using Intel-hex, you can dump the slave data in Intel-hex format for location at a specific location in the flash, for example at offset 256kB into the flash memory.
It doesn't matter which method you select. Your master program can assume that the slave data starts at a specific offset in the flash (such as 256kB into the flash). Either add a little header with info (CRC and size) of the slave program, or just assume that all data until end of flash (or until only 0xff remains) are part of the slave application.
Hi! i use the intel-hex only for program the master.Thanks a lot for both of you. Regards, K.T.Venkatesh.