This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to add prefix 0x to hex?

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.

Parents
  • "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/

Reply
  • "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/

Children
  • "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.